Wednesday, June 26, 2013

Ubuntu - Auto-mount your partitions

I have some partitions and I want to tell the system to mount those partitions automatically whenever my computer restarts. I heard that Ubuntu 13.04 has some great feature that have GUI to make the job easier, Disks. I tried to use it:

1. Open Disks from the Ubuntu Application Launcher, and choose the partition I want, let call it Partition 6.

2. Click the gear icon (settings), choose Edit Mount Options.

3. Turn off Automatic Mount Options and enter the information for my partition. Then, click OK

I'd thought it gonna work, but it's not. I got an error about some wrong options when I mount the partition.

After awhile googling around, I found a thread from the Linux Mint forum which tells me not to use the Disks utilities of Ubuntu, but modifying the fstab directly instead:


Note: You might want to run the following command to make sure it really has that UUID number and that it is in fact formatted to ext3:
sudo blkid -c /dev/null

** Create a mount point for this partition to live in. I'm going to use /mnt/Data but it can be anything you want. Just make sure you use the exact same mount point in fstab:
sudo mkdir /mnt/DATA

** Change this:
/dev/disk/by-uuid/a8232d93-dc61-40a6-941c-5567a1b6134f /mnt/a8232d93-dc61-40a6-941c-5567a1b6134f auto nosuid,nodev,nofail,x-gvfs-show,x-gvfs-name=DATA 0 0

To this:

UUID=a8232d93-dc61-40a6-941c-5567a1b6134f /mnt/DATA ext4 defaults,noatime 0 2

** If the partition is currently mounted unmount it.

** Then run the following command to test for syntax errors and if there are none mount the partition:
sudo mount -a