我正在使用多個虛擬機器運行 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
您需要擴展物理卷調整大小然後使用擴展邏輯卷調整大小(或在該空間中建立新的邏輯磁碟區)。