Use fdisk to add hard disk partitions and fdisk to add Hard Disk Partitions
1. use fdisk to create 6 partitions [1 P + 1E (5L)] // dev/sdb1/dev/sdb5/dev/sdb6/dev/sdb7/dev/sdb8/deb/sdb9
1 [root@server ~]# fdisk -l 2 3 Disk /dev/sda: 8589 MB, 8589934592 bytes 4 255 heads, 63 sectors/track, 1044 cylinders 5 Units = cylinders of 16065 * 512 = 8225280 bytes 6 Sector size (logical/physical): 512 bytes / 512 bytes 7 I/O size (minimum/optimal): 512 bytes / 512 bytes 8 Disk identifier: 0x000aec72 9 10 Device Boot Start End Blocks Id System11 /dev/sda1 * 1 26 204800 83 Linux12 Partition 1 does not end on cylinder boundary.13 /dev/sda2 26 91 524288 82 Linux swap / Solaris14 Partition 2 does not end on cylinder boundary.15 /dev/sda3 91 1045 7658496 83 Linux16 17 Disk /dev/sdb: 1073 MB, 1073741824 bytes18 255 heads, 63 sectors/track, 130 cylinders19 Units = cylinders of 16065 * 512 = 8225280 bytes20 Sector size (logical/physical): 512 bytes / 512 bytes21 I/O size (minimum/optimal): 512 bytes / 512 bytes22 Disk identifier: 0x00000000
2. fdisk-cu/dev/sdb start partitioning
1 [root @ server ~] # Fdisk-cu/dev/sdb //-c: indicates to discard the DOS compatibility mode and switch to the mode.-u: change from cylindrical partition to Sector partition 2 Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel3 Building a new DOS disklabel with disk identifier 0x94c5ab35. 4 Changes will remain in memory only, until you decide to write them.5 After that, of course, the previous content won't be recoverable.6 7 Warning: invalid flag 0x0000 of partition table 4 will be corrected by w (rite) 8 9 Command (m for help ):
3. Enter m to view help
1 Command (m for help ): m 2 Command action 3 a toggle a bootable flag 4 B edit bsd disklabel 5 c toggle the dos compatibility flag 6 d delete a partition // delete the created partition 7 l list known partition types/ /list partition types 8 m print this menu // view help 9 n add a new partition // create a new partition 10 o create a new empty DOS partition table11 p print the partition table // print partition table 12 q quit without saving changes13 s create a new empty Sun disklabel14 t change a partition's system id15 u change display/entry units16 v verify the partition table17 w write table to disk and exit // write to the partition table to save 18 x extra functionality (experts only) 19 20 Command (m for help ):
4. Split a 10 m primary Partition
1 Command (m for help): n 2 Command action 3 e extended // represents the extended partition 4 p primary partition (1-4) // indicates the primary Partition 5 p // select p primary Partition 6 Partition number (1-4): 1 7 First sector (2048-2097151, default 2048 ): // default 2048 start 8 Using default value 2048 9 Last sector, + sectors or + size {K, M, G} (2048-2097151, default 2097151 ): + 10M10 11 Command (m for help): p12 13 Disk/dev/sdb: 1073 MB, 1073741824 bytes14 255 heads, 63 sectors/track, 130 cylinders, total 2097152 sectors15 Units = sectors of 1*512 = 512 bytes16 Sector size (logical/physical): 512 bytes/512 bytes17 I/O size (minimum/optimal ): 512 bytes/512 bytes18 Disk identifier: 0x94c5ab3519 20 Device Boot Start End Blocks Id System21/dev/sdb1 2048 22527 83 Linux
5. allocate all the remaining space to the extended partition.
1 Command (m for help): n 2 Command action 3 e extended 4 p primary partition (1-4) 5 e 6 Partition number (1-4 ): 2 // select the Partition Number as 2 7 First sector (22528-2097151, default 22528): // default size: 8 Using default value 22528 9 Last sector, + sectors or + size {K, M, G} (22528-2097151, default 2097151): // default size: 10 Using default value 209715111 12 Command (m for help ): p // print 13 14 Disk/dev/sdb: 1073 MB, 1073741824 bytes15 255 heads, 63 sectors/track, 130 cylinders, total 2097152 sectors16 Units = sectors of 1*512 = 512 bytes17 Sector size (logical/physical): 512 bytes/512 bytes18 I/O size (minimum/optimal ): 512 bytes/512 bytes19 Disk identifier: 0x94c5ab3520 21 Device Boot Start End Blocks Id System22/dev/sdb1 2048 22527 10240 83 Linux23/dev/sdb2 22528 2097151 1037312 5 Extended24 25 Command (m for help): n
6. Divide the extended partition into five logical partitions. First, create 1st logical partitions with a size of 10 MB.
1 Command (m for help): n 2 Command action 3 l logical (5 or over) 4 p primary partition (1-4) 5 l // select create logical partition 6 First sector (24576-2097151, default 24576): // start by default and press enter 7 Using default value 24576 8 Last sector, + sectors or + size {K, M, G} (24576-2097151, default 2097151): + 10 M // input partition size 10 M 9 10 Command (m for help ): p // print partition 11 12 Disk/dev/sdb: 1073 MB, 1073741824 bytes13 255 heads, 63 sectors/track, 130 cylinders, total 2097152 sectors14 Units = sectors of 1*512 = 512 bytes15 Sector size (logical/physical): 512 bytes/512 bytes16 I/O size (minimum/optimal ): 512 bytes/512 bytes17 Disk identifier: 0x94c5ab3518 19 Device Boot Start End Blocks Id System20/dev/sdb1 2048 22527 10240 83 Linux21/dev/sdb2 22528 2097151 1037312 24576 5 Extended22/dev/sdb5 45055 10240 83 Linux // Partition Table from starting from 5, logical Partition
7. Create 2nd 10 m logical partitions in the extended partition.
1 Command (m for help): n 2 Command action 3 l logical (5 or over) 4 p primary partition (1-4) 5 l 6 First sector (47104-2097151, default 47104): 7 Using default value 47104 8 Last sector, +sectors or +size{K,M,G} (47104-2097151, default 2097151): +10M 9 10 Command (m for help): p11 12 Disk /dev/sdb: 1073 MB, 1073741824 bytes13 255 heads, 63 sectors/track, 130 cylinders, total 2097152 sectors14 Units = sectors of 1 * 512 = 512 bytes15 Sector size (logical/physical): 512 bytes / 512 bytes16 I/O size (minimum/optimal): 512 bytes / 512 bytes17 Disk identifier: 0x94c5ab3518 19 Device Boot Start End Blocks Id System20 /dev/sdb1 2048 22527 10240 83 Linux21 /dev/sdb2 22528 2097151 1037312 5 Extended22 /dev/sdb5 24576 45055 10240 83 Linux23 /dev/sdb6 47104 67583 10240 83 Linux
8. Create 3rd 10 m logical partitions in the extended partition.
1 Command (m for help): n 2 Command action 3 l logical (5 or over) 4 p primary partition (1-4) 5 l 6 First sector (69632-2097151, default 69632): 7 Using default value 69632 8 Supported: 10^N: KB (KiloByte), MB (MegaByte), GB (GigaByte) 9 2^N: K (KibiByte), M (MebiByte), G (GibiByte)10 Last sector, +sectors or +size{K,M,G} (69632-2097151, default 2097151): =11 Last sector, +sectors or +size{K,M,G} (69632-2097151, default 2097151): +10M12 13 Command (m for help): p14 15 Disk /dev/sdb: 1073 MB, 1073741824 bytes16 255 heads, 63 sectors/track, 130 cylinders, total 2097152 sectors17 Units = sectors of 1 * 512 = 512 bytes18 Sector size (logical/physical): 512 bytes / 512 bytes19 I/O size (minimum/optimal): 512 bytes / 512 bytes20 Disk identifier: 0x94c5ab3521 22 Device Boot Start End Blocks Id System23 /dev/sdb1 2048 22527 10240 83 Linux24 /dev/sdb2 22528 2097151 1037312 5 Extended25 /dev/sdb5 24576 45055 10240 83 Linux26 /dev/sdb6 47104 67583 10240 83 Linux27 /dev/sdb7 69632 90111 10240 83 Linux
9. Create 4th logical partitions of 10 m in the extended partition.
1 Command (m for help): n 2 Command action 3 l logical (5 or over) 4 p primary partition (1-4) 5 l 6 First sector (92160-2097151, default 92160): 7 Using default value 92160 8 Last sector, +sectors or +size{K,M,G} (92160-2097151, default 2097151): +10M 9 10 Command (m for help): p11 12 Disk /dev/sdb: 1073 MB, 1073741824 bytes13 255 heads, 63 sectors/track, 130 cylinders, total 2097152 sectors14 Units = sectors of 1 * 512 = 512 bytes15 Sector size (logical/physical): 512 bytes / 512 bytes16 I/O size (minimum/optimal): 512 bytes / 512 bytes17 Disk identifier: 0x94c5ab3518 19 Device Boot Start End Blocks Id System20 /dev/sdb1 2048 22527 10240 83 Linux21 /dev/sdb2 22528 2097151 1037312 5 Extended22 /dev/sdb5 24576 45055 10240 83 Linux23 /dev/sdb6 47104 67583 10240 83 Linux24 /dev/sdb7 69632 90111 10240 83 Linux25 /dev/sdb8 92160 112639 10240 83 Linux
10. Create 5th logical partitions in the extended partitions and allocate the remaining space.
1 Command (m for help): n 2 Command action 3 l logical (5 or over) 4 p primary partition (1-4) 5 l 6 First sector (114688-2097151, default 114688): 7 Using default value 114688 8 Last sector, +sectors or +size{K,M,G} (114688-2097151, default 2097151): 9 Using default value 209715110 11 Command (m for help): p12 13 Disk /dev/sdb: 1073 MB, 1073741824 bytes14 255 heads, 63 sectors/track, 130 cylinders, total 2097152 sectors15 Units = sectors of 1 * 512 = 512 bytes16 Sector size (logical/physical): 512 bytes / 512 bytes17 I/O size (minimum/optimal): 512 bytes / 512 bytes18 Disk identifier: 0x94c5ab3519 20 Device Boot Start End Blocks Id System21 /dev/sdb1 2048 22527 10240 83 Linux22 /dev/sdb2 22528 2097151 1037312 5 Extended23 /dev/sdb5 24576 45055 10240 83 Linux24 /dev/sdb6 47104 67583 10240 83 Linux25 /dev/sdb7 69632 90111 10240 83 Linux26 /dev/sdb8 92160 112639 10240 83 Linux27 /dev/sdb9 114688 2097151 991232 83 Linux
11. Change/dev/sdb9 to LVM partition (that is, dynamic adjustment)
1 Command (m for help): t 2 Partition number (1-9): 9 // ID of the Partition to be modified 3 Hex code (type L to list codes ): 8e // represents the LVM, And the Id 4 Changed system type of partition 9 to 8e (Linux LVM) 5 6 Command (m for help) can be queried by l ): p 7 8 Disk/dev/sdb: 1073 MB, 1073741824 bytes 9 255 heads, 63 sectors/track, 130 cylinders, total 2097152 sectors10 Units = sectors of 1*512 = 512 bytes11 Sector size (logical/physical): 512 bytes/512 bytes12 I/O size (minimum/optimal ): 512 bytes/512 bytes13 Disk identifier: 0x94c5ab3514 15 Device Boot Start End Blocks Id System16/dev/sdb1 2048 22527 10240 83 Linux17/dev/sdb2 22528 2097151 1037312 24576 5 Extended18/dev/sdb5 45055 10240 83 Linux19/dev/sdb6 47104 67583 10240 83 Linux20/dev/sdb7 69632 90111 10240 83 Linux21/dev/sdb8 92160 112639 10240 83 Linux22/dev/sdb9 114688 2097151 991232 8e Linux LVM
12. Partition end work
1 Command (m for help): w // write partition table 2 The partition table has been altered! 3 4 Calling ioctl () to re-read partition table.5 Syncing disks.6 [root @ server ~] # Partprobe/dev/sdb // notify the kernel of the Partition Table Modification result, so that the system can be restarted without being restarted.
Now the partitioning is finished !!