本文共 1066 字,大约阅读时间需要 3 分钟。
OpenStack的磁盘已经满了。默认装centos的时候root分区很小,而home分区却很大。
之前创建的一台虚拟机连不上virsh了。OpenStack界面上不能重启了。只能删除。
virsh list也看不到了 发现虚拟机文件里面的disk和console.log文件被改成了root权限,正常的应该是qemu权限。而且libvirt.xml文件的配置信息被清除了。这个应该是libvirt里面的机制。
libvirt里面也有autodestory这个选项
那么重新进行分区。缩小home的大小,增大root的大小
1.备份/home目录数据
2.卸载这个/home并删除这个逻辑卷homeumount /home
3.删除/dev/mapper/centos-home这个逻辑卷
lvremove /dev/mapper/centos-homeDo you really want to remove active logical volume home? [y/n]: y Logical volume "home" successfully removed
4.新建一个卷home,fdisk格式化为8e格式,文件系统还是搞为xfs,同时分配挂载到home
lvcreate -L 50G -n home centosWARNING: xfs signature detected on /dev/centos/home at offset 0. Wipe it? [y/n]: y Wiping xfs signature on /dev/centos/home. Logical volume "home" created.
5.激活卷组centos,使得这个新建的home逻辑卷生效(用vgchange而不用lvchange)
vgchange -ay centos
6.在新建的逻辑卷home上建立xfs文件系统
mkfs -t xfs /dev/centos/home
7.把这个新逻辑卷home挂到之前的文件夹/home中去
mount /dev/centos/home /home/
8.最后再把释放出来多余的空间分配给root卷并xfs_growfs扩展文件系统
lvextend -L +823G /dev/centos/root
9.再次激活下卷组centos
vgchange -ay centos
10.扩展这个区
xfs_growfs /dev/mapper/centos-root