Use the filesystem’s UUID for a persistent local mount on Ubuntu. Identify the real filesystem first, back up /etc/fstab, then verify the edited file before attempting that mount. Test the one target you changed while you still have a working shell. A syntax check can catch some mistakes before reboot, but only a real mount and an access check tell you whether the device and permissions work as expected.
Inspect disks and existing mounts before editing
lsblk -o NAME,SIZE,FSTYPE,UUID,LABEL,MOUNTPOINTS
findmnt --mountpoint /mnt/archive
Match the disk by size, filesystem type, label and current mount. Device names such as /dev/sdb1 can change when disks are connected in a different order. Take special care after cloning. An original and its clone can have the same UUID, which makes that identifier ambiguous with both attached. Before choosing a mount point, inspect its contents. Mounting over a non-empty directory hides the existing files until you unmount it.
Read an fstab entry field by field
This example uses a fictitious UUID and an ext4 data partition. Substitute the UUID reported by your own system. Keep the root, EFI and other unrelated entries intact.
UUID=12345678-1234-4abc-8def-1234567890ab /mnt/archive ext4 defaults,nofail 0 2
| Field | Meaning in the example |
|---|---|
| Source | The filesystem UUID, as reported by lsblk. |
| Target | The existing directory where the filesystem appears. |
| Type | The filesystem driver to use. Here it is ext4. |
| Options | Filesystem and mount options, separated by commas. |
| Dump | 0 leaves the filesystem out of the legacy dump schedule. |
| Pass | 2 marks this non-root ext4 filesystem for filesystem checks where applicable. |
Use the fstab(5) man page for fields and escaping. A space in a target path is represented by \040 even when the field uses quotes. Prefer simple mount point names where possible. A missing dump or pass field defaults to zero.
Choose the identifier and filesystem options
UUID= identifies a filesystem. PARTUUID= identifies a partition. Formatting a partition can change its filesystem UUID without changing the partition identity. Use the value that matches the field you specified. Network mounts use a different source format such as a device share, with its own reachability and credentials.
Treat nofail as a decision about what boot can tolerate. For an optional external drive, boot can continue if the device is unavailable. For required application storage, a missing mount can leave a writable empty directory on the root filesystem. A service may then write to the wrong disk. Check the service’s mount dependency before making its storage optional.
Add the mount and verify it before rebooting
Choose an unused backup name so that you keep your original rollback copy. Create the intended mount directory first, then use sudoedit /etc/fstab to add the line. With systemd, refresh its view of unit configuration after editing.
sudo cp -a --no-clobber /etc/fstab /etc/fstab.before-archive
sudo mkdir -p /mnt/archive
sudoedit /etc/fstab
sudo findmnt --verify --verbose
sudo systemctl daemon-reload
Confirm the backup contains the expected original before continuing. Inspect each reported problem and fix the entry or restore the backup before testing. The findmnt manual also documents --tab-file for reviewing a candidate file. A fictitious UUID can illustrate the format, but verification against the machine may report its source missing.
Then test just the new target. This performs a mount.
sudo mount /mnt/archive
findmnt --mountpoint /mnt/archive -o SOURCE,TARGET,FSTYPE,OPTIONS
Verify access as the account that actually needs it. For a writable data mount, use an expendable test file in an appropriate directory. A successful mount as root does not show that a regular user or service can write.
Explain permissions and missing devices
On ext4, file ownership and access modes are stored on the filesystem. Adjust the intended directory after verifying which filesystem is mounted. A filesystem such as FAT may use uid=, gid= and mask options to present access rights. Those options do not select the disk. Check the options documented for the exact filesystem and driver rather than copying a line from another format.
Recover from a bad entry
If the test mount fails, keep the original backup and correct or comment out only the new entry. Unmount a test mount before restoring its old configuration, and close processes using it. After restoring the backup, rerun findmnt --verify --verbose and reload systemd configuration. If already stuck at boot, use the recovery menu or a live Ubuntu session. Identify the installed root filesystem before editing the installed system’s etc/fstab. A live system has its own separate /etc/fstab.
Know when to stop changing a failing disk
Repeated I/O errors, a disappearing device or a disk making unusual sounds can indicate failure. Stop write-heavy repairs. For important data, consider a recovery specialist or plan a ddrescue copy before filesystem repair. Run a filesystem checker only with the correct target and guidance for that filesystem. A syntax check does not assess the health of the drive.
For structured practice with persistent mounts and storage, see Mastering Linux - The Comprehensive Guide.
