4

I have divided my drive into two btrfs paritions: one is mounted as / (dev/sda1), second one as /home (/dev/sda2).

I made my initial snapshot of /home:

mkdir -p /home/snapshots/mnt
mount -o subvolid=0 /dev/sda2 /home/snapshots/mnt
btrfs subvolume snapshot /home /home/snapshots/mnt/snapshots/init

After that I made my init snapshot default and rebooted the system. Because I wanted the init snapshot to stay clean I decided to make a snapshot of it and call it current:

mount -o subvolid=0 /dev/sda2 /home/snapshots/mnt
btrfs subvolume snapshot /home /home/snapshots/mnt/snapshots/current

It worked, but after making current default subvolume and rebooting the system I noticed that ls on /home/snapshots give me unexpected results:

# ls /home/snapshots 
init mnt
# ls /home/snapshots/init
#

The question is: why is the init folder visible? My intuition is that the init snapshot is created on subvolume with id 0 and should be visible only from there.

houen
  • 181

1 Answers1

3

When snapshot of a given subvolume is made, all subvolumes contained in it (in the sense of being attached in the file tree) are treated like empty directories. Hence the behaviour. You can just remove them from the snapshot, no data loss here :)