LPIC-1 104.3: Mounting and unmounting filesystems
Mounting by hand, finding what keeps a filesystem busy, mounting at boot by UUID, systemd mount units, user mounts, and remounting read-only.
Before you start
The lab adds two spare disks, each with an ext4 filesystem that isn't
mounted: /dev/loop40p1 (1 GiB, standing in for the one from 104.1) and
/dev/loop41 (256 MiB, labeled stick, standing in for a USB stick). They
come back at every boot, before filesystems are mounted. It also creates
user uma (password Lab-Pass-1). Write answers to the files in
/root/lab-answers/.
Tasks
- Mount
/dev/loop40p1by hand on/mnt/data, create a file in it,cdinto it in another terminal, and try to unmount. Find the blocker withfuser -vm. - Add it to
/etc/fstabby UUID, still at/mnt/data, check withfindmnt --verifyandmount -a, and reboot to prove it comes back. - Find the mount unit systemd made for it, and read it with
systemctl cat. Write the unit's name to/root/lab-answers/3. - Add a
noauto,usersline for/dev/loop41at/mnt/stick, and mount and unmount it asuma. - Remount
/mnt/dataread-only withmount -o remount,ro, try to write to it, and remount it read-write. Check it yourself: the write fails with "Read-only file system" in between.
Hints
mount,umount,fuser -vm /mnt/data;lsof /mnt/dataworks too.blkid,UUID=... /mnt/data ext4 defaults 0 2;systemctl daemon-reloadafter editing fstab.systemctl list-units --type=mount,systemd-escape -p --suffix=mount /mnt/data.LABEL=stick /mnt/stick ext4 noauto,users 0 0; thensu - umaandmount /mnt/stick.touch /mnt/data/xwhile it's read-only.