Linux扩容时新建分区报错No free sectors available

扩展后执行fdisk -l查看是否成功

[root@localhost ~]# fdisk -l

Disk/dev/sda:16.1GB,16106127360bytes

255heads,63sectors/track,1958cylinders

Units=cylindersof16065*512=8225280bytes

DeviceBootStartEndBlocksIdSystem

/dev/sda1*1648163+83Linux

/dev/sda275154088542+83Linux

/dev/sda35161239581553083Linux

/dev/sda4124013055301455Extended

/dev/sda512401305530113+82Linuxswap/Solaris

可见sda已经扩展成为16G,但是没分配给文件系统

继续执行fdisk /dev/sda进行新建磁盘
[root@localhost ~]# fdisk /dev/sda

Thenumberofcylindersforthisdiskissetto1958.

Thereisnothingwrongwiththat,butthisislargerthan1024,

andcouldincertainsetupscauseproblemswith:

1)softwarethatrunsatboottime(e.g.,oldversionsofLILO)

2)bootingandpartitioningsoftwarefromotherOSs

(e.g.,DOSFDISK,OS/2FDISK)

Command(mforhelp):n

Nofreesectorsavailable

前面执行fdisk-l的时候明明最后才是1305柱面,而且应该有1958柱面,为什么说没有空闲的扇区。

再看看fdisk-l执行结果,原来是/dev/sda5分配了作为swap分区,找到原因了就容易解决。

1.关闭swap分区#swapoff/dev/sda5

2.删除sda4和sda5.

[root@localhost ~]# fdisk /dev/sda

Thenumberofcylindersforthisdiskissetto1958.

Thereisnothingwrongwiththat,butthisislargerthan1024,

andcouldincertainsetupscauseproblemswith:

1)softwarethatrunsatboottime(e.g.,oldversionsofLILO)

2)bootingandpartitioningsoftwarefromotherOSs

(e.g.,DOSFDISK,OS/2FDISK)

Command(mforhelp):d

Partitionnumber(1-5):5

Command(mforhelp):d

Partitionnumber(1-5):4

3.建立扩展分区4,建立分区sda5,写入

Command (m for help): n

Commandaction

eextended

pprimarypartition(1-4)

e

Selectedpartition4

Firstcylinder(1240-1958,default1240):

Usingdefaultvalue1240

Lastcylinderor+sizeor+sizeMor+sizeK(1240-1958,default1958):

Usingdefaultvalue1958

Command(mforhelp):n

Firstcylinder(1240-1958,default1240):

Usingdefaultvalue1240

Lastcylinderor+sizeor+sizeMor+sizeK(1240-1958,default1958):

Usingdefaultvalue1958

Command(mforhelp):w

Thepartitiontablehasbeenaltered!

其他扩容继续参照网上的教程。

相关推荐