Mounting Linux Partitions Manually and at boot

To mount a partition, we first need a folder to mount it into. I created a folder called ‘company’ in /mnt/.

If we want to mount /dev/sbd1, we use the mount command.

mount -t ext4 /dev/sbd1 /mnt/company

-t is to specify the file type. This is not required but if you know it you should specify it. You also need to run this as root or with sudo.

To unmount the partition, you can use the umount command.

umount /mnt/company

You will need to run this as root or with sudo.

To automatically mount a partition on boot up, you need to edit the /etc/fstab file

sudo nano /etc/fstab

Add a line as in the image above. the syntax is described in the file at the top.

‘Type’ is the filesystem used. Options should be set to ‘defaults’. ‘Dump’ should be set to 0 and ‘Pass’ should be 2 for anything not the primary disk.

If you reboot the machine after this the disk should automatically mount. Or you can mount it without rebooting by using the mount command.

sudo mount -a

Leave a Reply

Your email address will not be published. Required fields are marked *