8

I have noticed that Synology NAS devices preface many system-relevant links or directory names with the @ character. I've just noticed that the standard partitioning in openSUSE does the same when naming btrfs volumes, creating one subvolume named simply @, and below that @/opt, @/tmp and so on (mounted to /opt and /tmp, respectively).

This and the fact that I never encountered @ in pathnames until recently (and didn't even know that @ was available) suggests that it carries some meaning I'm not aware of. Or is this just a relatively recent convention which slipped by the casual user which is me? If yes, what is the meaning/significance?

The btrfs wiki does not seem to mention anything.

Jeff Schaller
  • 66,199
  • 35
  • 114
  • 250
Zak
  • 357
  • 2
  • 14
  • No, that should be some Synology/whatever thing. There are only two characters which carry meaning in unix paths: 1. `/`, which is the directory separator and 2. the NUL (`\0`) byte, which terminates it. I had a cursory at btrfs sources, and no, they don't attach any meaning to `@` (as expected). –  Dec 30 '18 at 17:55
  • @Uncle Billy: Thanks -- but the second example is from openSUSE, whom I don't assume to copy their stuff from Synology. If `` @`` does not have syntactical meaning, there must be some sort of naming convention which is used by at least two communities relevant in the field – Zak Dec 31 '18 at 18:15
  • At least according to how I intended the question, there are more meaningful characters: ``.`` as the first character hides a file and signifies the start of the file extension, ``~`` is the current user's home directory, and is often prepended to lock files" (not sure if by convention, or if it's interpreted by the file system), ``..`` is the next-higher directory level ... and there's more – Zak Dec 31 '18 at 18:19
  • Incidentally, there are NO forbidden characters in filenames, except for a slash (which is the path separator) and the null byte if you want to call that a character. ALL other characters are allowed. Beware of code which assumes otherwise. – Wildcard Jun 21 '19 at 23:02
  • 1
    As mentioned before -- ``@`` may not be interpreted by the file system, but it seems reasonable to assume that there is some sort of convention about when to use it, at least in the context of btrfs subvolumes. – Zak Jun 27 '19 at 09:50

1 Answers1

3

To be able to perform a Btrfs system snapshot to an inaccessible location outside of the directory structure, the root directory had to be moved from the bare file system to a subvolume. I think it was openSUSE who was the first distro to implement this by default, and they called the root subvolume "@". All other system subvolumes then also got an @ in front of their name, for consistency. Replacing @ with another special character wouldn't have any functional difference.

damian101
  • 96
  • 5
  • Thanks! So if I get this right, then it's a convention borne out of the wish to give subvolumes labels which can be recognized as subvolume labels as opposed to their mount points? So if I see a path-like string somewhere starting with ´´@´´, I know it's probably referring to a BTRFS (sub)volume structure, not the point it has been mounted to. – Zak Sep 10 '20 at 11:51
  • @Zak Yes, correct. As Btrfs subvolumes are part of the normal directory structure and can't be easily distinguished from folders it makes a lot of sense to give them names that identify them as such. However, the "@" prefix is only common for system subvolumes. – damian101 Sep 11 '20 at 15:44