Junior
What happens if you mount a disk with the mount command and then reboot the system?
sobes.tech AI
Answer from AI
After rebooting the system, a disk mounted with the mount command without making changes to /etc/fstab will not remain mounted. The mount command only mounts for the current session until unmounted or the system is rebooted.
To automatically mount the disk at each system startup, you need to add the appropriate entry to the /etc/fstab file.
Example entry in /etc/fstab:
# <device> <mount_point> <filesystem_type> <options> <dump> <pass>
UUID=abcdef01-2345-6789-abcd-ef0123456789 /mnt/mydisk ext4 defaults 0 2
Where:
- UUID=...: Unique identifier of the disk. It is recommended to use UUID instead of device name (/dev/sdb1, etc.), as names can change.
- /mnt/mydisk: Mount point.
- ext4: Filesystem type.
- defaults: Default mount options (rw, suid, dev, exec, auto, nouser, async).
- 0: Parameter for the
dumputility. 0 means disabled. - 2: Parameter for the
fsckutility. Determines the order of filesystem checks during boot. 2 means check after the root filesystem.
After adding the entry to /etc/fstab, the disk will be automatically mounted on the next reboot. You can verify the correctness of the entry without rebooting by executing mount -a.