Introduction

I had started to really use Linux more and more so decided why not use Linux for my desktop as well? However I did not want to get rid of Windows, I am not a Linux fan-boy, I still like Windows but just like to learn as much as possible about all things IT and the best way to learn is to dive in and try everything. This left me with a load of content on separate disk drives which I did not need to reproduce in the Linux file system and waste a load of disk space.

For example, The SSD I had used to install Linux actually contained a whole load of virtual machines (I cannot express how much better VM’s are on an SSD, in fact yes I can, they are much faster), I created three separate partitions for the root, swap and home directories. This is the best method as it means if Linux gets destroyed you can just reinstall the root OS or try another distro without disturbing any personal info and job done. I do however have some other disks used in windows, a 2 TB disk for backups, a 2 TB disk for all data including music, documents, pictures etc. I also had that original SSD partition which as mentioned is used for virtual box virtual machines. All of these are in the Windows NTFS file system which is fine cause Linux can read pretty much any file system you throw at it!

Solution

Now you when you boot into Linux Mint, you have your home directories as you do in Windows. In my instance however I did not want to keep manually mounting the drives because I was using symbolic links to access the content in my Windows folders to avoid the aforementioned replication of data. These symbolic links are very easy to create. You need to create them using the following command:

ln -s /home/dave/Pictures "/media/dave/Data Disk/Users/Dave/Pictures"

The quotes are needed in my example as I have a space in the path. Once this is done you will find when you now select your Linux Mint home folder for pictures, it will link you across to the drive that holds all of your pictures. This can be redone for any other useful directories e.g. Music, Videos, Documents etc. as I have done. As it stands though when you boot into Linux, those symbolic links won’t work until you manually mount the drives.

The next stage though is the auto mounting at boot which is very easy. This is done through the /etc/fstab file. There other ways but I like the CLI as it is clean and once you know what you’re doing it is one step closer to really knowing your stuff. To edit this file, it needs to be opened in a text editor via sudo or as the root user. First however you need to find out the universally unique identifier for the partition in question. The command for this is:

sudo blkid

This will chuck out a load of info like so:

/dev/sda1: LABEL="System Reserved" UUID="BEA0282743AB622E" TYPE="ntfs" 
 /dev/sda2: LABEL="OS SSD" UUID="4B4A47E1468F797C" TYPE="ntfs" 
 /dev/sdb1: LABEL="VM SSD" UUID="4876C50D76C4FCA6" TYPE="ntfs" 
 /dev/sdb5: UUID="b640b3b5-4a6e-48a6-b69c-fe52c49952a7" TYPE="swap" 
 /dev/sdb6: LABEL="home" UUID="576a6587-1bb0-4a18-a2dd-667219124600" TYPE="ext4" 
 /dev/sdb7: UUID="3f2296d6-b2c0-4751-83e3-f8d61b4e9b86" TYPE="ext4" 
 /dev/sdc1: LABEL="Data Disk" UUID="0EBC8922BC890605" TYPE="ntfs" 
 /dev/sdd1: LABEL="Backup Disk" UUID="7A269BC4269B8035" TYPE="ntfs" 
 /dev/sde1: LABEL="UUI" UUID="1E18-2E36" TYPE="vfat"

Now you have this info you can modify the file. The file has a structure which needs to be followed and a space is used as the command separator. Enter the details for your drive as below substituting the bold text for your unique details:

# /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>
 # / was on /dev/sdb7 during installation
 UUID=3f2296d6-b2c0-4751-83e3-f8d61b4e9b86 / ext4 errors=remount-ro 0 1
 # /home was on /dev/sdb6 during installation
 UUID=576a6587-1bb0-4a18-a2dd-667219124600 /home ext4 defaults 0 2
 # swap was on /dev/sdb5 during installation
 UUID=b640b3b5-4a6e-48a6-b69c-fe52c49952a7 none swap sw 0 0
 # Data disk Contains Pictures, Video, Music
 UUID=0EBC8922BC890605 /media/dave/Data\040Disk ntfs defaults 0 0
 # VM SSD Contains All Virtual Machines
 UUID=4876C50D76C4FCA6 /media/dave/VM\040SSD ntfs defaults 0 0
 # Backup Disk Contains all Backups
 UUID=7A269BC4269B8035 /media/dave/Backup\040Disk ntfs defaults 0 0

There is a gotcha which is if you need to insert a space in the mount point, in the fstab file you will need to substitute the space for the following characters:

\040

as I have done above. Once you have configured the file, save the file and make sure your file system mounts those NTFS disks at boot. Actually very easy to do and incredibly useful.

I also mentioned I had virtual machines on the same SSD. You may be thinking can I run those VM’s in Linux even though they were created in Windows. The answer is a resounding yes! Linux has no problem starting those machines, the only general necessary step is to create a different network adapter for Windows and Linux as each OS will name them and use different drivers. Now you can run your Windows VM under Linux Mint instead of the other way round.

Enjoy.

Auto Mounting Drives on Linux Mint
Tagged on:

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.