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

Reply via email to