After I installed and configured artix(s6) some months back I noticed a strange behavior when sometimes on boot my /home, /var, /srv and similar partitions wouldn't mount. These partitions are on a separate set of devices than my root partition. To mitigate this I created a separate user with root privileges on my root partition to be able to remotely login in case my actual user is not available when /home isn't mounted. I also modified the mount-filesystems oneshot so that it mounts /var as tmpfs so that my root partition isn't polluted with data it doesn't need.
my mount-filesystems oneshot:
#!/bin/execlineb -P
foreground { mount -a -O no_netdev } if -t -n { mountpoint -q /var } foreground { mount -t tmpfs -o defaults,nofail var /var }
The problem still happened from time to time but then I would just login as the backup user, do a reboot, and everything was fine. Since today a reboot doesn't fix it anymore.
I have 2 SSDs in a btrfs raid as / and 3 HDDs in a btrfs raid for /home, /var and /srv. I tried adding udevadm settle and btrfs device scan to the above mount-filesystems oneshot, but it didn't help. It seems as if at the time the oneshot is run the HDDs are not yet present under /dev. My theory is that my system boots of the ssds so fast that the HDDs didn't had time to spin up. I don't know what I could do to fix it. I can confirm that after I login as the backup user the HDDs are in fact there and mountable with mount -a. The output of uncaught logs is:
@4000000067e1bc8933c9201c touch: cannot touch '/var/log/lastlog': No such file or directory
@4000000067e1bc89341e3650 chgrp: cannot access '/var/log/lastlog': No such file or directory
@4000000067e1bc893446f2b8 chmod: cannot access '/var/log/lastlog': No such file or directory
@4000000067e1bc8a177408d4 mount: /home: can't find UUID=3865dc4a-dba0-4457-b507-9e9cc956e05e.
@4000000067e1bc8a1774111c mount: /srv: can't find UUID=3865dc4a-dba0-4457-b507-9e9cc956e05e.
@4000000067e1bc8a17741748 mount: /var: can't find UUID=3865dc4a-dba0-4457-b507-9e9cc956e05e.
@4000000067e1bc8a17741978 mount: /var/log: can't find UUID=3865dc4a-dba0-4457-b507-9e9cc956e05e.
@4000000067e1bc8a17741dce mount: /var/cache: can't find UUID=3865dc4a-dba0-4457-b507-9e9cc956e05e.
@4000000067e1bc8a17742026 mount: /var/torrents: can't find UUID=3865dc4a-dba0-4457-b507-9e9cc956e05e.
My fstab:
# Static information about the filesystems.
# See fstab(5) for details.
# <file system> <dir> <type> <options> <dump> <pass>
# /dev/sdd3 LABEL=SYSTEM
UUID=7fd15039-f598-402b-ba6e-9a48e470b668 / btrfs rw,relatime,compress=zstd:3,ssd,discard=async,space_cache=v2,subvol=/@root 0 0
# /dev/md0 LABEL=ESP
UUID=CD9B-2F8D /boot/efi vfat rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro 0 2
# /dev/bcache0 LABEL=DATA
UUID=3865dc4a-dba0-4457-b507-9e9cc956e05e /home btrfs rw,relatime,compress=zstd:3,nossd,discard=async,space_cache=v2,subvol=/@home 0 0
# /dev/bcache0 LABEL=DATA
UUID=3865dc4a-dba0-4457-b507-9e9cc956e05e /srv btrfs rw,relatime,compress=zstd:3,nossd,discard=async,space_cache=v2,subvol=/@srv 0 0
# /dev/bcache0 LABEL=DATA
UUID=3865dc4a-dba0-4457-b507-9e9cc956e05e /var btrfs rw,relatime,compress=zstd:3,nossd,discard=async,space_cache=v2,subvol=/@var 0 0
# /dev/bcache0 LABEL=DATA
UUID=3865dc4a-dba0-4457-b507-9e9cc956e05e /var/log btrfs rw,noatime,compress=zstd:3,nossd,discard=async,space_cache=v2,subvol=/@varlog 0 0
# /dev/bcache0 LABEL=DATA
UUID=3865dc4a-dba0-4457-b507-9e9cc956e05e /var/cache btrfs rw,noatime,compress=zstd:3,nossd,discard=async,space_cache=v2,subvol=/@varcache 0 0
# /dev/bcache0 LABEL=DATA
UUID=3865dc4a-dba0-4457-b507-9e9cc956e05e /var/torrents btrfs rw,relatime,compress=zstd:3,nossd,discard=async,space_cache=v2,subvol=/@torrents 0 0
UUID=50ef0128-bf80-4327-a4e2-992bdffe3665 none swap defaults,pri=100 0 0
UUID=a5aa4acc-0e21-451c-9940-b4e3652aef6d none swap defaults,pri=10 0 0
UUID=a07909a0-ef0d-4d1c-b80a-22bce06df0c8 none swap defaults,pri=10 0 0
My mkinitcpio.conf:
MODULES=(bcache)
BINARIES=(make-bcache)
FILES=()
HOOKS=(base udev autodetect microcode modconf kms keyboard keymap consolefont block btrfs wifi netconf dropbear shell filesystems fsck)
Is there some general solution for waiting for non root HDDs to appear before the filesystems are mounted?