[virt-tools-list] Enabling fstrim within VM client

Cole Robinson crobinso at redhat.com
Fri Jan 16 16:49:18 UTC 2015


On 01/15/2015 04:29 PM, Richard Taubo wrote:
> Hi!
> 
> As mentioned in an earlier mail I have installed 
> KVM on a logical volume like this (CentOS 7):
> [#] lvcreate -L 300G -n lv_vm1 VolGroup
> [#] 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’
> 
> I would like to run fstrim from within the VM client (I have fstrim working on the VM host machine).
> Running fstrim from within the VM gives me errors like this:
> 	"fstrim: /usr: FITRIM ioctl failed: Operation not supported"
> 
> Is it possible to run fstrim on the VM client with the setup described above?
> 
> Thanks for any feedback!

There's some details here:

http://dustymabe.com/2013/06/11/recover-space-from-vm-disk-images-by-using-discardfstrim/

I think it boils down to using a scsi disk, and using discard=unmap. The blog
post doesn't say it but modern virt-install supports the --disk discard
option, so you don't need to edit the XML separately.

- Cole




More information about the virt-tools-list mailing list