Sobes.tech
Junior — Middle

How is mounting of a partition performed on a Linux system?

sobes.tech AI

Answer from AI

In Linux, mounting a partition is the process of attaching the partition's filesystem to a specific point in the directory hierarchy to access its contents.

The main steps for mounting a partition:

  1. Create a mount point — an empty directory where the partition will be "attached":
sudo mkdir /mnt/mydisk
  1. Execute the mount command, specifying the device and the mount point:
sudo mount /dev/sdXN /mnt/mydisk

where /dev/sdXN is the device name (e.g., /dev/sda1).

  1. After mounting, the contents of the partition become accessible at the path /mnt/mydisk.

For automatic mounting during system startup, edit the /etc/fstab file, adding a line with the partition description, mount point, filesystem type, and options.

To unmount the partition, use the command:

sudo umount /mnt/mydisk

It is important that the partition is not in use by processes when unmounting.