Debian 13 Tutorial / Configure UUID-based fstab Mounts and Check Boot Failures

To automatically mount a data disk after rebooting on Debian 13, check the actual file system UUID and register it in fstab, and before rebooting, verify the candidate file and check the mount of the corresponding path. For optional disks, you can consider using 'nofail', but you still need to separately verify that the boot continues and that the data mount and services are functioning normally.

Identify the Existing Filesystem by UUID

Device names like /dev/sdb1 can change depending on the disk detection order. The UUID (Universally Unique Identifier) is a value that identifies a file system and can be used instead of device names in fstab. The Debian fstab manual also explains methods to specify using LABEL or UUID.

This tutorial uses the 8GiB data disk from new-disk GPT and ext4 lab as-is. The file system and work/probe.txt already exist and will not be reformatted. The existing root, EFI, and swap entries are not edited, only the entry for /srv/lf-data22 is added.

lsblk -o NAME,SIZE,FSTYPE,LABEL,UUID,PARTUUID,MOUNTPOINTS
data_part=/dev/disk/by-id/ata-VBOX_HARDDISK_VB50a843e8-b263b0b5-part1
sudo blkid "$data_part"
data_uuid=$(sudo blkid -s UUID -o value "$data_part")
printf '%s\n' "$data_uuid"
findmnt -n -o SOURCE,FSTYPE /

Adjust the by-id path to match your own data partition. The file system UUID in this practice was 9d0dfcd8-cbef-4b80-843e-346430ff8737. The PARTUUID in the same output is an identifier for the GPT partition itself and is a separate value. This article uses the file system UUID, so do not mix the two values.

The UUID remains even if the mount is unmounted, but it can change if a new file system is created. If the disk is cloned as-is, the UUID can also be cloned, so do not assume a UUID uniquely selects the intended disk when two copies with that UUID are connected at once. Check the target, size, file system, and duplicate values together in lsblk.

Read the Six Fields of an fstab Entry

In this exercise, we will configure it as an optional data disk that the operating system can boot without. Below is the actual line used. If your UUID is different, you need to change it to the actual value.

UUID=9d0dfcd8-cbef-4b80-843e-346430ff8737 /srv/lf-data22 ext4 defaults,nofail,x-systemd.device-timeout=5s 0 2
Fields Values for this example What to Check
File system UUID=actual file system UUID Check if the target partition matches the ext4 UUID
Mount Point /srv/lf-data22 It is a dedicated directory and does not conflict with existing data or other mounts
Format ext4 Matches the actual file system format
Options defaults,nofail,x-systemd.device-timeout=5s Handles default mounts and optional disks, device wait limits
dump 0 Not designated as a target for dump tools; distinguished from separate backup policies
File system check 2 Used as a target for boot checks of file systems other than the root; 0 excludes it from the check

Use spaces or tabs between fields and separate options with commas. If there are spaces in the path, fstab's escape rules are required, so this exercise uses paths without spaces. In systemd's fstab conversion, root checks are processed first, and the remaining pass values are treated simply as whether a check is performed or not, so numbers such as 2 and 3 are not interpreted as setting the order of all data disks.

Back Up fstab and Validate a Candidate

First, check whether the same data file system is mounted at a different path. If the corresponding path or backup folder already exists, do not overwrite it; instead, check the existing contents. Make sure you can log in and use sudo from the console before proceeding, and keep the current SSH session until the pre-reboot checks and restoration are completed.

findmnt -rn -S "UUID=$data_uuid"
grep -n '/srv/lf-data22' /etc/fstab
ls -ld /srv/lf-data22 /var/backups/lf-debian13-22
sudo findmnt --verify --verbose

In this exercise, which has not yet been registered or mounted, there should be no matching entries in the first two searches. A file not found error from ls is also the expected result of checking a new path. Existing fstab checks serve as a reference to understand the current state. This VM had one previous warning due to the noauto entry for an empty optical drive, which prevented media format detection, and it has been distinguished from errors in new data entries. Do not ignore unknown warnings in bulk.

sudo test ! -e /var/backups/lf-debian13-22 &&
sudo install -d -m 700 /var/backups/lf-debian13-22 &&
sudo cp -a /etc/fstab /var/backups/lf-debian13-22/fstab-before &&
sudo cp /etc/fstab /var/backups/lf-debian13-22/fstab-candidate
sudo test ! -e /srv/lf-data22 &&
sudo install -d -m 755 /srv/lf-data22

Do not proceed if any prerequisite fails. Retain the original fstab and only add new lines to the candidate file. Confirm that if the UUID variable is empty, it is not added.

test -n "$data_uuid" &&
printf '\nUUID=%s /srv/lf-data22 ext4 defaults,nofail,x-systemd.device-timeout=5s 0 2\n' "$data_uuid" |
sudo tee -a /var/backups/lf-debian13-22/fstab-candidate > /dev/null
sudo findmnt --verify --verbose --tab-file /var/backups/lf-debian13-22/fstab-candidate

Use the findmnt verification options to inspect syntax and device/path availability. If the new entry has an unverified UUID, format mismatch, or path issues, it will not be applied. In practice, we inserted a UUID that does not exist in a separate candidate that treated the mount as required to check the 'unreachable on boot required source' error, and then corrected it without changing the actual fstab.

A successful check does not guarantee actual mount success or normal operation after reboot. In particular, optional disks designated with 'nofail' can be treated differently when missing compared to required disks, so warnings should be checked along with the current devices.

Mount Only the Lab Path and Inspect the Generated Unit

While preparing the candidate, compare to see if fstab has been changed by other edits before applying. If cmp shows differences, do not forcibly overwrite the original but reflect only this entry on top of the latest changes.

sudo cmp /etc/fstab /var/backups/lf-debian13-22/fstab-before &&
sudo cp /var/backups/lf-debian13-22/fstab-candidate /etc/fstab
sudo systemctl daemon-reload
sudo mount /srv/lf-data22
findmnt --mountpoint /srv/lf-data22
findmnt -n -o UUID --mountpoint /srv/lf-data22
cat /srv/lf-data22/work/probe.txt

Check the filesystem UUID and ext4 with read-write access, and read the existing line for data-disk21. mount /srv/lf-data22 finds the path in fstab and links it. At this stage, rather than applying all other entries together, we check starting from this path.

systemd converts fstab into mount units at boot initialization and when reloading administrative settings. When viewing the created results, do not guess the unit name from the path directly but use the conversion command.

mount_unit=$(systemd-escape --path --suffix=mount /srv/lf-data22)
systemctl cat "$mount_unit"
systemctl is-active "$mount_unit"

The generated file shows entries such as SourcePath, indicating the original is /etc/fstab, What, the UUID device path, and Where, the mount point. Since there are characters that are escaped like hyphens, simply replacing the slashes to create the unit name could be incorrect. Manage the original fstab rather than directly editing transient files under /run, as described in the systemd-fstab-generator manual.

In this exercise, we also confirmed that a nofail mount is created through the wants link of local-fs.target. Although Options read by the unit show defaults,nofail, do not assume that all original options must appear in a single Options line, as device wait limits can be reflected in separate dependencies.

Verify Automatic Mounting After Reboot

After reviewing the current mounts and data, perform a normal reboot with the console secured.

sudo systemctl reboot

After boot completion, check via a new SSH connection. Variables from previous shells do not remain in the new session, so re-check any necessary values.

findmnt --mountpoint /srv/lf-data22
findmnt -n -o UUID --mountpoint /srv/lf-data22
cat /srv/lf-data22/work/probe.txt
mount_unit=$(systemd-escape --path --suffix=mount /srv/lf-data22)
systemctl is-active "$mount_unit"
sudo journalctl -b -u "$mount_unit" --no-pager
systemctl --failed --no-pager

Before re-executing the manual mount command, you need to confirm whether it is already connected to verify the automatic mount. In this VM, the same UUID, existing files, and active mounts were confirmed after a fresh boot. Do not conclude an fstab error solely from an initial SSH connection failure; check the console's boot status and device readiness as well.

Compare a Missing Optional Disk with a Service’s Required Mount

nofail allows systemd not to require the mount as a boot-essential condition and to continue booting without waiting for the mount to complete. x-systemd.device-timeout=5s is a limit on waiting for the device to appear; it is not an option that restricts the total boot time or all mount operations to 5 seconds. The 5 seconds is the value for this local exercise, and a suitable value for real storage devices that initialize slowly should be separately considered. For meaning and application location, see the fstab option of systemd.mount .

To directly make this comparison, only the optional data VDI attachment, clearly distinguished from the system disk should be used. Proceed in the following order without forcibly disconnecting during the mount.

  1. Shut down the VM normally and confirm that the power is off.
  2. Remove only the data VDI connection added in VirtualBox storage. Do not delete the file itself.
  3. Boot and verify that SSH/console access is available while the data mount is absent.
  4. After shutting down the VM normally again, reconnect the same VDI and boot.
  5. Check automatic mount and existing files with the same UUID again.

In a missing state, the following two commands have different meanings.

findmnt --mountpoint /srv/lf-data22
findmnt --target /srv/lf-data22

The first command cannot find the mount of that path itself. The second shows the file system that includes that directory, so in practice, the root /dev/sda2 appeared. You should not assume that a data disk is connected just because the directory exists.

In actual comparisons, even without a data VDI, the multi-user target and SSH were active, but mount operations recorded dependency failures. When reconnected and booted, the same file system and files could be read. The nofail option is not intended to resolve data loss or device errors, nor to ensure the normal operation of services using that data. Do not add it en masse to root, EFI, or critical data.

Services for which the data disk is essential review the following dependencies in the [Unit] section of each service's drop-in. Specify the actual service path and apply it through the drop-in inspection, rereading, and restart procedure .

[Unit]
RequiresMountsFor=/srv/lf-data22

RequiresMountsFor adds requirement and execution order dependencies for mounts needed in the path. The dedicated test service for the exercise did not create an execution marker in the missing state because the start task was denied due to the dependency, but it executed after reconnection. Since task dependency failure and the program's own termination result may differ, check both the journal's dependency records and the actual task results. This single option does not replace all fault handling policies of services that are already running.

Remove the Lab Entry and Preserve the Filesystem

After completing the exercise, check to ensure that related services are not using the path and move the current directory outside. If you added this comparative dependency to the service, only revert that supplementary setting and reload the unit to confirm the applied state. If a missing comparison was performed, reconnect the data VDI, finish checking normal mount and data, then clean up.

cd /
sudo umount /srv/lf-data22
sudo cmp /etc/fstab /var/backups/lf-debian13-22/fstab-candidate &&
sudo cp -a /var/backups/lf-debian13-22/fstab-before /etc/fstab
sudo systemctl daemon-reload
sudo findmnt --verify --verbose
sudo rmdir -- /srv/lf-data22
lsblk -o NAME,FSTYPE,LABEL,UUID,MOUNTPOINTS

This restoration assumes that the current fstab is exactly the same as this candidate. If there are other edits, do not overwrite the current file with the whole backup; instead, remove only this data item from the latest file and recheck. If rmdir reports that it is not empty, verify that no files were written to the root disk while the data filesystem was missing and do not delete recursively.

After cleanup, the ext4/UUID of the new data partition and existing files remain on the disk, and only the automatic mount registration is removed. This exercise restored fstab in its original byte-by-byte state and preserved the data file system in a attached but unmounted state.