Whenever systemd.fsck
actually has to do a repair* at boot time, automatic mounting of my partition fails because the mount
command doesn't wait until [email protected]
is done.
How do I ensure that mount
waits until the file system check service finishes instead of failing immediately because the file system check was started?
The relevant line in fstab
looks like this:
LABEL=cfdata /data ext4 defaults,nofail,x-systemd.device-timeout=60 0 0
(the label cfdata
is on /dev/sda1
)
The relevant systemd logs look like this when there's a failed mount at boot:
Jun 23 06:24:45 dev-machine-1 kernel: sda: sda1
Jun 23 06:24:45 dev-machine-1 kernel: sd 0:0:0:0: [sda] Attached SCSI disk
Jun 23 06:24:47 dev-machine-1 systemd[1]: Starting File System Check on /dev/sda1...
Jun 23 06:24:47 dev-machine-1 mount[5563]: mount: /data: /dev/sda1 already mounted or mount point busy.
Jun 23 06:24:47 dev-machine-1 systemd-fsck[5483]: cfdata: recovering journal
Jun 23 06:24:49 dev-machine-1 systemd-fsck[5483]: cfdata: Clearing orphaned inode 13 (uid=0, gid=0, mode=0100644, size=39685)
Jun 23 06:24:49 dev-machine-1 systemd-fsck[5483]: cfdata: clean, 2767944/29310976 files, 75558004/117212630 blocks
Jun 23 06:24:49 dev-machine-1 systemd[1]: Started File System Check on /dev/sda1.
Jun 23 06:24:49 dev-machine-1 kernel: EXT4-fs (sda1): mounted filesystem with ordered data mode. Opts: (null)
When this happens, the drive gets mounted to /media/<uuid>
instead of my mount point in fstab
.
Note:
When [email protected]
has to do a repair, output in the journal will be something like: Clearing orphaned inode 13 (uid=0, gid=0, mode=0100644, size=39685)
. The mount problem only happens when fsck is actually doing something like this and holds up the device.