[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] Trying to get fstrim / discard=unmap to work
From: |
Richard W.M. Jones |
Subject: |
Re: [Qemu-devel] Trying to get fstrim / discard=unmap to work |
Date: |
Tue, 11 Mar 2014 20:00:50 +0000 |
User-agent: |
Mutt/1.5.20 (2009-12-10) |
Finally I tracked down the reason why my early test failed, but then
it just started working "by magic".
The reason is this:
If you:
- create an ext4 filesystem
- mount it WITHOUT -o discard
- create and remove some big files
- unmount
- mount -o discard
- fstrim
then the fstrim has no effect.
If you:
- create an ext4 filesystem
- mount it WITH -o discard
- create and remove some big files
- unmount
- mount -o discard
- fstrim
then the fstrim works. (Actually it's not necessary, because the
previous 'rm' already recovered the space.)
I have no idea why this is yet (still investigating). However the
fstrim is suspiciously fast, so there's no way it can be scanning the
whole disk for deleted files. I don't think fstrim does what it says
in the man page.
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-top is 'top' for virtual machines. Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://people.redhat.com/~rjones/virt-top