An unplugged disk causes a delay in system boot
July 15, 2021
The fstab file contains descriptive information about the file systems that the system can mount. In the /etc/fstab file, you can specify the parameters for mounting a disk, which can be either plugged to the system or unplugged from it. An example of such a disk is an external USB drive. In the latter case, you must additionally specify the nofail option.
An example of such an entry:
UUID=26FC3023FC2FEC2D /mnt/disk_e ntfs nofail,rw,utf8 0 0
Thanks to the nofail option, the system boots normally and shows no errors even if the specified disk is missing.
But starting with systemd 249-3, the system began to try to mount this disk even if it was not connected. As a result, when the computer was turned on, it waited for the timeout of this operation to complete, that is, the boot freeze for 90 seconds (the default timeout).
The following messages appeared in the system log:
HackWare systemd: dev-disk-by\x2duuid-26FC3023FC2FEC2D.device: Job dev-disk-by\x2duuid-26FC3023FC2FEC2D.device/start timed out. HackWare systemd: Timed out waiting for device /dev/disk/by-uuid/26FC3023FC2FEC2D. HackWare systemd: dev-disk-by\x2duuid-26FC3023FC2FEC2D.device: Job dev-disk-by\x2duuid-26FC3023FC2FEC2D.device/start failed with result 'timeout'.
Most likely, this problem is a temporary bug that will be fixed in future versions of systemd. But now you can use the x-systemd.device-timeout mount option so that the computer does not wait a minute and a half.
In the following example, the timeout value is set to 1 second:
UUID=26FC3023FC2FEC2D /mnt/disk_e ntfs nofail,rw,utf8,x-systemd.device-timeout=1 0 0
As a result, the computer began to turn on almost immediately, without delay.
If the specified disk is connected to the computer after turning on, then the disk will be mounted correctly, taking into account the options from the /etc/fstab file. The minimum timeout time is not an obstacle for mounting after turning on the computer.
If the disk is usually unplugged, then the noauto option is more appropriate:
UUID=26FC3023FC2FEC2D /mnt/disk_e ntfs noauto,nofail,rw,utf8 0 0
This option makes it so that the system will not try to mount the disk when you turn on the computer. However, the next time you connect the disk, it will be mounted according to the options in the /etc/fstab file.
- Persistent names for block devices (92.9%)
- How to determine why Linux boots into Emergency mode (83.4%)
- How to repair an LVM disk using fsck (83.4%)
- Error “Cannot open access to console, the root account is locked” (SOLVED) (70.9%)
- The in-memory file system - how to use tmpfs (70.5%)
- How to determine the type and speed of a USB port (RANDOM - 50%)