Systemd automatically manages mounts for entries that are listed in systemd, and allows you to manually create mount units. In this hands-on lab, you will be tasked with creating systemd mount and automount units.
Learning Objectives
Successfully complete this lab by achieving the following learning objectives:
- Create a unit file for the data mount based on the information provided in the instructions and ensure that it is started and enabled.
- Create a unit file in
/etc/systemd/system
namedmnt-data.mount
with the following contents:
[Unit] Description=Data mount [Mount] What=/dev/disk/by-uuid/filesystem_UUID Where=/mnt/data Type=xfs Options=defaults [Install] WantedBy=multi-user.target
- Update the systemd manager configuration to include a new unit file:
systemctl daemon-reload
- Start and enable the
mnt-data.mount
unit:
systemctl enable mnt-data.mount --now
- Create a unit file in
- Create a unit file for the backup mount based on the information provided in the instructions.
- Create a unit file in
/etc/systemd/system
namedmnt-backup.mount
with the following contents:
[Unit] Description=Backup mount [Mount] What=/dev/disk/by-uuid/filesystem_UUID Where=/mnt/backup Type=ext4 Options=ro [Install] WantedBy=multi-user.target
- Create a mountpoint for
mnt-backup.mount
at/mnt/backup
:
mkdir /mnt/backup
- Update the systemd manager configuration to include a new unit file:
systemctl daemon-reload
- Create a unit file in
- Create an automount unit file for mnt-backup.mount based on the information provided in the instructions and ensure that it is started and enabled.
- Create a unit file in
/etc/systemd/system
namedmnt-backup.automount
with the following contents:
[Unit] Description=Automount backup directory [Automount] Where=/mnt/backup TimeoutIdleSec=600 [Install] WantedBy=multi-user.target
- Update the systemd manager configuration to include new unit file:
systemctl daemon-reload
- Start and enable the
mnt-backup.automount
unit:
systemctl enable mnt-backup.automount --now
- Create a unit file in