当我发现 8GB 不够用时,我分配了 15GB 的精简配置。现在 Debian 客户机无法识别大小的变化。
root@debian7-x64:~# lvdisplay
--- Logical volume ---
LV Path /dev/debian7-x64/root
LV Name root
VG Name debian7-x64
LV UUID EU6mg0-XTXC-ci3D-bQJi-7XN6-r8Hp-SYxcj0
LV Write Access read/write
LV Creation host, time debian7-x64, 2013-06-25 12:02:49 +0530
LV Status available
# open 1
LV Size 7.39 GiB
Current LE 1892
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 254:0
--- Logical volume ---
LV Path /dev/debian7-x64/swap_1
LV Name swap_1
VG Name debian7-x64
LV UUID xDNtoz-tJUq-M5D6-GGCN-gzcD-fwUv-fYYDR1
LV Write Access read/write
LV Creation host, time debian7-x64, 2013-06-25 12:02:49 +0530
LV Status available
# open 2
LV Size 376.00 MiB
Current LE 94
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 254:1
root@debian7-x64:~# pvdisplay
--- Physical volume ---
PV Name /dev/sda5
VG Name debian7-x64
PV Size 7.76 GiB / not usable 2.00 MiB
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 1986
Free PE 0
Allocated PE 1986
PV UUID SehkzH-Gq8Y-jI2f-27Tb-uv1Z-tR1R-5OnTxR
root@debian7-x64:~# sfdisk -s
/dev/sda: 15728640
/dev/mapper/debian7--x64-root: 7749632
/dev/mapper/debian7--x64-swap_1: 385024
total: 23863296 blocks
帮我扩展这个分区。重启没问题。我没有任何 Live CD。
环境:debian 7,带 lvm,在 vsphere 上,ext4 分区。如有需要,可提供更多详细信息。
答案1
步骤如下:
调整物理卷的大小:
# pvresize /dev/sda5
调整逻辑卷大小:
# lvresize -L+2GB /dev/mapper/debian7--x64-root
调整文件系统大小:
resize2fs /dev/mapper/debian7--x64-root