How to add new hard drives to Linux

xiaoxiao2021-03-06  50

How to add new hard drives to Linux ?? Chinaunix

Connect the hard disk on the server, start Linux, log in to root. For example, I add a SCSI hard disk, you need to divide it into three districts:

Code: #fdisk / dev / sdb Enter fdisk mode: Command (M for help): P? // View new hard drive partition Command (M for help): n? // Creating a new partition You can use the m command to see fdisk command The internal command; n command creates a new partition; d Command Delete a partition; p command displays a list of partitions; t command modifies the type ID number of the partition; l Commands the list of partition ID numbers; a command specifies the start partition; W The command is the modification store of the partition table to act. Command action? // Input E Create an extension partition? P?? Primary partition (1-4)? // Enter P to create a master partition, here we choose P ation Number (1- 4): 1? // The first extension partition, according to your needs, you can get the number of four primary partition first cylinder (1-1014, default 1) :? 1? // The number of disk blocks started by the first primary partition Last Cylindet or Siza OR SIZEM OR SIZEK: 1024MB? / / Can be a number in MB or a disk block number, where we enter 1024MB indicate that the partition size is 1G. This way we created a partition, if you want to create more partitions, you can continue to create on the steps above. After the creation, use W to save the partition.

Code: Command (M for Help): w The Partition Table Has Been Altered! Calling ioctl () to re-read partition table. Syncing Disks. This will be formatted in terms of partitioning.

Code: #mkfs -t ext3 -c / dev / sdb1? // If there are multiple partitions, the partition is modified to SDB2, we need to mount partition,

Code: #mkdir www // Create / WWW directory, we will hang new partition to WWW #mount / dev / sdb1 / www? // Mount / DEV / SDB1 to / www # df? // Use DF Command to view filesystem???????????????? 3771316???? 3771316?? 1388956?? 2190788? 39% / / dev / sda1??? ????????????????? 0??????? 0? 0% / dev / SHM / DEV / SDB1???????????? 2% / www? // Seemed, this is what we just lived in the newly mounted partition, we have been close to the end. However, if we end, we must make a manual mount every time we restart the server, which is very troublesome, we need to modify the / etc / fstab file to automatically mount.

Code: #vi / etc / fstab fits the following contents at the end of the file:

Code: / dev / sdb1 ???????????????????????????? EXT3?? Defaults??? 1 2 If there are multiple partitions can be modified SDB1 and / WWW, saved after modification, restart the server. At this point, we have added a new hard drive.

转载请注明原文地址:https://www.9cbs.com/read-116023.html

New Post(0)