Linux Btrfs filesystem development
 help / color / mirror / Atom feed
* Cross subvolume "cp --reflink"?
@ 2016-10-19 16:52 Andrei Borzenkov
  2016-10-19 17:04 ` Hugo Mills
  2016-10-19 21:04 ` Noah Massey
  0 siblings, 2 replies; 4+ messages in thread
From: Andrei Borzenkov @ 2016-10-19 16:52 UTC (permalink / raw)
  To: linux-btrfs@vger.kernel.org

I get "Failed to clone: Invalid cross-device link". Is it expected?
Basically this is (on openSUSE TW which has root on subvolume)

mount -o subvol=/ /dev/vda1 /mnt
btrfs sub create /mnt/var/cache
cp -a --reflink=always /var/cache/* /mnt/var/cache

Kernel 4.7.5-1-default.


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

* Re: Cross subvolume "cp --reflink"?
  2016-10-19 16:52 Cross subvolume "cp --reflink"? Andrei Borzenkov
@ 2016-10-19 17:04 ` Hugo Mills
  2016-10-19 17:11   ` Andrei Borzenkov
  2016-10-19 21:04 ` Noah Massey
  1 sibling, 1 reply; 4+ messages in thread
From: Hugo Mills @ 2016-10-19 17:04 UTC (permalink / raw)
  To: Andrei Borzenkov; +Cc: linux-btrfs@vger.kernel.org

[-- Attachment #1: Type: text/plain, Size: 991 bytes --]

On Wed, Oct 19, 2016 at 07:52:14PM +0300, Andrei Borzenkov wrote:
> I get "Failed to clone: Invalid cross-device link". Is it expected?
> Basically this is (on openSUSE TW which has root on subvolume)
> 
> mount -o subvol=/ /dev/vda1 /mnt
> btrfs sub create /mnt/var/cache
> cp -a --reflink=always /var/cache/* /mnt/var/cache
> 
> Kernel 4.7.5-1-default.

   Yes, you're trying to copy across a mountpoint boundary. This isn't
going to work. You'll need to mount subvolid=0 on /mnt, and then use
the source and target of the cp *both* from within the /mnt subtree.

   Reflink operations (including cp --reflink=always, and the
reflink-aware mv) work across subvol boundaries, but not mount
boundaries.

   Hugo.

-- 
Hugo Mills             | For months now, we have been making triumphant
hugo@... carfax.org.uk | retreats before a demoralised enemy who is advancing
http://carfax.org.uk/  | in utter disorder.
PGP: E2AB1DE4          |                              Eric Frank Russell, Wasp

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: Cross subvolume "cp --reflink"?
  2016-10-19 17:04 ` Hugo Mills
@ 2016-10-19 17:11   ` Andrei Borzenkov
  0 siblings, 0 replies; 4+ messages in thread
From: Andrei Borzenkov @ 2016-10-19 17:11 UTC (permalink / raw)
  To: Hugo Mills, linux-btrfs@vger.kernel.org

[-- Attachment #1: Type: text/plain, Size: 848 bytes --]

19.10.2016 20:04, Hugo Mills пишет:
> On Wed, Oct 19, 2016 at 07:52:14PM +0300, Andrei Borzenkov wrote:
>> I get "Failed to clone: Invalid cross-device link". Is it expected?
>> Basically this is (on openSUSE TW which has root on subvolume)
>>
>> mount -o subvol=/ /dev/vda1 /mnt
>> btrfs sub create /mnt/var/cache
>> cp -a --reflink=always /var/cache/* /mnt/var/cache
>>
>> Kernel 4.7.5-1-default.
> 
>    Yes, you're trying to copy across a mountpoint boundary. This isn't
> going to work. You'll need to mount subvolid=0 on /mnt, and then use
> the source and target of the cp *both* from within the /mnt subtree.
> 
>    Reflink operations (including cp --reflink=always, and the
> reflink-aware mv) work across subvol boundaries, but not mount
> boundaries.
> 
>    Hugo.
> 
Yes, figured that much too. Thank you!


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

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

* Re: Cross subvolume "cp --reflink"?
  2016-10-19 16:52 Cross subvolume "cp --reflink"? Andrei Borzenkov
  2016-10-19 17:04 ` Hugo Mills
@ 2016-10-19 21:04 ` Noah Massey
  1 sibling, 0 replies; 4+ messages in thread
From: Noah Massey @ 2016-10-19 21:04 UTC (permalink / raw)
  To: Andrei Borzenkov; +Cc: linux-btrfs@vger.kernel.org

On Wed, Oct 19, 2016 at 12:52 PM, Andrei Borzenkov <arvidjaar@gmail.com> wrote:
> I get "Failed to clone: Invalid cross-device link". Is it expected?

Yes, you cannot cross a MOUNTPOINT boundary with reflink.
Or, for that matter, btrfs subvolume snapshot.

> Basically this is (on openSUSE TW which has root on subvolume)
>
> mount -o subvol=/ /dev/vda1 /mnt
> btrfs sub create /mnt/var/cache
> cp -a --reflink=always /var/cache/* /mnt/var/cache
>

You *can* however cross subvolume boundaries within the same mountpoint.
Try (assuming your root subvolume is @root)

cp -a --reflink /mnt/@root/var/cache/* /mnt/var/cache

~ Noah

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

end of thread, other threads:[~2016-10-19 21:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-19 16:52 Cross subvolume "cp --reflink"? Andrei Borzenkov
2016-10-19 17:04 ` Hugo Mills
2016-10-19 17:11   ` Andrei Borzenkov
2016-10-19 21:04 ` Noah Massey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox