linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Making discard/fstrim reliable
@ 2014-03-26 20:47 Richard W.M. Jones
  2014-04-02 18:18 ` Jeff Moyer
  2014-04-03 17:08 ` Lukáš Czerner
  0 siblings, 2 replies; 10+ messages in thread
From: Richard W.M. Jones @ 2014-03-26 20:47 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: pbonzini


virt-sparsify is a tool for trimming free space in virtual disk
images.  The new implementation uses vfs/kernel/qemu discard support.
Essentially it does:

  for each filesystem:
    mount -o discard $fs /mnt
    sync
    fstrim /mnt
    umount /mnt
  sync
  # qemu is killed after sync returns

Although typing these commands by hand works fine, when you run them
from a program the fstrim doesn't happen all the way down the stack
reliably.  Mostly it works, but sometimes it only trims some space
from the host file.

It appears that when the host is slow / under load, the problem
happens more frequently.  Also it may happen more frequently on i686
than on x86-64 (possibly also due to speed of host).

The question is: What can I do to make sure the trim happens reliably,
all the way down the stack, before qemu is killed?

I am testing this using the latest upstream kernel & qemu.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine.  Supports Linux and Windows.
http://people.redhat.com/~rjones/virt-df/

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2014-04-10 15:05 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-26 20:47 Making discard/fstrim reliable Richard W.M. Jones
2014-04-02 18:18 ` Jeff Moyer
2014-04-02 18:59   ` Richard W.M. Jones
2014-04-02 20:02     ` Jeff Moyer
2014-04-02 20:26       ` Richard W.M. Jones
2014-04-10 15:05       ` Richard W.M. Jones
2014-04-03 17:08 ` Lukáš Czerner
2014-04-03 17:23   ` Richard W.M. Jones
2014-04-03 17:57   ` Paolo Bonzini
2014-04-03 18:08     ` Richard W.M. Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).