Although Ubuntu has made it very easy to mount drives in recent versions, it often is simpler if a drive can be mounted when the computer boots. I’ve given below the steps to set a drive or partition to load on startup. This applies to Ubuntu and Linux Mint (and probably most Gnome based Linux distros).
Firstly, you need to establish the system location of your partition. You can either do this via the Terminal or, if you prefer a nice graphical interface, you can install GParted.
Ubuntu Hard Disk Naming
To explain a little further, the standard naming in Ubuntu for hard drives is /dev/sd# or /dev/hd# (sd# is for SATA and removable drives and hd# for IDE drives). The # will change depending on your system. For example, I have three hard drives on my system and they are named as follows:
/dev/sda
/dev/sdb
/dev/sdc
These naming conventions apply to the whole, physical drive. Partitions within these drives will have their own names. My main hard drive (sda) has two partitions and these are called:
/dev/sda1
/dev/sda2
My second hard drive (sdb) has one single partition which utilizes the whole drive and it is called:
/dev/sdb1
How to check the location of your hard disk
If you’re using the Terminal, open it and type:
sudo fdisk -l
Fdisk will output all the disks and partitions on your system. I’m presuming that you know the size of the partition and the file system (eg ext3 or NTFS) and therefore you’ll be able to recognize it from the list (I have a few drives/partitions and it can get a little confusing!) Take note of the path to the drive you want to mount (we’ll say for this example that it is /dev/sdb1). Also take note of the file system being used, as you will need it later.
Create a mount point
Everything in Linux is a file. Even a hard disk! This is a little strange to Windows users but it’s the way it is in Linux. To automatically mount your disk, you have to assign it a directory. The usual place to mount drives (and this includes CD-ROM and USB drives) is in the /media folder located in the root directory. In the terminal, to change to the media directory, type:
cd /media
Decide what you want to call your drive and create a directory in that name. I intend to use mine for Virtual Machine software so I’m going to call it vm. Type the following (changing vm to your drive name):
sudo mkdir vm
Note that Linux is case-sensitive so vm is different to VM and different again to Vm.
Set the drive to mount on boot
For the drive to mount automatically when you start Ubuntu, you need to add it to the fstab file. Firstly, backup your existing fstab file with the following command:
sudo cp /etc/fstab /etc/fstab_backup
Open the fstab using the following command:
sudo gedit /etc/fstab
You need to add a line to the bottom of this file and this depends on the type of file system you are mounting. I have given examples below. In each case, you will need to change the /dev/sdb1 part to the location of your partition (as figured out above). Change the /media/vm part to whatever you called your directory. Save and close the file when you’re done.
For an ext3 Linux partition, use the following: (This works for ext4 too. Just change the file system to ext4):
/dev/sdb1 /media/vm ext3 defaults,errors=remount-ro,users,user_xattr,user 0 0
For an NTFS drive, try this:
/dev/sdb1 /media/vm ntfs-3g defaults,locale=en_US.UTF-8 0 0
For a FAT32 system, try this:
/dev/sdb1 /media/vm vfat umask=000 0 0
Take ownership of the partition
Finally, if this is a Linux partition, you may want to take ownership of it. If you’re just using this drive to store files etc. it quickly becomes a pain when you have to open it as root every time you want to copy over a file. To do this, you need to change the permissions on the folder. The basic code to do this is as follows:
sudo chown -R YourUserName:YourUserGroup /media/YourFolderName
For example, if my user name is mesanna and my drive is called vm, I would type:
sudo chown -R mesanna:mesanna /media/vm
And that should be that! You can reboot your computer if you like to check that it automatically loads up your new drive.

24 Comments
thanks, that was very is to follow and it really works
Yes…this tutorial was very VERY informative. Ive been to a few other websites and they don’t quite fit the bill. You make it so easy…even a caveman can do it. xD Thanks again.
I just have to thank you for the guide, I have used it several times and it is the most well written easily understandable guide available. Thank you.
Thanks! Happy to help
I probably spent an hour or two searching before I stumbled on your instructions. Using them I succeeded in mounting a partition I had created on a virtual disk drive (created with VMware Workstation). A year or two ago I had installed Ubuntu on that virtual drive. Thank you!
If only every Linux guru like you could write simple and clear instructions like yours for Windows users…Microsoft would go bust.
I like your thinking! And thanks for the compliment.
thanks for the instructions……….
like ur way of making things look simpler..
Great instructions. I only have a question about the last bit. How would I know what file system I have NTFS/EXT3/FAT32.
Using EXT3 it doesn ’stick’ after reboot
Thanks,
Joep
@Joep If you open a terminal and type:
Press enter and this should display the file system used on all partitions on your system. Hope this helps!
Perfect!! worked without a hitch… thanks
Hi,
A while ago, but it turned out it sticks using FAT32. So that must be it.
Works now!!
Thanks a mill,
Joep
Glad you got it sorted Joep!
Thanks so much for this how to, it’s as straightforward and easy as it possibly can be.
I used to have to manually mount my share partition before I could play music from it in Banshee, now I don’t have to.
Thank you. That is easy to understand.
thank you mesanna!
that was easy and quick and – it worked perfectly!
you just made me very happy
Hey, nice straightforward guide. I’ll be following it when I get the impetus to do it. Sexy blog theme, BTW. Very classy minimalism.
Woo, thanks
Amazing article and just what I was looking for.
Just one thing though, you dont need to restart/reboot the PC to test the fstab…just type (sudo) mount -a, and it will mount the partitions you have just added.
@M Faraz Thanks for your comment! I know you can mount drives with the sudo mount command, but I suggested rebooting so that you can check they mount automatically, that was all
I have been using ubuntu for one year now, and this is one the best tutorials I have come across. Much more elegant than most ubuntuforums posts. The partition mounts as it should, and I learned a bit about Linux file systems at the same time. Please consider writing more tutorials such as; partitioning a usb thumbdrive, grub/grub2 customization, etc.
Thank you!
Brilliant!
Thanks so much, works perfect on Linux Mint 8.
Thanks! It worked perfectly, and I have no experience with linux whatsoever
One Trackback
[...] Mesanna’s Weblog Confessions of a Linux Newbie Contact Me « How to mount a partition automatically in Ubuntu Linux [...]