btrfs snapshot send howto?

Chris Murphy lists at colorremedies.com
Thu Jan 16 18:36:14 UTC 2014


On Jan 16, 2014, at 8:26 AM, Neal Becker <ndbecker2 at gmail.com> wrote:

> Juan Orti Alcaine wrote:
> 
>> 2014/1/16 Neal Becker <ndbecker2 at gmail.com>:
>>> Trying to follow the example in this article:
>>> 
>>> http://arstechnica.com/information-technology/2014/01/bitrot-and-atomic-cows-inside-next-gen-filesystems/3/
>>> 
>>> [root at nbecker1 nbecker]# btrfs subvolume list /
>>> ID 256 gen 563294 top level 5 path home
>>> ID 258 gen 563294 top level 5 path root
>>> ID 370 gen 563278 top level 5 path home/.snapshots
>>> ID 371 gen 563279 top level 5 path home/.snapshots/01162014
>>> 
>>> [root at nbecker1 nbecker]# btrfs send /home/.snapshots/01162014 > /dev/null
>>> At subvol /home/.snapshots/01162014
>>> ERROR: open home/.snapshots/01162014 failed. No such file or directory
>>> 
>>> OK, I have no clue why this doesn't work.
>>> 
>> 
>> 
>> I'm not sure about the snapshots-inside-a-subvolume thing. I have the
>> root (subvolid=0) mounted in /mnt/btrfs and take there the snapshots,
>> so they are not nested:
>> 
>> # btrfs sub list /mnt/btrfs
>> ID 284 gen 15086 top level 5 path root
>> ID 1032 gen 12751 top level 5 path root at 2014-01-14_23:45:01
>> ID 1033 gen 12777 top level 5 path root at 2014-01-15_07:45:01
>> ID 1034 gen 12794 top level 5 path root at 2014-01-15_08:00:01
>> ID 1035 gen 12811 top level 5 path root at 2014-01-15_08:15:01
>> ID 1036 gen 12829 top level 5 path root at 2014-01-15_08:30:01
>> ID 1037 gen 12844 top level 5 path root at 2014-01-15_08:45:01
>> ID 1038 gen 12863 top level 5 path root at 2014-01-15_09:00:01
>> ID 1039 gen 12880 top level 5 path root at 2014-01-15_09:15:01
>> 
>> Also, to send a subvolume, it must be read-only:
>> 
>> # btrfs sub snapshot -r / /mnt/btrfs/my-ro-root
>> # btrfs send /mnt/btrfs/my-ro-root
>> 
>> You can later make a read-write snapshot of a read-only one to work with it.
>> 
> 
> OK, I used a path /.snapshots:
> 
> btrfs subvolume list /
> ID 256 gen 563396 top level 5 path home
> ID 258 gen 563396 top level 5 path root
> ID 372 gen 563396 top level 258 path .snapshots
> [root at nbecker1 nbecker]# btrfs sub snapshot -r /home /.snapshots
> Create a readonly snapshot of '/home' in '/.snapshots/home'

This caused the snapshot of home to be created as <FS_TREE>/root/.snapshots/home

You can see that .snapshots is under top level 258, which is the root subvolume.



> [root at nbecker1 nbecker]# btrfs subvolume list /
> ID 256 gen 563398 top level 5 path home
> ID 258 gen 563398 top level 5 path root
> ID 372 gen 563398 top level 258 path .snapshots
> ID 373 gen 563398 top level 258 path .snapshots/home
> [root at nbecker1 nbecker]# btrfs send /.snapshots/home > /dev/null
> At subvol /.snapshots/home
> ERROR: open root/.snapshots/home failed. No such file or directory

Interesting. It resolves the correct path <FS_TREE>/root/.snapshots/home that was presumably used above.

What do you get for

btrfs sub list / -ta
btrfs sub list / -tar


Chris Murphy



More information about the users mailing list