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

来源:网络 文章列表 2021-05-07 1355
Linux扩容时新建分区报错No free sectors available

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

  1. [root@localhost ~ ]# fdisk - l
  2. Disk / dev / sda: 16.1 GB, 16106127360 bytes
  3. 255 heads, 63 sectors / track, 1958 cylinders
  4. Units = cylinders of 16065 * 512 = 8225280 bytes
  5. Device Boot Start End Blocks Id System
  6. / dev / sda1 * 1 6 48163 + 83 Linux
  7. / dev / sda2 7 515 4088542 + 83 Linux
  8. / dev / sda3 516 1239 5815530 83 Linux
  9. / dev / sda4 1240 1305 530145 5 Extended
  10. / dev / sda5 1240 1305 530113 + 82 Linux swap / Solaris

可见sda已经扩展成为16G,但是没分配给文件系统
继续执行fdisk /dev/sda进行新建磁盘

  1. [root@localhost ~ ]# fdisk / dev / sda
  2. The number of cylinders for this disk is set to 1958 .
  3. There is nothing wrong with that, but this is larger than 1024 ,
  4. and could in certain setups cause problems with:
  5. 1 ) software that runs at boot time (e.g., old versions of LILO)
  6. 2 ) booting and partitioning software from other OSs
  7. (e.g., DOS FDISK, OS / 2 FDISK)
  8. Command (m for help): n
  9. No free sectors available

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

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

1.关闭swap分区 # swapoff /dev/sda5
2.删除sda4和sda5.

  1. [root@localhost ~ ]# fdisk / dev / sda
  2. The number of cylinders for this disk is set to 1958 .
  3. There is nothing wrong with that, but this is larger than 1024 ,
  4. and could in certain setups cause problems with:
  5. 1 ) software that runs at boot time (e.g., old versions of LILO)
  6. 2 ) booting and partitioning software from other OSs
  7. (e.g., DOS FDISK, OS / 2 FDISK)
  8. Command (m for help): d
  9. Partition number ( 1 - 5 ): 5
  10. Command (m for help): d
  11. Partition number ( 1 - 5 ): 4

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

  1. Command (m for help): n
  2. Command action
  3. e extended
  4. p primary partition ( 1 - 4 )
  5. e
  6. Selected partition 4
  7. First cylinder ( 1240 - 1958 , default 1240 ):
  8. Using default value 1240
  9. Last cylinder or + size or + sizeM or + sizeK ( 1240 - 1958 , default 1958 ):
  10. Using default value 1958
  11. Command (m for help): n
  12. First cylinder ( 1240 - 1958 , default 1240 ):
  13. Using default value 1240
  14. Last cylinder or + size or + sizeM or + sizeK ( 1240 - 1958 , default 1958 ):
  15. Using default value 1958
  16. Command (m for help): w
  17. The partition table has been altered !

 

腾讯云限量秒杀

1核2G 5M 50元/年 2核4G 8M 74元/年 4核8G 5M 818元/年 CDN流量包 100GB 9元

版权声明

本站部分原创文章,部分文章整理自网络。如有转载的文章侵犯了您的版权,请联系站长删除处理。如果您有优质文章,欢迎发稿给我们!联系站长:QQ:1292237044
愿本站的内容能为您的学习、工作带来绵薄之力。

评论

  • 随机获取
点击刷新
精彩评论