[root@localhost ~]# fdisk /dev/sdb Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel Building a new DOS disklabel. Changes will remain in memory only, until you decide to write them. After that, of course, the previous content won't be recoverable.
The number of cylinders for this disk is set to 182024. There is nothing wrong with that, but this is larger than 1024, and could in certain setups cause problems with: 1) software that runs at boot time (e.g., old versions of LILO) 2) booting and partitioning software from other OSs (e.g., DOS FDISK, OS/2 FDISK) Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
Command (m for help): p 【显示磁盘基本信息】 Disk /dev/sdb: 1497.1 GB, 1497198755840 bytes 255 heads, 63 sectors/track, 182024 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
【此处可以看出,尚未对磁盘进行分区】 Command (m for help):n 【n:add a new partition】 Command action e extended 【选择主分区还是扩展分区】 p primary partition (1-4) p Partition number (1-4): 1 【选择分区数】 First cylinder (1-182024, default 1): 【设置分区大小。此处选择默认值,直接回车】 Using default value 1 Last cylinder or +size or +sizeM or +sizeK (1-182024, default 182024): Using default value 182024 Command (m for help):w 【如无误输入w保存配置信息,如不保存输入q退出】 The partition table has been altered!
Calling ioctl() to re-read partition table. Syncing disks
【再检查一下分区成功与否】 $ fdisk /dev/sdb The number of cylinders for this disk is set to 182024. There is nothing wrong with that, but this is larger than 1024, and could in certain setups cause problems with: 1) software that runs at boot time (e.g., old versions of LILO) 2) booting and partitioning software from other OSs (e.g., DOS FDISK, OS/2 FDISK)
Command (m for help): p 【如下查看分区之后的磁盘信息】 Disk /dev/sdb: 1497.1 GB, 1497198755840 bytes 255 heads, 63 sectors/track, 182024 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System /dev/sdb1 1 182024 1462107748+ 5 Extended
Command (m for help): q
【如果想划分多个分区,可以按以下操作】 [root@localhost ~]# fdisk /dev/sdb Command (m for help): p 【p:print the partintion table】 Disk /dev/sdb: 6442 MB, 6442450944 bytes 【显示磁盘基本信息】 255 heads, 63 sectors/track, 783 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System 此处可以看出,尚未对磁盘进行分区 Command (m for help):n 【n:add a new partition】 Command action e extended 【选择主分区还是扩展分区,在此选择主分区】 p primary partition (1-4) p Partition number (1-4): 3 【选择分区数】 First cylinder (1-783, default 1): 【设置分区大小。此处定义1000M。就是最接近1000M的柱面号码】 Using default value 1 Last cylinder or +size or +sizeM or +sizeK (1-783, default 783): +1000M Command (m for help):w 【如无误输入w保存配置信息,如不保存输入q退出】 Command (m for help): p 【如下查看分区之后的磁盘信息】 Disk /dev/sdb: 6442 MB, 6442450944 bytes 255 heads, 63 sectors/track, 783 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/sdb1 368 783 3341520 83 Linux /dev/sdb2 124 367 1959930 83 linux /dev/sdb3 1 123 987966 83 Linux