Here's how I do it
- Use
sudo blkid
to get info about the drive you want to be mounted. - Make the folder that it's going to be mounted in. I normally put a folder in
/media/
which has the same name as the drive. This keeps things simple and won't break any symlinks already in place. You do, however, need to unmount the drive first, and of course to make a new folder in/media
you'll need to either be root or use sudo.
I usually do this with:sudo mkdir /media/Data
- Edit
/etc/fstab
(you'll need to be sudo) to add the following lines:
UUID=$DRIVE-ID $FOLDER $TYPE defaults,umask=000 0 0
This line specifies where to find the drive where to mount it and how. You need to replace $DRIVE-ID with the UUID number for the drive you got fromblkid
, replace $FOLDER with the full path to the folder you want the drive to be mounted in and $TYPE with the type of filesystem used on the drive, which you can also get fromblkid
.
I usually add a comment line, so I know what's happening, then this becomes:
# /dev/sda5 - Data
UUID=4820-8D15 /media/Data vfat defaults,umask=000 0 0
That's it. Now whenever you start Ubuntu your drive will already be mounted. If you want to mount it now without rebooting then you can tell Ubuntu to mount everything in the fstab now by using:
mount -a