Bug 1054903 - The subvolume behaviour of the default BTRFS scheme prevents reflink (COW) copies of files between subvolumes
Summary: The subvolume behaviour of the default BTRFS scheme prevents reflink (COW) co...
Alias: None
Product: Fedora
Classification: Fedora
Component: python-blivet
Version: 20
Hardware: Unspecified
OS: Unspecified
Target Milestone: ---
Assignee: David Lehman
QA Contact: Fedora Extras Quality Assurance
Depends On:
TreeView+ depends on / blocked
Reported: 2014-01-17 17:51 UTC by James Hogarth
Modified: 2015-03-09 11:58 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2015-01-20 14:54:49 UTC
Type: Bug

Attachments (Terms of Use)

Description James Hogarth 2014-01-17 17:51:45 UTC
Description of problem:
The kernel in Fedora 20 supports cross-subvolume COW so that cp --reflinks=always will use the same extents to avoid using extra disk space and save time on copies. 

If a BTRFS filesystem has subvolumes created within /home or within / via btrfs sub create then COW will work within these.

If multiple mounts are used targeting specific subvolumes (via the subvol= option) then cp is unable to carry out COW between these and has to do a full duplication of extents taking up space and time.

Anaconda should not create multiple mount points but rather provide a /home subvolume within the root subvolume so that it's possible cp --reflink=always from /home to other locations (think downloaded isos in ~/Downloads to /var/lib/libvirt/images for VMs).

Version-Release number of selected component (if applicable):
Fedora 20 install from the current installer tree

How reproducible:

Steps to Reproduce:
1. Do an install of Fedora 20 picking the default BTRFS layout
2. Try to copy a file via cp --reflink=always form somewhere in ${HOME} to anywhere in the root filesystem.... watch it fail.
3. Use btrfs sub create testsubvol within the home or root subvolumes and cp --reflink=always within root (or home) subvolume that it exists in and watch COW work.

Actual results:
cp: failed to clone ‘/tmptest/filename.tar.gz’ from ‘filename.tar.gz’: Invalid cross-device link

Expected results:
A reflink copy to work between the subvolumes 

Additional info:
This kernel commit was found when asking on the mailing lists about the behaviour:


As such it is working as (currently) designed from the kernel point of view which is why as an anaconda filesystem layout it would be nicer having /home (and any other subvolumes) not directly being mounted in fstab with the subvol= option but rather just being there naturally...

Comment 1 David Lehman 2014-12-02 19:38:14 UTC
Your suggested approach precludes removing an old root subvolume while preserving the home subvol, no?

Comment 2 David Lehman 2015-01-20 14:54:49 UTC
In short, this is an expected consequence of the layout we chose. The main feature of this layout is the ability to remove/replace subvolumes that occcupy certain mountpoint (eg: /) while preserving other subvolumes (eg: /home). If your personal preference is the ability to do reflink copies between subvolumes you are free to create a layout to accommodate this.

Comment 3 James Hogarth 2015-03-09 11:58:46 UTC
Clearing needs info flag

Agreed layout is needed to preserve /home and if desired user can change afterwards.

Note You need to log in before you can comment on or make changes to this bug.