Mount drive at startup

Posted on: October 10, 2007

This is partially reprinted from the Ubuntu community documentaion

Format the Partition via Command Line

To format the disk as ext3 filesystem (best for use under Ubuntu):

sudo mke2fs -j /dev/hdd1

Substitute “/dev/hdd1” with your own drive’s path.


Modify reserved space (optional)

When formatting the drive, 5% of the drive’s total space is reserved for the super-user (Root) so that the operating system can still write to the disk even if it is full. However, for disks that only contain data, this is not necessary.

You can ajust the percentage of reserved space with the “tune2fs” command, like this:

sudo tune2fs -m 1 /dev/hdd1

This example reserves 1% of space – change this number if you wish.

Using this command does not change any existing data on the drive. You can use it on a drive which already contains data.


Mount the Drive

You can choose to have the drive mounted automatically each time you boot the computer, or manually only when you need to use it.

Automatic Mount at Boot

You’ll need to edit /etc/fstab:

gksudo gedit /etc/fstab

Add this line to the end:

/dev/hdd1 /media/mynewdrive ext3 defaults 0 2

The “2” at the end instructs your system to run a quick file system check on the hard drive at every boot. Changing it to “0” will skip this. Run ‘man fstab’ for more info here.
You can now run “sudo mount -a” (or reboot the computer) to have the changes take effect.

If you want to allow a normal user to create files on this drive, you can either give this user ownership of the top directory of the drive filesystem: (replace USERNAME with the username)

sudo chown -R USERNAME:USERNAME /media/mynewdrive

or in a more flexible way, practical if you have several users, allow for instance the users in the plugdev group (usually those who are meant to be able to mount removable disks, desktop users) to create files and sub-directories on the disk:

sudo chgrp plugdev /media/mynewdrive
sudo chmod g+w /media/mynewdrive
sudo chmod +t /media/mynewdrive

The last “chmod +t” adds the sticky bit, so that people can only delete their own files and sub-directories in a directory, even if they have write permissions to it (see man chmod).

Manually Mount

Alternatively, you may want to manually mount the drive every time you need it.

For manual mounting, use the following command:

sudo mount /dev/hdd1 /media/mynewdrive

When you are finished with the drive, you can unmount it using:

sudo umount /media/mynewdrive


6 Responses to "Mount drive at startup"


Thanks for the how-to, but I have a question: when I do [sudo mount /dev/hdd1 /media/mynewdrive] mount answers “fuse: failed to access mountpoint /media/mynewdrive: No such file or directory”. I could just make a new file for the drive, but how about unmounting it and mounting with another application or something? Is there a way to manually make mount create the new folder or an instruction for the fstab file to run at startup and do it “elegantly”?


Could you email me with any tips about how you made your blog site look like this , I would appreciate it.

Good day! I just wish to offer you a big thumbs up for your excellent information you have right here on this post.
I am returning to your website for more soon.

I have fun with, cause I discovered exactly what I was having a look for.

You’ve ended my 4 day lengthy hunt! God Bless you man. Have a great day. Bye

My spouse and I stumbled over here from a different web page and thought I
should check things out. I like what I see so now i am following you.
Look forward to going over your web page yet again.

Usually I do not learn post on blogs, but I wish to say that this write-up very
pressured me to try and do it! Your writing style has been surprised me.
Thank you, very nice article.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: