没有可用的可用扇区 - 无法添加新分区

没有可用的可用扇区 - 无法添加新分区

我正在尝试向 60 GB 磁盘添加额外的 40 GB,使其成为 100GB。磁盘从后端添加,在 fdisk 中显示为 100GB。但是,当我尝试创建新分区时,我收到错误“没有可用的空闲扇区”。

尝试使用 fdisk /dev/sda 创建分区时,如下所示:

]# fdisk /dev/sda

The device presents a logical sector size that is smaller than
the physical sector size. Aligning to a physical sector (or optimal
I/O) size boundary is recommended, or performance may be impacted.

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
         switch off the mode (command 'c') and change display units to
         sectors (command 'u').

Command (m for help): p

Disk /dev/sda: 107.4 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x0006d1e9

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          64      512000   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              64        6528    51915776   8e  Linux LVM
/dev/sda3            6528        7832    10481740   8e  Linux LVM
/dev/sda4            7833        9137    10482412+   5  Extended
/dev/sda5            7833        9137    10482381   8e  Linux LVM
Partition 5 does not start on physical sector boundary.

Command (m for help): n
No free sectors available

Command (m for help): q

fdisk -l 输出如下:

 ~]# fdisk -l

Disk /dev/sda: 107.4 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x0006d1e9

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          64      512000   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              64        6528    51915776   8e  Linux LVM
/dev/sda3            6528        7832    10481740   8e  Linux LVM
/dev/sda4            7833        9137    10482412+   5  Extended
/dev/sda5            7833        9137    10482381   8e  Linux LVM
Partition 5 does not start on physical sector boundary.

Disk /dev/mapper/vg_nkpdpbn01-lv_root: 69.2 GB, 69247959040 bytes
255 heads, 63 sectors/track, 8418 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000


Disk /dev/mapper/vg_nkpdpbn01-lv_swap: 5368 MB, 5368709120 bytes
255 heads, 63 sectors/track, 652 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000

此外:

 ~]# lsblk
NAME                            MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda                               8:0    0  100G  0 disk
ââsda1                            8:1    0  500M  0 part /boot
ââsda2                            8:2    0 49.5G  0 part
â ââvg_nkpdpbn01-lv_root (dm-0) 253:0    0 64.5G  0 lvm  /
â ââvg_nkpdpbn01-lv_swap (dm-1) 253:1    0    5G  0 lvm  [SWAP]
ââsda3                            8:3    0   10G  0 part
â ââvg_nkpdpbn01-lv_root (dm-0) 253:0    0 64.5G  0 lvm  /
ââsda4                            8:4    0    1K  0 part
ââsda5                            8:5    0   10G  0 part
  ââvg_nkpdpbn01-lv_root (dm-0) 253:0    0 64.5G  0 lvm  /
sr0                              11:0    1 1024M  0 rom



 ~]# pvs
File descriptor 63 (pipe:[355848]) leaked on pvs invocation. Parent PID 20225: -bash
  PV         VG           Fmt  Attr PSize  PFree
  /dev/sda2  vg_nkpdpbn01 lvm2 a--  49.51g    0
  /dev/sda3  vg_nkpdpbn01 lvm2 a--   9.99g    0
  /dev/sda5  vg_nkpdpbn01 lvm2 a--   9.99g    0
 ~]# lvs
File descriptor 63 (pipe:[356102]) leaked on lvs invocation. Parent PID 20225: -bash
  LV      VG           Attr       LSize  Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  lv_root vg_nkpdpbn01 -wi-ao---- 64.49g
  lv_swap vg_nkpdpbn01 -wi-ao----  5.00g
 ~]# vgs
File descriptor 63 (pipe:[356125]) leaked on vgs invocation. Parent PID 20225: -bash
  VG           #PV #LV #SN Attr   VSize  VFree
  vg_nkpdpbn01   3   2   0 wz--n- 69.49g    0


~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg_nkpdpbn01-lv_root
                       64G   44G   17G  73% /
tmpfs                 3.9G  4.0K  3.9G   1% /dev/shm
/dev/sda1             477M  115M  337M  26% /boot

答案1

我猜您有 3 个主分区(sda1、sda2、sda3)、1 个扩展分区(sda4)和 sd5 作为逻辑分区。使用parted,尝试调整分区4的大小。

例子:

分开/dev/sdb

    Disk /dev/sdb: 2000GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Number  Start   End     Size    Type      File system  Flags
 1      1049kB  1049GB  1049GB  primary   ntfs
 2      1049GB  1796GB  747GB   extended
 5      1049GB  1796GB  747GB   logical

(parted) resizepart
Partition number? 2
End?  [1796GB]? 2000GB
(parted) p
Model: WD My Passport 0748 (scsi)
Disk /dev/sdb: 2000GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Number  Start   End     Size    Type      File system  Flags
 1      1049kB  1049GB  1049GB  primary   ntfs
 2      1049GB  2000GB  951GB   extended
 5      1049GB  1796GB  747GB   logical

现在尝试使用 fdisk 或 parted 添加新的逻辑分区,无论您想使用哪个。

使用 fdisk,您需要删除 sda4 和 sd5,然后再次添加它并保持相同的开头,重叠 sda4 和 sd5 可能会产生问题。

注意:保留数据备份并首先了解和测试它,并自行承担风险可能如下,但未经测试:

  1. Delete partition 4  ( Command (m for help): d and enter number 4 )
     2. Add it again and keep the first sector as old one ( Command (m for help): n, choose extended partition e
        , Partition number 4 , First Sector - 7833 , Last Sector - Default

     3. Add logical partition 5 -
     ( Command (m for help): n, Adding logical partition 5 , choose default for first and last sector 

    4 Modify beginning of logical partition 5 to old value ,  Expert command (m for help): b
    Partition number (1,2,5, default 5):5
    New beginning of data - 7833

    5 print table and verify

答案2

我找到了解决方案。 1. 使用parted 增加扩展卷大小。 - 从命令行输入命令“parted”。无需卸载卷或进入救援模式。

parted

打印表格并查看当前分配:

(parted) print
  • 将扩展分区的大小从当前大小调整为新的可用大小。就我而言,它是 100GB

    (分开)调整大小 4 64.4GB 100GB

  • 打印并查看新的分配

    (分开)打印

  • 现在进行 fdisk 分区并创建新分区 sda6

    fdisk /dev/sda

相关内容