How to Mount a Drive in Linux
To mount a disk on boot, you will need to enter the disk/partition information in the fstab file. Before this, you should have the uuid of the partition.
1. Create the mount point
Create the mount point (directory) for the new partition. This is often done in /mnt or /media
mkdir /media/partition_name
2. Determine Drive to mount
Using UUID
Get the uuid of the desired partition by listing all partition uuids using
ls -l /dev/disk/by-uuid
Example Output:
lrwxrwxrwx 1 root root 10 Jan 5 07:36 42c03f8b-35e1-40bd-8661-e59606375863 -> ../../sda5
lrwxrwxrwx 1 root root 10 Jan 5 07:36 77c1e034-8557-4d86-9bb4-8cc41c45f379 -> ../../sda6
lrwxrwxrwx 1 root root 10 Jan 5 07:36 bc733608-976a-4982-8849-2445c6167385 -> ../../sda2
lrwxrwxrwx 1 root root 10 Jan 5 07:36 c443bb27-7ffb-4308-8727-f3504d904c0f -> ../../sda3
lrwxrwxrwx 1 root root 10 Jan 5 07:36 f10dee4e-d3af-4703-91c9-3b9cf24a7f81 -> ../../sda1
Use Drive notation
ls -l /dev/sd*
Example Output:
brw-rw—- 1 root disk 8, 0 Jan 5 07:36 /dev/sda
brw-rw—- 1 root disk 8, 1 Jan 5 07:36 /dev/sda1
brw-rw—- 1 root disk 8, 2 Jan 5 07:36 /dev/sda2
brw-rw—- 1 root disk 8, 3 Jan 5 07:36 /dev/sda3
brw-rw—- 1 root disk 8, 16 Jan 5 07:36 /dev/sdb
brw-rw—- 1 root disk 8, 17 Jan 5 07:36 /dev/sdb1
3. Add to fstab
Locate the partition and uuid you want to mount and add it to /etc/fstab
nano /etc/fstab
UUID= 42c03f8b-35e1-40bd-8661-e59606375863 /media/partition_name ext4 errors=remount-ro 0 1
or
/dev/sdb1 /media/partition_name ext4 errors=remount-ro 0 1
example:
/dev/sdb1 /mnt/ssd ext2 defaults 0 0
4. Manual Mount
Manually mount the partition until the next reboot
mount /dev/sda5 /media/partition_name
Comments
So empty here ... leave a comment!