Skip to contentSkip to conversation

btrfs snapshot root level and for subvolumes

DISCUSSION sri 2 participants 2 messages Apr 22, 2015 Btrfs file system

lore
Share & tools
lore

sri

author
#0 lore raw

Hi,
I btrfs file system created with one device /dev/sdb and mounted under /btrfs1.

created one file /btrfs1/errno.h, one directory /btrfs1/dir1 and 2 subvolumes /btrfs1/subvol1 and /btrfs/subvol2

create directories and files under subvolume /btrfs1/subvol1. Nothing inside /btrfs1/subvol2.

Below is tree representation of the file system.

#cd /btrfs1
#tree /btrfs1
- errno.h
-dir1
- file1
- file2
-subvol1

     -dir1
       -file1
     -file2

-subvol2

at root level of /btrfs1, i have one file errno.h, dir1, and 2 subvolumes subvol1, subvol2.

When I create snapshot for subvol1 (say snap_subvol1), I can able to see all files and directories of subvol1 are showed in /btrfs1/snap_subvol1

But when I create snapshot at btrfs1 level by using below command "btrfs subvolume snapshot /btrfs1 /btrfs1/root_snap"

and see contents of /btrfs1/root_snap, I can able to see all root level files and directories but cannot find any files and directories inside subvol1.

My question is can't we take btrfs root level snapshot and get snapshot of everything under root file system ??
Is btrfs subvolume snapshot is only to take subvolume snapshot?

If it so, is there a way to take snapshot at root level? (in this case /btrfs1)

I am just confused how subvolume snapshot work in this case.

#1 lore raw
Quoted 39 lines · sri

Hi,
I btrfs file system created with one device /dev/sdb and mounted under /btrfs1.

created one file /btrfs1/errno.h, one directory /btrfs1/dir1 and 2 subvolumes /btrfs1/subvol1 and /btrfs/subvol2

create directories and files under subvolume /btrfs1/subvol1. Nothing inside /btrfs1/subvol2.

Below is tree representation of the file system.

#cd /btrfs1
#tree /btrfs1
- errno.h
-dir1
- file1
- file2
-subvol1

      -dir1
        -file1
      -file2

-subvol2

at root level of /btrfs1, i have one file errno.h, dir1, and 2 subvolumes subvol1, subvol2.

When I create snapshot for subvol1 (say snap_subvol1), I can able to see all files and directories of subvol1 are showed in /btrfs1/snap_subvol1

But when I create snapshot at btrfs1 level by using below command "btrfs subvolume snapshot /btrfs1 /btrfs1/root_snap"

and see contents of /btrfs1/root_snap, I can able to see all root level files and directories but cannot find any files and directories inside subvol1.

Quoted 8 lines

My question is can't we take btrfs root level snapshot and get snapshot of everything under root file system ??
Is btrfs subvolume snapshot is only to take subvolume snapshot?

If it so, is there a way to take snapshot at root level? (in this case /btrfs1)

I am just confused how subvolume snapshot work in this case.

Because of how subvolumes work on btrfs, snapshots currently stop at subvolume boundaries. This is an intended behavior to people from shooting themselves in the foot with recursive snapshots stored in the subvolume that is being snapshotted. As far as I know, there is currently no way to do recursive snapshotting of subvolumes without using some form of scripting.