[virt-tools-list] Enabling fstrim within VM client
Richard Taubo
ort at bergersen.no
Fri Jan 16 23:11:28 UTC 2015
On 16 Jan 2015, at 17:49, Cole Robinson <crobinso at redhat.com> wrote:
>
> 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.
Thanks for the link!
In the comment section there are some comments on using fstrim vs mounting the filesystem with “discard” on the guest.
I assume that either fstrim or “discard” on the guest will REQUIRE virt-install with --disk discard on the host, correct?
Thanks!
Richard Taubo
More information about the virt-tools-list
mailing list