Linux+ 1.3.4: Mounting filesystems
An /etc/fstab line by UUID with mount options, noexec in action, a
remount, and finding what keeps a mount busy.
Before you start
The lab adds a 512 MiB spare disk, /dev/loop40, with an ext4 filesystem on
it. It comes back at every boot. Task 2 changes the mount only until it's
mounted again, so do the tasks in one go and run le-lab check before you
clean up.
Tasks
- Add
/dev/loop40to/etc/fstabby its UUID, mounted at/mnt/labwith the optionsdefaults,noatime,noexec,nofail, and mount it from fstab. - Copy
/usr/bin/trueinto/mnt/laband show that it won't run from there. Then remount/mnt/labso that programs can run from it, without changing/etc/fstab. - Make the mount busy (
cd /mnt/lab), try to unmount it, and find the culprit withlsof. Not graded.
When le-lab check passes, remove your line from /etc/fstab, run
systemctl daemon-reload and unmount, or leave it to le-lab reset.
Hints
blkid /dev/loop40,blkid -s UUID -o value.- After editing fstab:
systemctl daemon-reload,mount -a,findmnt /mnt/lab. mount -o remount,exec.lsof +D /mnt/lab,fuser -vm /mnt/lab. Minimal RHEL-family installs need thelsofpackage.