After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 763189 - RFE: create qcow2 with 'nocow' option when on Btrfs /home
RFE: create qcow2 with 'nocow' option when on Btrfs /home
Status: RESOLVED OBSOLETE
Product: gnome-boxes
Classification: Applications
Component: installer
3.18.x
Other Linux
: Normal normal
: --
Assigned To: GNOME Boxes maintainer(s)
GNOME Boxes maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2016-03-06 22:50 UTC by Chris Murphy
Modified: 2018-01-11 10:41 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Chris Murphy 2016-03-06 22:50:12 UTC
Problem: VM images on Btrfs become heavily fragmented, thousands of fragments. In particular, Windows NTFS as a guest on Btrfs is significantly fragmented, tens of thousands of fragments in short order, hundreds of thousands have been reported. This slows things down just as significantly.

Solution: qemu-img supports -o nocow=on which causes xattr 'C' to be set on the file at create time, which makes the file both nodatacow and nodatasum (no Btrfs checksumming). The other option is chattr +C on ~/.local/share/gnome-boxes/ which will cause any images created or copied into that directory to inherit this attribute.

Reference:
https://www.redhat.com/archives/libvir-list/2014-July/msg00361.html
https://btrfs.wiki.kernel.org/index.php/Gotchas#Fragmentation


Examples:

Install Fedora 24 using default installer options (ext4 on LVM), Boxes host /home is on Btrfs. Note this test are all new writes, almost no overwrites; random overwrites make this much worse.

Without +C
-rwxr--r--. 1 chris chris 4679598080 Mar  6 14:59 boxes-unknown
[chris@f23m images]$ filefrag boxes-unknown 
boxes-unknown: 4453 extents found

With +C
-rwxr--r--. 1 chris chris 4638703616 Mar  6 15:45 boxes-unknown
[chris@f23m images]$ filefrag boxes-unknown 
boxes-unknown: 109 extents found


Argument against the enhancement:
- xattr C means no Btrfs checksumming for the file either
- Kernel code could change and improve this for both VMs and databases; kernel developers are working on this, but for now the recommendation is xattr C.
- Even on openSUSE using Btrfs by default, /home is on XFS by default which isn't affected since it's not a COW fs. So the problem is narrow in scope and the recommendation could just be "set +C on images/ if you want to use Btrfs".

So if there is a very lightweight change to make this better on Btrfs that's also easy to reverse if Btrfs improves, great.
Comment 1 Chris Murphy 2016-09-19 20:58:48 UTC
Even better
-o nocow=on,preallocation=falloc
Comment 2 GNOME Infrastructure Team 2018-01-11 10:41:12 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gnome-boxes/issues/88.