#找出系统中所在根目录所在磁盘,并查阅该硬盘内的相关信息
[root@localhost ~]# df / <==重点找出磁盘文件名而已
文件系统 1K-块 已用 可用 已用% 挂载点
/dev/hda2 9920624 2968604 6439952 32% /
[root@localhost ~]# fdisk /dev/hda ==>进入交互操纵模式,注意这里不要写具体的数字</p> <p>The number of cylinders for this disk is set to 2610.
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)</p> <p>Command (m for help): m <==等待输入,m是命令菜单
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition ==>删除一个分区
l list known partition types ==>创建逻辑分区
m print this menu
n add a new partition ==>增加一个分区
o create a new empty DOS partition table
p print the partition table ==>在屏幕上显示分区表
q quit without saving changes ==>不存储,直接离开fdisk程序
s create a new empty Sun disklabel
t change a partition's system id 变更分区类型
u change display/entry units
v verify the partition table
w write table to disk and exit ==>将刚才的操作写入分区表,慎重操作
x extra functionality (experts only)
Command (m for help): p ==>查看磁盘分区表,和终端命令模式下的fdisk -l 作用相同</p> <p>Disk /dev/hda: 21.4 GB, 21474836480 bytes
heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes</p> <p> Device Boot Start End Blocks Id System
/dev/hda1 * 1 13 104391 83 Linux
/dev/hda2 14 1288 10241437+ 83 Linux
/dev/hda3 1289 1925 5116702+ 83 Linux
/dev/hda4 1926 2610 5502262+ 5 Extended
/dev/hda5 1926 1989 514048+ 82 Linux swap / Solaris</p> <p>Command (m for help): d
Partition number (1-5): 4 ==>删除第4个分区</p> <p>Command (m for help): d ==>删除第3个分区
Partition number (1-4): 3</p> <p>Command (m for help): p ==>再次显示时观察下面只显示了前两个分区,第5个没显示</p> <p>Disk /dev/hda: 21.4 GB, 21474836480 bytes
heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes</p> <p> Device Boot Start End Blocks Id System
/dev/hda1 * 1 13 104391 83 Linux
/dev/hda2 14 1288 10241437+ 83 Linux</p> <p>Command (m for help): n ==>创建一个分区
Command action
e extended
p primary partition (1-4)
p ==>选择创建的分区类型为主分区
Partition number (1-4): 4 ==>选择4号做主分区
First cylinder (1289-2610, default 1289):
Using default value 1289 ==>起始柱面若直接按enter键就是使用默认值
Last cylinder or +size or +sizeM or +sizeK (1289-2610, default 2610): +512M</p> <p>Command (m for help): p ==>再次查看分区表,发现多了一个刚从建立的分区4</p> <p>Disk /dev/hda: 21.4 GB, 21474836480 bytes
heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes</p> <p> Device Boot Start End Blocks Id System
/dev/hda1 * 1 13 104391 83 Linux
/dev/hda2 14 1288 10241437+ 83 Linux
/dev/hda4 1289 1351 506047+ 83 Linux</p> <p>Command (m for help): n ==>再建一个分区
Command action
e extended
p primary partition (1-4)
e ==>建立扩展分区
Selected partition 3 ==>这个是系统主动选择的分区
First cylinder (1352-2610, default 1352):
Using default value 1352
Last cylinder or +size or +sizeM or +sizeK (1352-2610, default 2610):
Using default value 2610</p> <p>Command (m for help): p</p> <p>Disk /dev/hda: 21.4 GB, 21474836480 bytes
heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes</p> <p> Device Boot Start End Blocks Id System
/dev/hda1 * 1 13 104391 83 Linux
/dev/hda2 14 1288 10241437+ 83 Linux
/dev/hda3 1352 2610 10112917+ 5 Extended ==>看,刚新建的扩展分区
/dev/hda4 1289 1351 506047+ 83 Linux</p> <p>Partition table entries are not in disk order</p> <p>Command (m for help): n ==>再多建几个分区玩玩,反正后面不保存就行了,,呵呵
First cylinder (1352-2610, default 1352):
Using default value 1352
Last cylinder or +size or +sizeM or +sizeK (1352-2610, default 2610): +2084
Value out of range.
Last cylinder or +size or +sizeM or +sizeK (1352-2610, default 2610): +2084M</p> <p>Command (m for help): n ==>有没有发现,最后建立2个分区的时候根本没有询问我们要建立是主分区还是扩展分区,为啥?因为分区已经超过4了,您别无选择,只能是扩展分区了。。。
First cylinder (1606-2610, default 1606):
Using default value 1606
Last cylinder or +size or +sizeM or +sizeK (1606-2610, default 2610):
Using default value 2610</p> <p>Command (m for help): p</p> <p>Disk /dev/hda: 21.4 GB, 21474836480 bytes
heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes</p> <p> Device Boot Start End Blocks Id System
/dev/hda1 * 1 13 104391 83 Linux
/dev/hda2 14 1288 10241437+ 83 Linux
/dev/hda3 1352 2610 10112917+ 5 Extended
/dev/hda4 1289 1351 506047+ 83 Linux
/dev/hda5 1352 1605 2040223+ 83 Linux ==>这是后面又新建的2个分区
/dev/hda6 1606 2610 8072631 83 Linux</p> <p>Partition table entries are not in disk order</p> <p>Command (m for help): q ==>这里一定要按q啊,因为我刚才仅仅是演示操作,还破坏性的删除了2个分区,你要是真要分区,那就要按w保存了。</p> <p>[root@localhost ~]#