public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
* Is there a lightweight copy from one subvolume to another?
@ 2014-01-25  7:04 Marc MERLIN
       [not found] ` <CA+TwyweCeUQ7w5MuRLrfHfmJwDbChX5VodsyW8huQ9YuLOAWQA@mail.gmail.com>
  0 siblings, 1 reply; 4+ messages in thread
From: Marc MERLIN @ 2014-01-25  7:04 UTC (permalink / raw)
  To: linux-btrfs

If I have 
/mnt/btrfs1/subvol1
/mnt/btrfs1/subvol2

Can I copy/move data from subvol1 to subvol2 without having to physically
copy all the blocks as if it were an entirely different filesystem?

reflink doesn't work for this:
gargamel [mc]# cp -av --reflink=always misc/olympic Video/misc/
`misc/olympic' -> `Video/misc/olympic'
`misc/olympic/file.avi' -> `Video/misc/olympic/file.avi'
cp: failed to clone `Video/misc/olympic/file.avi' from `misc/olympic/file.avi': Invalid cross-device link

Was there another way?

Thanks,
Marc
-- 
"A mouse is a device used to point at the xterm you want to type in" - A.S.R.
Microsoft is to operating systems ....
                                      .... what McDonalds is to gourmet cooking
Home page: http://marc.merlins.org/  

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

* Fwd: Is there a lightweight copy from one subvolume to another?
       [not found] ` <CA+TwyweCeUQ7w5MuRLrfHfmJwDbChX5VodsyW8huQ9YuLOAWQA@mail.gmail.com>
@ 2014-01-25  8:50   ` Maxdamantus
  2014-01-25  9:17     ` Marc MERLIN
  0 siblings, 1 reply; 4+ messages in thread
From: Maxdamantus @ 2014-01-25  8:50 UTC (permalink / raw)
  To: linux-btrfs

---------- Forwarded message ----------
From: Maxdamantus <maxdamantus@gmail.com>
Date: 25 January 2014 21:49
Subject: Re: Is there a lightweight copy from one subvolume to another?
To: Marc MERLIN <marc@merlins.org>


Due to what I understand is some VFS limitation, you can only
reflink-copy between subvolumes under one Linux mountpoint. If
/mnt/btrfs1 provides access to all subvolumes, you should be able to
copy between them through that path, but you won't be able to copy
them across mounts, even `--bind` ones.

On 25 January 2014 20:04, Marc MERLIN <marc@merlins.org> wrote:
> If I have
> /mnt/btrfs1/subvol1
> /mnt/btrfs1/subvol2
>
> Can I copy/move data from subvol1 to subvol2 without having to physically
> copy all the blocks as if it were an entirely different filesystem?
>
> reflink doesn't work for this:
> gargamel [mc]# cp -av --reflink=always misc/olympic Video/misc/
> `misc/olympic' -> `Video/misc/olympic'
> `misc/olympic/file.avi' -> `Video/misc/olympic/file.avi'
> cp: failed to clone `Video/misc/olympic/file.avi' from `misc/olympic/file.avi': Invalid cross-device link
>
> Was there another way?
>
> Thanks,
> Marc
> --
> "A mouse is a device used to point at the xterm you want to type in" - A.S.R.
> Microsoft is to operating systems ....
>                                       .... what McDonalds is to gourmet cooking
> Home page: http://marc.merlins.org/
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: Fwd: Is there a lightweight copy from one subvolume to another?
  2014-01-25  8:50   ` Fwd: " Maxdamantus
@ 2014-01-25  9:17     ` Marc MERLIN
  2014-01-25 16:49       ` Ken Drummond
  0 siblings, 1 reply; 4+ messages in thread
From: Marc MERLIN @ 2014-01-25  9:17 UTC (permalink / raw)
  To: Maxdamantus; +Cc: linux-btrfs

On Sat, Jan 25, 2014 at 09:50:48PM +1300, Maxdamantus wrote:
> Due to what I understand is some VFS limitation, you can only
> reflink-copy between subvolumes under one Linux mountpoint. If
> /mnt/btrfs1 provides access to all subvolumes, you should be able to
> copy between them through that path, but you won't be able to copy
> them across mounts, even `--bind` ones.

That was exactly my understanding too.
 
> > gargamel [mc]# cp -av --reflink=always misc/olympic Video/misc/
> > `misc/olympic' -> `Video/misc/olympic'
> > `misc/olympic/file.avi' -> `Video/misc/olympic/file.avi'
> > cp: failed to clone `Video/misc/olympic/file.avi' from `misc/olympic/file.avi': Invalid cross-device link

The test above was done in /mnt/btrfs_pool1 and failed as shown here.

Yet
gargamel:/mnt/btrfs_pool1# btrfs subvolume list .
ID 257 top level 5 path misc
ID 258 top level 5 path Video
ID 259 top level 5 path media
ID 260 top level 5 path Sound
ID 261 top level 5 path zoneminder
ID 262 top level 5 path other

Aah, but it looks like this was my problem:
'Preparing to replace coreutils 8.13-3.2 (using .../coreutils_8.21-1_i386.deb) ...

now cp --reflink works as expected.

Thanks,
Marc
-- 
"A mouse is a device used to point at the xterm you want to type in" - A.S.R.
Microsoft is to operating systems ....
                                      .... what McDonalds is to gourmet cooking
Home page: http://marc.merlins.org/  

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

* Re: Fwd: Is there a lightweight copy from one subvolume to another?
  2014-01-25  9:17     ` Marc MERLIN
@ 2014-01-25 16:49       ` Ken Drummond
  0 siblings, 0 replies; 4+ messages in thread
From: Ken Drummond @ 2014-01-25 16:49 UTC (permalink / raw)
  To: Marc MERLIN, Maxdamantus; +Cc: linux-btrfs

On 25/01/2014 7:17 PM, Marc MERLIN wrote:
> On Sat, Jan 25, 2014 at 09:50:48PM +1300, Maxdamantus wrote:
>> Due to what I understand is some VFS limitation, you can only
>> reflink-copy between subvolumes under one Linux mountpoint. If
>> /mnt/btrfs1 provides access to all subvolumes, you should be able to
>> copy between them through that path, but you won't be able to copy
>> them across mounts, even `--bind` ones.
>
> That was exactly my understanding too.
>
>>> gargamel [mc]# cp -av --reflink=always misc/olympic Video/misc/
>>> `misc/olympic' -> `Video/misc/olympic'
>>> `misc/olympic/file.avi' -> `Video/misc/olympic/file.avi'
>>> cp: failed to clone `Video/misc/olympic/file.avi' from `misc/olympic/file.avi': Invalid cross-device link
>
> The test above was done in /mnt/btrfs_pool1 and failed as shown here.
>
> Yet
> gargamel:/mnt/btrfs_pool1# btrfs subvolume list .
> ID 257 top level 5 path misc
> ID 258 top level 5 path Video
> ID 259 top level 5 path media
> ID 260 top level 5 path Sound
> ID 261 top level 5 path zoneminder
> ID 262 top level 5 path other
>
> Aah, but it looks like this was my problem:
> 'Preparing to replace coreutils 8.13-3.2 (using .../coreutils_8.21-1_i386.deb) ...
>
> now cp --reflink works as expected.
>
> Thanks,
> Marc
>


If I recall correctly you also need a kernel >= 3.7.  Which I assume you 
have if this is now working.

Ken.

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

end of thread, other threads:[~2014-01-25 16:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-25  7:04 Is there a lightweight copy from one subvolume to another? Marc MERLIN
     [not found] ` <CA+TwyweCeUQ7w5MuRLrfHfmJwDbChX5VodsyW8huQ9YuLOAWQA@mail.gmail.com>
2014-01-25  8:50   ` Fwd: " Maxdamantus
2014-01-25  9:17     ` Marc MERLIN
2014-01-25 16:49       ` Ken Drummond

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