[virt-tools-list] fstrim makes LVM unbootable

Richard Taubo ort at bergersen.no
Fri Jan 9 00:11:59 UTC 2015


Hi!

I am running CentOS 7 on a machine with SSD, and trying to run the fstrim command.

KVM is installed on a logical volume like this:
[#] lvcreate -L 300G -n lv_vm1 VolGroup
[#] mkfs.xfs /dev/VolGroup/lv_vm1
[#] mkdir /mnt/b_vm_1
[#] mount /dev/VolGroup/lv_vm1 /mnt/b_vm_1
[#] virt-install --name=vm1.mydomain.com \ 
	--disk path=/dev/VolGroup/lv_vm1 \ 
	--ram=8192 --os-type=linux --os-variant=rhel7 \ 
	--vcpus=8 --check-cpu \ 
	--network bridge:br0 --nographics \
	--location=/usr/local/src/linux_isos/CENTOS7/CentOS-7.0-1406-x86_64-Minimal.iso \ 
	--extra-args 'ks=http://www.mydomain.com/anaconda-ks.cfg ksdevice=eth0 \ 
	ip=192.168.19.2 netmask=255.255.255.192 dns=8.8.8.8 gateway=192.168.19.1 console=ttyS0,115200n8 serial’

The file system disk space usage (the relevant parts) looks like this:
[#]  df -h
….
/dev/mapper/VolGroup-lv_usr   9,8G  1,6G  8,2G  16% /usr
/dev/mapper/VolGroup-lv_vm1   300G   33M  300G   1% /mnt/b_vm_1
...

After: 
	- Installing the virtual machine
	- Trying that it works
	- Turning it off
	- Unmounting the logical volume

I run the following command at the host machine:
[#] fstrim -v /usr

The command works fine, and I am able to display the content of the /user folder.

BUT when I start up the virtual machine from the host again:
[#] virsh start vm1.bergersen1.com
and access the console (that worked before I ran the fstrim command) via:
[#] virsh console vm1.bergersen1.com

. . .  the console just stalls, and the virtual machine is not working. 

Is there a way I can run fstrim on the host machine without destroying the virtual machine?

Thanks for input!

Best regards,
Richard Taubo






More information about the virt-tools-list mailing list