Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

How do you make HDDs and partitions mount at startup with the ubuntu system?

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.

share|improve this question
3  
Edit the /etc/fstab file, here are useful links that has answers to your question: mount a drive on startup and mount ntfs drive on startup‌​. –  Peachy Jul 18 '12 at 3:12

6 Answers 6

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.

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

Examples for the <> variables:

<uuid>=3087106951D2FA7E

<pathtomount>=/home/data/

<file system>=ntfs-3g (for an NTFS partition)

<userid>=1000

<groupid>=1000

(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

share|improve this answer
5  
+1'd, fstab tutorial for free: linuxstall.com/fstab –  Andrejs Cainikovs Jul 19 '12 at 10:13
    
Haha!! Thanks, that tutorial's gonna help. –  Akshit Baunthiyal Jul 19 '12 at 10:20
    
hey sorry it has been a while I tried the solutions provided but none worked, with psydm I turned on the mount at start up function but it didnt work and one hdd didnt have that option, I also tried changing the fstab file both through the file itself and using the gedit function still nothing is there anything else that would do it? –  Harley Baker Jul 31 '12 at 4:22
2  
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
    
Make sure you read more in to fstab. For me the example settings resulted in write speeds of KB/s. See help.ubuntu.com/community/Fstab for some helpful tips. –  bbodenmiller Nov 15 at 8:27

Editing fstab by hand could be a bit more difficult.

If you want to use GUI tool, use pysdm Install pysdm

share|improve this answer
4  
How is that less dangerous than simply editing the fstab yourself? In my book, actually learning what you are doing is what makes something "less dangerous". –  neon_overload Jul 19 '12 at 0:21
1  
Sorry. Poor choice of word. –  Web-E Jul 19 '12 at 9:28
    
pysdm is great, although I'd echo neon_overload's sentiment, and understanding at least where the changes will be made is a good idea. I'd also like to point out that the utility is called "Storage Device Manager", which is handy to know when you're trying to launch it by name Typing "pysdm" in the HUD doesn't work. "Stor" will get you there! –  John T Oct 20 '12 at 10:27

If you want GUI - sudo 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.

share|improve this answer

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.

share|improve this answer
2  
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
    
@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. –  neon_overload Oct 14 '13 at 0:07

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.

share|improve this answer

Try "usbmount" package

sudo apt-get install usbmount

It will automatically mount USB devices

share|improve this answer
1  
-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 at 7:06

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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