如何使用fdisk来创建一个扩展分区?
解决方法:

我们假定你正在修改你系统的第一个硬盘设备.(可以使用fdisk -l 来得到你当前分区的列表).

首先使用(n)命令来创建你的硬盘设备的一个新的分区:


# fdisk /dev/hda 

Command (m for help): n (create new partition)

Command action
  e   extended
  p   primary partition (1-4)

下一步使用'e'(将自动选择硬盘驱动器上的下一个可用的分区):

e
Selected partition 4

定义分区的起点,默认将选择硬盘驱动器上的下一个有效的柱面:

First cylinder (1675-4863, default 1675):
Using default value 1675

选择你新分区的大小,例如,为了创建一个1GB分区,你应该使用: +1024M

Last cylinder or +size or +sizeM or +sizeK (1675-4863, default 4863): +1024M

这时你重新回到命令行中,可以看到你最新创建的分区.

Command (m for help): p

Disk /dev/hda: 40.0 GB, 40000000000 bytes
255 heads, 63 sectors/track, 4863 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

  Device Boot      Start         End      Blocks   Id  System
/dev/hda1   *           1          13      104391   83  Linux
/dev/hda2              14        1543    12289725   83  Linux
/dev/hda3            1544        1674     1052257+  82  Linux swap
/dev/hda4            1675        1799     1004062+   5  Extended

最后一行是你新建的扩展分区,你看到的是以块为单位而不是以兆字节为单位的列表.分区ID类型自动设置为扩展分区,这样你可以在这个分区上创建你的文件系统.

最后使用写入/退出命令(w)保存和退出fdisk.这个命令执行后,所有的改变将永远保存.

Command (m for help): w