[原]使用cdlinux扩展lvm管理的根分区
下载cdlinux,CDlinux-0.9.6_CE.iso, 地址http://cdlinux.info/wiki/doku.php/zh/download/latest先看操作系统的情况:
关机。
修改虚拟机硬盘大小,由60GB改成80GB:
设置使用 CDlinux-0.9.6_CE.iso 启动:
启动系统:
查看一下磁盘的状态:
bash# fdisk -l
可以看到磁盘的确扩张了
为扩展出来的空间分区:
bash# fdisk /dev/sda
再看看现在的分区情况:
重启,再次使用cdlinux启动。
现在开始进入正题了:
先去掉烦人的sudo:
bash$ sudo su -
看一下现在vg和pv的简要信息:
bash# vgs VG #PV #LV #SN Attr VSize VFree VolGroup00 2 2 0 wz--n- 59.88g 32.00m bash# pvs PV VG Fmt Attr PSize PFree /dev/sda2 VolGroup00 lvm2 a- 39.88g 0 /dev/sda3 VolGroup00 lvm2 a- 20.00g 32.00m
将刚才准备好的新partition创建成pv,在看看pv的简要信息:
bash# pvcreate /dev/sda4 Physical volume "/dev/sda4" successfully created bash# pvs PV VG Fmt Attr PSize PFree /dev/sda2 VolGroup00 lvm2 a- 39.88g 0 /dev/sda3 VolGroup00 lvm2 a- 20.00g 32.00m /dev/sda4 lvm2 a- 20.00g 20.00g
将pv加入vg中:
bash# vgextend VolGroup00 /dev/sda4 Volume group "VolGroup00" successfully extended bash# pvs PV VG Fmt Attr PSize PFree /dev/sda2 VolGroup00 lvm2 a- 39.88g 0 /dev/sda3 VolGroup00 lvm2 a- 20.00g 32.00m /dev/sda4 VolGroup00 lvm2 a- 20.00g 20.00g
激活vg,并扩大lv:
bash# vgchange -ay 2 logical volume(s) in volume group "VolGroup00" now active bash# lvextend -L+20G /dev/VolGroup00/LogVol00 Extending logical volume LogVol00 to 74.03 GiB Logical volume LogVol00 successfully resized
检查一下扩大后的lv:
bash# e2fsck -f /dev/VolGroup00/LogVol00 e2fsck 1.41.11 (14-Mar-2010) Pass 1: Checking inodes, blocks, and sizes Pass 2: Checking directory structure Pass 3: Checking directory connectivity Pass 4: Checking reference counts Pass 5: Checking group summary information /dev/VolGroup00/LogVol00: 340971/7080416 files (1.0% non-contiguous), 2264624/14163968 blocks
最后扩充lv上的文件系统:
bash# resize2fs /dev/VolGroup00/LogVol00 resize2fs 1.41.11 (14-Mar-2010) Resizing the filesystem on /dev/VolGroup00/LogVol00 to 19406848 (4k) blocks. The filesystem on /dev/VolGroup00/LogVol00 is now 19406848 blocks long.
重启系统,这次不用cdlnux启动了:
看看现在磁盘状况: