Drive Mount Order

I have 3 disk drives on my server and managed by fstab. One disk is for the Rocky OS and user homes. The second disk is used for general data / file storage accessed by clients through samba. The third disk is my backup disk connected by usb. The first two disks have multiple partitions and are identified by their respective UUID’s and the third usb mounted partition by LABEL. They are all auto mounted including the backup disk since backups are run nightly in an automated way.
Upon a maintenance reboot any one of the three disks may be mounted as sda, sdb, or sdc, but usually the backup disk becomes sda.
What I would like is to enable some delay so that the internal disks mount first and then the usb connected disk.
Here is the fstab file for reference:

# After editing this file, run 'systemctl daemon-reload' to update systemd
# units generated from this file.
#
UUID=A0B6-5C18          /boot/efi       vfat    umask=0077,shortname=winnt      0 0
#
UUID=7277c17d-6897-497b-9390-1153c9bff018 /             ext4    defaults        1 1
#
UUID=0b44525d-2550-4d0b-97c6-2b514ac3ba24 /home ext4 defaults,discard,noatime      1 0
UUID=7590c421-0f0d-47fb-b144-b20b88f04725 /data ext4 defaults,discard,noatime    1 0
UUID=03c08301-b0aa-4e6e-80b8-eb3d98aea4c0 /data/user ext4 defaults    1 2
UUID=07ba8b95-2947-47d1-b362-3ff856cb1d4a /data/music ext4 defaults   1 2
UUID=e6fd46d9-bea9-4542-bab0-dafe9bdf0597 /data/bits  ext4 defaults   1 2
#

LABEL=/backupdisk     /data/backup            auto    defaults        0 0
/data/backup/BackupPC  /var/lib/BackupPC      non     bind            0 0

#

Any suggestions are welcome.

Don’t quote me on this, but I believe you can specify the boot order by inserting the device ahead of the UUID (example):

NAME FSTYPE LABEL UUID                                 MOUNTPOINT
sda1 xfs    Boot  ea74bbec-536d-490c-b8d9-5b40bbd7545b /boot

That’s directly from the RHEL 9 docs about the issue. You didn’t specify whether this was RL 8.7 or 9.1, but I’m guessing from the header that it is 9.1.

Thanks, I need to get a proper link to the RHEL 9 docs. I keep refering to them after googling the issue instead of direct by bookmark. Need to know if it is all or nothing or I can do it for one entry.

What’s the problem that you want to be addressed?

Sspencerwire, I read through this documentation and I think it would work if the partition was the same on all the backupdisks but that is not the case for me. Some disks are sdc1 and others are sdc2. I think what I have to do is make the mount no-auto and create a script in rc.local to mount it. That way I might be able to introduce a delay if systemd is running things in parallel.

Could be true, since you don’t have a UUID for the backup device. You are correct that it can easily be scripted, but rc.local is basically disabled by default, so be careful there. What you could do instead, is create the mount script for the backup drive (say in /usr/local/sbin or somewhere like that) then use @reboot crontab entry to execute that script and remove it from /etc/fstab.

Thanks, I’ll have to give that a try. Not today though.

There is the “must mount on boot” and “mounted when needed, by automounter”. Yours look like the first kind.

The second kind could use autofs or systemd.automount. The latter does use systemd unit-file, but we configure it via fstab options:

LABEL=/backupdisk  /data/backup  auto  defaults,noauto,x-systemd.automount,x-systemd.idle-timeout=300 0 0

The x-systemd.automount,x-systemd.idle-timeout=300 tells systemd to create unit-file on boot.
The /data/backup is mounted only when something tries to access it, and if there is no access for 5 minutes, then it is unmounted too.

You do bind-mount something from that volume. No idea whether that is possible with automount.

Since systemd can mount by use of unit-files, it should be possible to have one that does the necessary mounts. Overall, services (and custom mount is a service) are now defined with systemd, not with rc.local. A delay would be possibly done by timer that starts on boot and triggers a oneshot service a bit later.

1 Like

Thanks, Jlehtone. The more I think about this the less I feel compelled to change anything, especially just for my visual satisfaction. Nothing is broken in the current state. Writing systemd unit files which I’ve done for various hardware reasons is just not worth the time. If I did have a need for a certain device order then your advice would certainly be considered.