我正在运行带有多个虚拟机的 VMWare ESXi。其中一个虚拟机运行 Debian 6.0.6 Squeeze (x86_64),并有一个 16GB 的精简配置硬盘。现在这个硬盘已经满了,所以我将配置空间扩展到了 20GB。
我进入根控制台来扩展 LVM 以填充新的空间,但是 Debian 并没有注意到有更多可用空间——即使在虚拟机重新启动后也是如此。磁盘管理已经注意到可以使用更大的硬盘,调整大小将不会。
必填信息:
df -H
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/hlds--ls-root 16G 16G 6.8M 100% /
tmpfs 1.1G 0 1.1G 0% /lib/init/rw
udev 1.1G 103k 1.1G 1% /dev
tmpfs 1.1G 0 1.1G 0% /dev/shm
/dev/sda1 239M 17M 210M 8% /boot
fdisk -u -l
Disk /dev/sda: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders, total 41943040 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000c1f94
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 499711 248832 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 501758 33552383 16525313 5 Extended
/dev/sda5 501760 33552383 16525312 8e Linux LVM
Disk /dev/dm-0: 16.2 GB, 16177430528 bytes
255 heads, 63 sectors/track, 1966 cylinders, total 31596544 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Disk /dev/dm-0 doesn't contain a valid partition table
Disk /dev/dm-1: 742 MB, 742391808 bytes
255 heads, 63 sectors/track, 90 cylinders, total 1449984 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Disk /dev/dm-1 doesn't contain a valid partition table
不完全确定为什么 dm-0/dm-1 在那里。这是一个单磁盘系统,但仍然安装了 Debian 6.0.6 DVD(4GB)。
我发现我需要先扩展 /dev/sda2,然后扩展 /dev/sda5。我假设如果调整大小无法安全地发现可用空间,然后使用磁盘管理删除/重新创建分区也不是一个好主意。
pvdisplay
--- Physical volume ---
PV Name /dev/sda5
VG Name hlds-ls
PV Size 15.76 GiB / not usable 2.00 MiB
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 4034
Free PE 0
Allocated PE 4034
PV UUID yUJaSH-2igx-6Yzt-0vba-Rg5b-3BSq-XfouDV
lvdisplay /dev/hlds-ls/root
--- Logical volume ---
LV Name /dev/hlds-ls/root
VG Name hlds-ls
LV UUID svgWMF-kuUz-9Ip1-WGWc-cbkU-dy2m-QKfddW
LV Write Access read/write
LV Status available
# open 1
LV Size 15.07 GiB
Current LE 3857
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 254:0
vgdisplay hlds-ls
--- Volume group ---
VG Name hlds-ls
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 3
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 1
Act PV 1
VG Size 15.76 GiB
PE Size 4.00 MiB
Total PE 4034
Alloc PE / Size 4034 / 15.76 GiB
Free PE / Size 0 / 0
VG UUID 1KS0Br-quDG-5vxV-LYz3-ZTsS-2dmo-0micLM
答案1
您需要扩展物理卷调整大小然后使用以下方法扩展逻辑卷调整大小(或在该空间中创建新的逻辑卷)。