我在 Hyper-V 中运行 CentOS 6.5。它最初使用 5GB 虚拟硬盘 (VHDX),但后来我决定增加大小。我在 Hyper-V 设置中将其更改为 20GB,然后启动分区 magic live CD 并将 /dev/sda 更改为 20GB。然后我运行以下命令来增加 LVM:
lvextend -l +100%FREE /dev/mapper/vg_condor-lv_root
我虽然这已经足够了,但它似乎仍然限制在原来的~4GB。以下是一些详细信息,但请询问您需要的任何具体内容,因为我对此还很陌生:
[root@condor leonard]# fdisk -l
Disk /dev/sda: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 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: 0x0006a679
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 2611 20458496 8e Linux LVM
Disk /dev/mapper/vg_condor-lv_root: 20.4 GB, 20409483264 bytes
255 heads, 63 sectors/track, 2481 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_condor-lv_swap: 536 MB, 536870912 bytes
255 heads, 63 sectors/track, 65 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@condor leonard]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_condor-lv_root
3.9G 1.1G 2.6G 29% /
tmpfs 495M 0 495M 0% /dev/shm
/dev/sda1 477M 82M 370M 19% /boot
[root@condor leonard]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sr0 11:0 1 1024M 0 rom
sda 8:0 0 20G 0 disk
├─sda1 8:1 0 500M 0 part /boot
└─sda2 8:2 0 19.5G 0 part
├─vg_condor-lv_root (dm-0) 253:0 0 19G 0 lvm /
└─vg_condor-lv_swap (dm-1) 253:1 0 512M 0 lvm [SWAP]
最终,如何正确增加/
文件夹的可用空间?
答案1
您仍然需要调整 LV 中包含的文件系统的大小(假设它是ext
文件系统之一):
resize2fs /dev/mapper/vg_condor-lv_root
如果您想在单个操作中调整逻辑卷及其文件系统的大小,请使用fsadm
:
fsadm resize /dev/mapper/vg_condor-lv_root
这支持ext
文件系统以及 ReiserFS 和 XFS。