Ubuntu Mount Disk

May 24, 2019

Edit /etc/fstab.

sudo nano /etc/fstab

Check available disk.

sudo lsblk --fs
NAME   FSTYPE  LABEL          UUID                                 MOUNTPOINT
├─sda1 swap                   ecf07613-c326-4ca9-8c9a-2559f84f8a23 [SWAP]
└─sda5 ext4                   540a3216-c9af-435d-8d98-be2fe1760f22 /
└─sdb1 ext4    code           0e36bdcf-377c-4a3d-b54c-3639af0766f8 /media/disk02
└─sdc1 ext4    data           a055c10a-5028-4c38-a8f7-621b7139cd2f /media/disk03
└─sdd1 ext4    data2          dd1dd686-a474-4199-8890-6d894ba4d744 /media/disk04

Add an entry for the new disk using name or UUID

/dev/sdd1 /media/disk04/ ext4 defaults   0       2


UUID=dd1dd686-a474-4199-8890-6d894ba4d744 /media/disk04/ ext4 defaults   0       2

Fstab File Configuration

Enable or disable backing up of the device/partition (the command dump). This field is usually set to 0, which disables it. Controls the order in which fsck checks the device/partition for errors at boot time. The root device should be 1. Other partitions should be 2, or 0 to disable checking.

# /etc/fstab: static file system information.
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
proc            /proc           proc    nodev,noexec,nosuid 0       0
# / was on /dev/sda5 during installation
UUID=540a3216-c9af-435d-8d98-be2fe1760f22   /               ext4    errors=remount-ro   0   1
# swap was on /dev/sda1 during installation
UUID=ecf07613-c326-4ca9-8c9a-2559f84f8a23   none            swap    sw          0   0
# /dev/sdb1 - disk02
UUID=0e36bdcf-377c-4a3d-b54c-3639af0766f8   /media/disk02   ext4    defaults    0   2
# /dev/sdc1 - disk01
UUID=a055c10a-5028-4c38-a8f7-621b7139cd2f   /media/disk03   ext4    default     0   2
# new disk04
UUID=dd1dd686-a474-4199-8890-6d894ba4d744   /media/disk04   ext4    defaults    0   2

Moun the new /etc/fstab entry.

sudo mount -a

NOTE: If bump into error mount: mount point /media/disk04/ does not exist, create the directory sudo mkdir /media/disk04.

You might want to create a symbolic link to point to this new disk.

cd /
sudo ln -s /media/disk04 data
cd /data

You might want to rename disk volume name.

NOTE: Restart to test if the disk is auto mounted.

This work is licensed under a
Creative Commons Attribution-NonCommercial 4.0 International License.