Http://www.cnblogs.com/ylqmf/archive/2011/10/10/2205298.html
Fdisk-L # check the number of hard disks on the current system.
Disk/dev/SDA: 36.4 GB, 36401479680 bytes
255 heads, 63 sectors/track, 4425 Cylinders
Units = cylinders of 16065*512 = 8225280 bytes
Device boot start end blocks ID system
/Dev/sda1*1 255 2048256 83 Linux
/Dev/sda2 256 1530 10241437 + 83 Linux
/Dev/sda3 4296 4425 1044225 82 Linux swap
/Dev/sda4 1531 4295 22209862 + F Win95 ext 'd (LBA)
/Dev/sda5 1531 2805 10241406 83 Linux
/Dev/sda6 2806 4295 11968393 + 83 Linux
Partition Table entries are not in disk order
Disk/dev/SDB: 36.7 GB, 36703918080 bytes # found here/dev/SDB, capacity 36.7 GB, not partitioned
255 heads, 63 sectors/track, 4462 Cylinders
Units = cylinders of 16065*512 = 8225280 bytes
Disk/dev/SDC doesn' t contain a valid Partition Table
Connect the hard disk to the server, start Linux, and log on as root.
For example, if I add a new SCSI hard disk, We need to divide it into three areas:
# Fdisk/dev/SDB
Enter the fdisk mode:
Command (M for help): P // view the partition of the New Hard Disk
Command (M for help): N // create a new partition
Run the M command to check the internal command of the fdisk command. Run the N command to create a new partition. Run the D command to delete an existing partition. Run the p command to display the partition list. Run the T command to modify the ID number of the partition type; l command to display the list of partition ID numbers; a command to specify to start the partition; W command is to modify the partition table to make it function.
Command action
E extended // input e to create an extended partition
P primary partition (1-4) // input P to create the primary partition. Here we select P
Partion number (1-4): 1 // The first extended partition, which can be divided into up to four primary partitions as needed
First cylinder (1-1014, default 1): 1 // Number of disks starting from the first primary Partition
Last cylindet or + Siza or + sizem or + sizek: + 1024 MB // It Can Be A number in MB or
Number of disk blocks. Here, we enter + MB to indicate that the partition size is 1 GB.
In this way, we have created a partition. If you want to create more partitions, you can continue to create the partition according to the above steps.
After the partition is created, use W to save the partition.
Command (M for help): W
The partition table has been altered!
Calling IOCTL () to re-read partition table.
Syncing disks.
In this way, the partition is complete and we need to format it.
# Mkfs-T ext3-C/dev/sdb1 // if multiple partitions exist, change the partition to sdb2.
After formatting, we need to mount the partition,
# Mkdir www // create/WWW directory. We will mount the new partition to www
# Mount/dev/sdb1/www // Mount/dev/sdb1 to/WWW
# DF // use the DF command to view
Filesystem 1k-blocks used available use % mounted on
/Dev/sda2 3771316 1388956 2190788 39%/
/Dev/sda1 101089 9463 86407 10%/boot
None 62988 0 62988 0%/dev/SHM
/Dev/sdb1 485906 8239 452580 2%/www //.
New Partition
At this point, our work is coming to an end, but if this is the case, we need
Manual mounting is very troublesome. We need to modify the/etc/fstab file for automatic mounting.
# Vi/etc/fstab
Add the following content at the end of the file:
/Dev/sdb1/WWW ext3 defaults 1 2
Modify sdb1 and/WWW if there are multiple partitions. Save the modification and restart the server.
Now we have finished adding a new hard disk.