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
2  
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
add comment

4 Answers

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
4  
+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
add comment

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
3  
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
add comment

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
add comment

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
add comment

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.