I'm trying to automate creation and mounting of btrfs subvolumes. It's easy for me to create them and create the fstab entry, but harder to parse the subvolume id.
I've noticed that other subvolumes have predictable names prefixed with '@' and they are mounted this way in /etc/fstab
UUID=280d6f04-6ad0-4647-96b9-580aec12bbdc /var/log btrfs noatime,subvol=@/var/log 0 0
Indeed, mounting by such a label works
$ mount -o subvol=@/var/log photoshop-32
Mounting a subvolume with a 'regular' name fails
$ mount -o subvol=var/users/robert/wines/photoshop-32 /var/users/robert/wines/photoshop-32/
mount: mount(2) failed: /var/users/robert/wines/photoshop-32: No such file or directory
I've therefore tried to create a subvolume with such a name but failed
# btrfs subvolume create /var/users/robert/wines/blah/@/var/users/robert/wines/blah
ERROR: cannot access '/var/users/robert/wines/blah/@/var/users/robert/wines': No such file or directory
# btrfs subvolume create /@/var/users/robert/wines/blah
ERROR: cannot access '/@/var/users/robert/wines': No such file or directory
# btrfs subvolume create //@/var/users/robert/wines/blah
# ERROR: cannot access '//@/var/users/robert/wines': No such file or directory
How can I create subvolumes with a '@' in their name? Alternatively, how can I mount subvolumes without the need to find the subvolume id?