在 /dev/sda 上创建新分区时出错,“没有可用的可用扇区”

在 /dev/sda 上创建新分区时出错,“没有可用的可用扇区”

我有一个 VirtualBox Linux Guest (Oracle Enterprise Linux 6),最近我将硬盘驱动器从 50Gb 扩展到 100Gb,然后使用 GParted 调整大小以使用新添加的 50GB(因为这是未分配的)。所有这些都很成功,但后来我遇到了错误“没有可用的可用扇区”

[root@oralab1 Desktop]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg_oralab1-lv_root
                       45G  4.2G   39G  10% /
tmpfs                 7.9G  100K  7.9G   1% /dev/shm
/dev/sda1             485M   55M  405M  12% /boot
[root@oralab1 Desktop]# 
[root@oralab1 Desktop]# 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 / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000ef7c4

   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       13055   104344576   8e  Linux LVM

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


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

[root@oralab1 Desktop]# 
[root@oralab1 Desktop]# 
[root@oralab1 Desktop]# 
[root@oralab1 Desktop]# 
[root@oralab1 Desktop]# fdisk /dev/sda

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 / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000ef7c4

   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       13055   104344576   8e  Linux LVM

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 3
No free sectors available

Command (m for help): ^C

我需要扩展并使用完整的 100GB。

依恋 (pvs、vgs 和 lvs 输出

答案1

你已经拥有 sda2 上的所有磁盘,正如我在pvs命令中看到的那样(大小 99Gb,50GB 可用)

所以你只需要增加已有的lvs分区即可。

lvextend -l +100%FREE /dev/mapper/vg_oralab1-lv_root

并在操作系统级别调整大小:

resize2fs /dev/mapper/vg_oralab1-lv_root

现在您正在使用 lvm 文件系统中的所有大小。

答案2

如果你想创建新分区,你可以使用lv创建代替fdisk /dev/sda。在命令行中按照以下步骤操作

步骤1:

 #  lvcreate --name lvname --size lvsize vgname
 # ex lvcreate --name lv_home --size 30G vg_oralab1

步骤 2:通过任意 Linux 文件系统格式化逻辑卷 (lv)

 # mkfs.xfs /dev/vg_oralab1/lv_home

第三步:创建挂载点并挂载lv

# mkdir /lv_part
# mount /dev/vg_oralab1/lv_home  /lv_part

步骤 4:检查分区

# df -h

注意:对于永久安装,请输入/etc/fstab

相关内容