🗄️ Mounting BTRFS subvolumes
Monday 27 February 2023

If you have installed GNU/Linux with BTRFS as the filesystem, chances are that your OS installer has used sub-volumes for the root, home and other mount points. 🗄️

You can verify this by mounting the actual root filesystem device and listing its contents:

1# ls -l /mnt/
2total 0
3drwxr-xr-x 1 root root  204 Feb 22 13:28 @
4drwxr-xr-x 1 root root  180 Feb 22 14:29 @cache
5drwxr-xr-x 1 root root   10 Dec  2 10:52 @home
6drwxr-xr-x 1 root root  482 Feb 26 00:00 @log
7drwxr-x--- 1 root root  350 Feb 23 15:40 @root
8drwxr-xr-x 1 root root   14 Oct 19 07:42 @srv
9drwxrwxrwt 1 root root 1576 Feb 27 17:18 @tmp

Here @, @home, @log etc. are the BTRFS sub-volumes. @ is the OS root sub-volume. You can mount by giving the -osubvol=@ option to the mount command:

 1# mount -osubvol=@ /dev/dm-0 /mnt/
 2# ls -l /mnt/
 3total 24
 4lrwxrwxrwx 1 root root    7 Feb  1 02:21 bin -> usr/bin
 5drwxr-xr-x 1 root root  208 Feb 22 13:30 boot
 6drwxr-xr-x 1 root root    8 Oct 20 18:39 dev
 7drwxr-xr-x 1 root root 5018 Feb 25 10:56 etc
 8drwxr-xr-x 1 root root    0 Dec  2 10:48 home
 9lrwxrwxrwx 1 root root    7 Feb  1 02:21 lib -> usr/lib
10lrwxrwxrwx 1 root root    7 Feb  1 02:21 lib64 -> usr/lib
11drwxr-xr-x 1 root root   22 Dec 16 13:00 mnt
12drwxr-xr-x 1 root root  214 Feb 23 15:50 opt
13drwxr-xr-x 1 root root    0 Dec  2 10:48 proc
14drwxr-xr-x 1 root root   66 Oct 20 18:47 root
15    ....    ....    ....

#linux #btrfs #systemrescue #filesystem

Backlinks

See Also