Thursday, June 18, 2015

How to auto mount disk at startup in Linux/Ubuntu

Step0: format your disk to ext4

sudo mkfs.ext4 /dev/yourdisk

Step1: find the disk UUID

sudo blkid /dev/yourdisk

Step2: register the disk in fstab by using any editor, e.g., vim.

sudo vim /etc/fstab

then add one line into the file

#device                    mountpoint            fstype    options    dump   fsck
yourdiskUUID      /mount_directory        ext4      defaults     0         1

Then reboot it will auto mount.