How do you make HDDs and partitions mount at startup on Ubuntu?

I always keep my media and data files on separate partitions - one 2tb HDD and a 400 odd gig partition. I have been trying to swap the default folder location for the home directory to my other drives.

It works when I change the /home/user_name/.config/user-dirs.dirs file to the directories I want, but only until I reboot the system. I am only assuming that the drives not mounting is the problem with it, but it would be helpful either way. If any one knows another reason for why the directories change back to default each time that would be good also.

Fire up a terminal.

  1. [IMPORTANT] sudo cp /etc/fstab /etc/fstab.old - Create a backup of the fstab file just in case something unwanted happens.

  2. sudo blkid - Note the UUID of the partition you want to automount.

  3. sudo nano /etc/fstab - Copy the following line to the end of the file, save it and reboot afterwards to check if it worked.


A common setup is:

UUID=<uuid> <pathtomount> <filesystem> defaults 0 0

Use lsblk -o NAME,FSTYPE,UUID to find out the UUIDs and filesystems of the partition you want to mount. For example:

├─sda5 swap   498d24e5-7755-422f-be45-1b78d50b44e8
└─sda1 ext4   d4873b63-0956-42a7-9dcf-bd64e495a9ff


UUID=<uuid> <pathtomount> ntfs uid=<userid>,gid=<groupid>,umask=0022,sync,auto,rw 0 0

Examples for the <> variables:

  • <uuid>=3087106951D2FA7E
  • <pathtomount>=/home/data/
  • <userid>=1000
  • <groupid>=1000

Use id -u <username> to get the userid and id -g <username> to get the groupid.

(Note that specifying the sync option can slow down write performance as it disables the cache. async is the default.)

Screenshot of my computer's _fstab_ file

  • 12
    +1'd, fstab tutorial for free: – Andrejs Cainikovs Jul 19 '12 at 10:13
  • Haha!! Thanks, that tutorial's gonna help. – Akshit Baunthiyal Jul 19 '12 at 10:20
  • 4
    Careful about being too prescriptive with the mount options; not everybody's uid & gid will be the default 1000. – IlluminAce Mar 17 '13 at 22:17
  • 5
    use 'id -u <username>' to get the uid and 'id -g <username>' to get the group id. this should be stated in the answer. – jargonjunkie Apr 2 '16 at 20:41
  • 1
    @bbodenmiller sync option should be avoided here. It slows down disk writes because you ask for every byte to be flushed instantly instead of letting your computer optimize that for you. The answer should remove sync – Masadow May 24 '17 at 21:27

If you want GUI - gnome-disks is the command to start Disks application (at least in 13.10).

Select Drive, then partition, then use More actions (cogs icon) button to access 'Edit Mount Options' menu. The rest should be obvious.

  • 22
    Just don't forget to uncheck "Automatic mount options". I was confused because auto-mount was not working even though the "Mount at startup" checkbox was checked in the grayed out UI. – Étienne Aug 15 '16 at 14:41
  • 5
    WAY easier than manually editing fstab. This is the best answer. – wordsforthewise Sep 28 '16 at 3:33
  • 2
    In 16.04 this way mount disks to /mnt instead of /dev – dstonek Dec 2 '16 at 15:54
  • worked for me, thanks! – Francesco Borzì Aug 6 '17 at 11:11
  • 3
    Don't use sudo with GUI tools. gnome-disks will ask for permission when required. – nipunasudha Nov 14 '17 at 11:30

In Ubuntu follow these steps to auto-mount your partition:

  1. Open file manager and look left side on the devices listed.

  2. Choose the device you want to auto-mount on start-up by just clicking it and you will see the folders in the right pane shown for that device (partition), keep this window open.

  3. Go to your desktop Ubuntu search and type disks, you'll see disks shown in results.

  4. Click on disks and disks manager will start.

  5. You will see HDD's listed on the left pane and details of partitions on the right pane for each HDD you have.

  6. Now highlight the partition by clicking it, IMPORTANT (don't set mount on start-up for all partitions as it slows down the system).

  7. Make sure that the partition name you want to auto-mount have the same name by comparing the partitions in disk manager with the open partition window which you opened previously, by looking at the name of device at the top-left part of file manager (opened earlier), and looking the same name of drive or partition in the disks manager at the Contents field of the chosen partition in disks manager.

  8. Now after making sure that you have chosen the correct partition, in disks manager just click more actions icon, sub-menu list will open, choose edit mount options, mount options will open with Automatic mount options = ON, so you turn this off and by default you'll see that mount at start-up is checked and show in user interface is checked, then hit OK and restart your system, after log-in go to file manager you'll see the part you choose to mount at start-up is already mounted.

  • In 16.04 this way mount disks to /mnt instead of /dev – dstonek Dec 2 '16 at 15:57
  • @dstonek -- You have option to specify Mount Point in the Edit Mount Options at the step 8 above . That is, you can tell it to mount in /dev if you want it there.. – gare Apr 10 at 15:47

When the system boots, it checks the file /etc/fstab (which stands for "filesystem table") for the list of partitions to mount automatically.

How to use this file is described here.

In brief:

The syntax of a fstab entry is :

[Device] [Mount Point] [File System Type] [Options] [Dump] [Pass]

You can add your own entries, but you'll need to know the device path (eg, /dev/sdb1), or their UUID (a big long string of numbers) to identify them.

  • 4
    Though a link may theoretically solves the problem, it's a good practice to include essential part in the question – Web-E Jul 19 '12 at 9:29
  • 1
    @Web-E probably meant answer. – Andrejs Cainikovs Jul 19 '12 at 10:11
  • While I would normally agree with you @Web-E, I think that part of the problem is that the scope of "how does /etc/fstab work" is too broad to fully be covered here without being purely prescriptive, and it would be better to teach the concepts. I have added, though, what I think is a good teaser for what an fstab entry is. – thomasrutter Oct 14 '13 at 0:07

Try "usbmount" package

sudo apt-get install usbmount

It will automatically mount USB devices

  • 6
    -1. It would be better to also include instructions on how to use usbmount. Just telling someone "install this software" isn't enough. – Parto Jun 18 '14 at 7:06

Your Answer


By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.