4

Fairly short question. Is there any technical reason for having an @ in the name of a subvolume of a Btrfs? What's its function, benefit or cause of problems?

What is the best practice?

Examples:

3

It's just a convention. The kernel btrfs wiki's section on subvolumes doesn't mention @ at all. This discussion on the debian-boot mailing list is informative:

The convention proposed in the upstream btrfs sysadmin guide is identical to the way Fedora names its subvolumes, and I believe it was written by a Fedora developer. I think the primary rational to diverge from it is to signify that what seem to be directories are not actually directories, but subvolumes. As I mentioned before the flexibility this FS supports is astounding, and I fear could be a nightmare to support without near self-evident default conventions. I guess I'll just pick something, and it someone doesn't like it then it can be changed? I was hoping any strong opinions would come out in this discussion! :-)

This is a convention that OpenSUSE and Debian apparently picked up from Ubuntu, and the idea of using all those subvolumes is attributed by Colin Watson to Roger Leigh. That was in 2010, and in 2011, we already have subvolumes named with @, but I can't find online discussions about this during that period. I suppose only Colin can answer this now.

0

The @ is the 'true' root volume. It has a volume ID of 0, not listed when you do btrfs subvolume list /. You use this volume to create/delete subvolumes.

mount -o subvolid=0 UUID=insert-the-uuid-here /mnt

You must mount this hidden root somewhere else to access the subvolumes. You can get the UUID in /etc/fstab, it is the one repeated for all the root subvols.

# ls /mnt
  @

The /mnt listing shows an @ directory, under this is the normal /etc, /var, etc

btrfs subvolume delete /mnt/@/whatever

or

btrfs subvolume create /mnt/@/whatever

If creating a subvolume, add:

UUID=insert-the-uuid-here /whatever btrfs subvol=@/home 0 0 

to /etc/fstab.

Now, mkdir /whatever, then you can mount it: mount /whatever.

If deleting a subvolume, be sure to remove it in fstab and delete the mount point.

  • 1
    The question was why the root subvol is called @. – Pilot6 Sep 17 '19 at 7:55
  • @Pilot6 I think this is quite the answer. You need to define a root and you cannot use /. So you need another character that indicates "this is the root", is short and follows the unix convention of starting at something like / instead of something like c:\ (what could be for example @root). So someone thought of a new convention and nobody objected. – allo Sep 17 '19 at 8:33
0

For no particular reason, and it is rather offputting. But we have to stick with it to use timeshift. see also: https://linuxreviews.org/Btrfs

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.