Mounting a btrfs partition on startup

Hello,

I want to automatically mount a btrfs partition on startup, but when I add it to /etc/fstab, I can't boot. Here is the current fstab:

# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a device; this may
# be used with UUID= as a more robust way to name devices that works even if
# disks are added and removed. See fstab(5).
#
# <file system>             <mount point>  <type>  <options>  <dump>  <pass>
UUID=b284a6d0-315a-463b-af92-082e9f0f82ed /              btrfs   subvol=/@,defaults,noatime,space_cache,autodefrag,compress=zstd 0 0
UUID=b284a6d0-315a-463b-af92-082e9f0f82ed /home          btrfs   subvol=/@home,defaults,noatime,space_cache,autodefrag,compress=zstd 0 0
UUID=b284a6d0-315a-463b-af92-082e9f0f82ed /root          btrfs   subvol=/@root,defaults,noatime,space_cache,autodefrag,compress=zstd 0 0
UUID=b284a6d0-315a-463b-af92-082e9f0f82ed /srv           btrfs   subvol=/@srv,defaults,noatime,space_cache,autodefrag,compress=zstd 0 0
UUID=b284a6d0-315a-463b-af92-082e9f0f82ed /var/cache     btrfs   subvol=/@cache,defaults,noatime,space_cache,autodefrag,compress=zstd 0 0
UUID=b284a6d0-315a-463b-af92-082e9f0f82ed /var/log       btrfs   subvol=/@log,defaults,noatime,space_cache,autodefrag,compress=zstd 0 0
UUID=b284a6d0-315a-463b-af92-082e9f0f82ed /var/tmp       btrfs   subvol=/@tmp,defaults,noatime,space_cache,autodefrag,compress=zstd 0 0
UUID=aa08a7a8-1896-43ea-b800-85110b533d48 /mnt/big       btrfs   subvol=/@idk,defaults,noatime,space_cache,autodefrag,compress=zstd 0 0
UUID=A01C-D456                            /boot/efi      vfat    umask=0077 0 2
/dev/disk/by-uuid/9C59-F38D /mnt/9C59-F38D auto nosuid,nodev,nofail,x-gvfs-show,noauto 0 0

And this is the line I added:

UUID=aa08a7a8-1896-43ea-b800-85110b533d48 /mnt/big       btrfs   subvol=/@idk,defaults,noatime,space_cache,autodefrag,compress=zstd 0 0

I can boot normally without it.

When I mount it using sudo mount /dev/sda5 /mnt/big, it mounts fine with no issues.

Here are some commands I tried.

Command: sudo btrfs subvolume get-default /mnt/big
Output: ID 256 gen 104 top level 5 path idk

Command: sudo btrfs subvolume list /mnt/big
Output: ID 256 gen 104 top level 5 path idk

I've used sudo btrfs create idk /mnt/big and sudo btrfs set-default idk /mnt/big to create and set the subvolume as default. (I only did this after seeing that the partition had no subvolumes, so I thought that adding one would fix it.)

I've also tried changing subvol=/@idk in /ect/fstab to subvol=idk, subvol=/idk, subvol=/@, subvol=/ and removing it completely. I always get the same result.

When trying to mount the drive from the Disks utility, I get this error message.

If I try to boot with the line in /etc/fstab, I get booted into emergency mode, and I have to use micro /etc/fstab to remove the bad line so I can boot.

Output from inxi -Faz

System:    Kernel: 5.15.2-zen1-1-zen x86_64 bits: 64 compiler: gcc v: 11.1.0
parameters: BOOT_IMAGE=/@/boot/vmlinuz-linux-zen root=UUID=b284a6d0-315a-463b-af92-082e9f0f82ed
rw [email protected] quiet splash rd.udev.log_priority=3 vt.global_cursor_default=0
systemd.unified_cgroup_hierarchy=1 loglevel=3
Desktop: KDE Plasma 5.23.3 tk: Qt 5.15.2 info: latte-dock wm: kwin_x11 vt: 1 dm: SDDM
Distro: Garuda Linux base: Arch Linux
Machine:   Type: Desktop Mobo: ASUSTeK model: PRIME H310M-A R2.0 v: Rev X.0x serial: <filter>
UEFI: American Megatrends v: 1004 date: 09/06/2019
CPU:       Info: 6-Core model: Intel Core i5-9500F bits: 64 type: MCP arch: Kaby Lake note: check
family: 6 model-id: 9E (158) stepping: A (10) microcode: EA cache: L2: 9 MiB
flags: avx avx2 lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx bogomips: 36000
Speed: 4401 MHz min/max: 800/4400 MHz Core speeds (MHz): 1: 4401 2: 4392 3: 4380 4: 4368
5: 4404 6: 4395
Vulnerabilities: Type: itlb_multihit status: KVM: VMX disabled
Type: l1tf mitigation: PTE Inversion; VMX: conditional cache flushes, SMT disabled
Type: mds mitigation: Clear CPU buffers; SMT disabled
Type: meltdown mitigation: PTI
Type: spec_store_bypass mitigation: Speculative Store Bypass disabled via prctl
Type: spectre_v1 mitigation: usercopy/swapgs barriers and __user pointer sanitization
Type: spectre_v2
mitigation: Full generic retpoline, IBPB: conditional, IBRS_FW, STIBP: disabled, RSB filling
Type: srbds mitigation: Microcode
Type: tsx_async_abort mitigation: TSX disabled
Graphics:  Device-1: NVIDIA TU117 [GeForce GTX 1650] vendor: ASUSTeK driver: nvidia v: 495.44
alternate: nouveau,nvidia_drm bus-ID: 01:00.0 chip-ID: 10de:1f82 class-ID: 0300
Display: x11 server: X.Org 1.21.1.1 compositor: kwin_x11 driver: loaded: nvidia display-ID: :0
screens: 1
Screen-1: 0 s-res: 3840x1080 s-dpi: 92 s-size: 1060x301mm (41.7x11.9") s-diag: 1102mm (43.4")
Monitor-1: DVI-D-0 res: 1920x1080 hz: 75 dpi: 93 size: 527x296mm (20.7x11.7")
diag: 604mm (23.8")
Monitor-2: HDMI-0 res: 1920x1080 hz: 75 dpi: 93 size: 527x296mm (20.7x11.7")
diag: 604mm (23.8")
OpenGL: renderer: NVIDIA GeForce GTX 1650/PCIe/SSE2 v: 4.6.0 NVIDIA 495.44 direct render: Yes
Audio:     Device-1: Intel 200 Series PCH HD Audio vendor: ASUSTeK driver: snd_hda_intel v: kernel
bus-ID: 00:1f.3 chip-ID: 8086:a2f0 class-ID: 0403
Device-2: NVIDIA vendor: ASUSTeK driver: snd_hda_intel v: kernel bus-ID: 01:00.1
chip-ID: 10de:10fa class-ID: 0403
Device-3: JMTek LLC. USB PnP Audio Device(EEPROM) type: USB
driver: hid-generic,snd-usb-audio,usbhid bus-ID: 1-6:4 chip-ID: 0c76:161f class-ID: 0300
Sound Server-1: ALSA v: k5.15.2-zen1-1-zen running: yes
Sound Server-2: JACK v: 1.9.19 running: no
Sound Server-3: PulseAudio v: 15.0 running: yes
Sound Server-4: PipeWire v: 0.3.40 running: yes
Network:   Device-1: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet vendor: ASUSTeK PRIME B450M-A
driver: r8169 v: kernel port: d000 bus-ID: 03:00.0 chip-ID: 10ec:8168 class-ID: 0200
IF: enp3s0 state: up speed: 100 Mbps duplex: full mac: <filter>
Drives:    Local Storage: total: 1.14 TiB used: 48.57 GiB (4.2%)
SMART Message: Unable to run smartctl. Root privileges required.
ID-1: /dev/nvme0n1 maj-min: 259:0 vendor: A-Data model: SX6000PNP size: 238.47 GiB block-size:
physical: 512 B logical: 512 B speed: 31.6 Gb/s lanes: 4 type: SSD serial: <filter>
rev: V9002s16 temp: 35.9 C scheme: GPT
ID-2: /dev/sda maj-min: 8:0 vendor: Western Digital model: WD10EZEX-60WN4A1 size: 931.51 GiB
block-size: physical: 4096 B logical: 512 B speed: 6.0 Gb/s type: HDD rpm: 7200
serial: <filter> rev: 1A03 scheme: GPT
Partition: ID-1: / raw-size: 58.59 GiB size: 58.59 GiB (100.00%) used: 48.54 GiB (82.8%) fs: btrfs
dev: /dev/nvme0n1p3 maj-min: 259:3
ID-2: /boot/efi raw-size: 99 MiB size: 95 MiB (95.96%) used: 25.7 MiB (27.1%) fs: vfat
dev: /dev/sda2 maj-min: 8:2
ID-3: /home raw-size: 58.59 GiB size: 58.59 GiB (100.00%) used: 48.54 GiB (82.8%) fs: btrfs
dev: /dev/nvme0n1p3 maj-min: 259:3
ID-4: /var/log raw-size: 58.59 GiB size: 58.59 GiB (100.00%) used: 48.54 GiB (82.8%) fs: btrfs
dev: /dev/nvme0n1p3 maj-min: 259:3
ID-5: /var/tmp raw-size: 58.59 GiB size: 58.59 GiB (100.00%) used: 48.54 GiB (82.8%) fs: btrfs
dev: /dev/nvme0n1p3 maj-min: 259:3
Swap:      Kernel: swappiness: 133 (default 60) cache-pressure: 100 (default)
ID-1: swap-1 type: zram size: 7.7 GiB used: 4 MiB (0.1%) priority: 100 dev: /dev/zram0
Sensors:   System Temperatures: cpu: 29.8 C mobo: 27.8 C gpu: nvidia temp: 41 C
Fan Speeds (RPM): N/A gpu: nvidia fan: 28%
Info:      Processes: 246 Uptime: 36m wakeups: 0 Memory: 7.7 GiB used: 3.55 GiB (46.1%) Init: systemd
v: 249 tool: systemctl Compilers: gcc: 11.1.0 clang: 13.0.0 Packages: pacman: 1662 lib: 468
Shell: fish v: 3.3.1 default: Bash v: 5.1.8 running-in: konsole inxi: 3.3.08

The subvol is named idk not @idk

Try:

UUID=aa08a7a8-1896-43ea-b800-85110b533d48 /mnt/big       btrfs   subvol=idk,defaults,noatime,autodefrag,compress=zstd 0 0

You can test it without rebooting by using:

sudo mount /mnt/big

That will make is use fstab to mount it.

5 Likes

That solved the problem.

I see that you also removed space_cache. I've done some testing, and it also fails to mount if that option is present. Thank you so much!

2 Likes

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.