通过网络TXT模式给XenServer制作Centos6模板时不能自定义分区,安装完成后SWAP有点大,有点浪费系统有限的空间,记录下缩小LVM SWAP过程。
查看当前LVM卷:
lvscan
ACTIVE '/dev/VolGroup00/LogVol00' [37.88 GB] inherit
ACTIVE '/dev/VolGroup00/LogVol01' [2.00 GB] inherit
查看当前挂载的SWAP分区:
swapon -s
Filename Type Size Used Priority
/dev/mapper/VolGroup00-LogVol01 partition 2097144 0 -1
调整SWAP所在LV大小:
lvreduce -L 512M /dev/mapper/VolGroup00-LogVol01
#调整为512M大小,也可使用+/-
重新挂载SWAP:
swapoff -a
#关闭SWAP
mkswap /dev/mapper/VolGroup00-LogVol01
#重新创建调整过的LV为SWAP
swapon /dev/mapper/VolGroup00-LogVol01
#开启SWAP
扩充剩余的PE到主分区LV:
lvresize -l +48 /dev/mapper/VolGroup00-LogVol00
resize2fs /dev/mapper/VolGroup00-LogVol00
调整后的LV卷:
lvscan
ACTIVE '/dev/VolGroup00/LogVol00' [39.38 GB] inherit
ACTIVE '/dev/VolGroup00/LogVol01' [512.00 MB] inherit