Auto Mount Partitions on Boot (also Windows partitions)

Write tutorials and howtos in here
There are more tutorials here http://community.linuxmint.com/tutorial/welcome
Forum rules
Do not start a support topic here please. Before you post please read this

Re: Auto Mount Partitions on Boot

Postby Fred on Tue Aug 25, 2009 1:39 am

I guess I prefer mount in /mnt, I prefer to keep /media for the media which mount on the fly, like a USB stick for example.

/mnt is the old time, traditional mount point. Then /media came along. In Ubuntu/Mint, unless it has changed in the last release, /media contains the default mount points for fixed, mount on boot, storage. /mnt is where the machine generated boot line for on-the-fly mounts go, ie. USB sticks. The mount point then gets placed in /media. I was just trying to stay with the Ubuntu/Mint convention.

I left the dump bit 0 because I don't know if the user is using that function. Most probably not. There are a number of ways to configure dump. I figured if anybody was using it, or decided to use it, they should know enough to know how and what partitions to change to meet their needs. Doing a dump by mistake of a 750 Gig. partition could have disastrous results on an install if not specified properly. So I just played it safe. :-) Granted, it was a somewhat arbitrary decision.

Fred
Insanity: Doing the same thing over and over and each time expecting a different result.

Democracy is 2 wolves and a lamb voting on the menu. Liberty is an armed lamb protesting the electoral outcome. A Republic negates the need for an armed protest.
User avatar
Fred
Level 10
Level 10
 
Posts: 3356
Joined: Fri Jan 04, 2008 11:59 am
Location: NC USA

Linux Mint is funded by ads and donations.
 

Re: Auto Mount Partitions on Boot

Postby linuxviolin on Tue Aug 25, 2009 9:36 am

Hi Fred! Always clear, informative and full of knowledge, this is how we love the Fred :lol: (sorry for this little joke, but it's true! :P )

/mnt is the "historic" mount point we/I retain for file systems mounted manually. /media is where is mounted the removable devices managed by the system automatically. For cdrom/dvd and floppy, I use a fixed mount point, so defined in fstab, in /mnt. But the place of the mount point does not really matter if it is properly done. And ok about the Ubuntu/Mint convention... :-)

About dump, maybe I can be with you.

Fred wrote:I figured if anybody was using it, or decided to use it, they should know enough to know how and what partitions to change to meet their need

Yes, probably. :-)

Just for the record, Dump = 1 is the default for CentOS, and so for Red Hat, at least. But it's not the same kind of distro than Ubuntu/Mint... ;-)
Last edited by linuxviolin on Tue Aug 25, 2009 11:27 am, edited 1 time in total.
K.I.S.S. ===> "Keep It Simple, Stupid"
"Simplicity is the ultimate sophistication." (Leonardo da Vinci)
"Everything should be made as simple as possible, but no simpler." (Albert Einstein)
User avatar
linuxviolin
Level 8
Level 8
 
Posts: 2055
Joined: Tue Feb 27, 2007 6:55 pm
Location: France

Re: Auto Mount Partitions on Boot

Postby altair4 on Tue Aug 25, 2009 10:13 am

Since we're all voicing an opinion...........

The system will automatically mount all those external USB storage devices to /media and create a mount ICON on the desktop. That's fine with me. If I mount something through fstab I put the mountpoint in /mnt so that it doesn't create a mount icon on the desktop.

I also place Windows partitions defined in fstab in a /windows mount point ( which also does not add a mount icon to the desktop ). I have been told that that this should never be done but I've never been given an explanation as to why. Is it just an aesthetics thing in that it's not part of the linux hierarchy or is there an actual technical reason for this?
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
altair4
Level 15
Level 15
 
Posts: 5514
Joined: Tue Feb 03, 2009 10:27 am

Re: Auto Mount Partitions on Boot

Postby Fred on Tue Aug 25, 2009 8:48 pm

altair4 wrote:
Is it just an aesthetics thing in that it's not part of the linux hierarchy ... ?

For the most part, yes. :-)

Fred
Insanity: Doing the same thing over and over and each time expecting a different result.

Democracy is 2 wolves and a lamb voting on the menu. Liberty is an armed lamb protesting the electoral outcome. A Republic negates the need for an armed protest.
User avatar
Fred
Level 10
Level 10
 
Posts: 3356
Joined: Fri Jan 04, 2008 11:59 am
Location: NC USA

Re: Auto Mount Partitions on Boot (also Windows partitions)

Postby ecronic on Fri Sep 18, 2009 12:43 pm

Fred wrote:Introduction:

Lately I have seen a number of people trying to get partitions to mount on boot. This is understandable since Ubuntu, hence Mint, does not auto mount all partitions by default anymore. There is good information on this subject in the wiki but I still see lots of questions so either people aren't understanding or they are not searching the wiki for answers before posting. My purpose here is to give you a quick reference for auto mounting on boot, the three most common partition types.


Discussion:

In order to auto mount a partition on boot, two criteria must be met. First, you must have a folder somewhere in the Linux file system to be used as a mount point. It can be named anything you wish. By convention, it should be located in /media and/or /home, but it could be placed almost anywhere you wish. I would urge you to refrain from putting it in other places as it is almost always better to stick with the assumptions that time has proven to be the most practical and serviceable.

The second criteria is you must put the appropriate mounting lines in your /etc/fstab file to bind or mount the partition to the folder you have chosen to be the mount point. The fstab file is run on system boot and does the mounting operation automatically as defined therein.

There are currently three partition identifiers in common usage. The legacy /dev/sdxx identifier has been around since dirt was still clean. This is the identifier you see on the far left of the Gparted partition table screen. With the mixed use of multiple types of storage media this type of identifier can present some problems so other unique identifiers have been developed.

Example: /dev/sda3 /home/fred/data ext3 ...

Label is an alternative partition identifier that I personally favor that uses readable text as the unique identifier. The easiest way to assign text labels to partitions is probably to use one of the later versions of Gparted. There is an option to assign a text label to a selected partition in the GUI.

Example: LABEL=Data1 /home/fred/data ext3 ...

The third method, which is the default used by Ubuntu and Mint, is UUID. UUID is a string of characters, letters numbers, generated by the computer to uniquely identify a partition. The UUID of a partition can be found by typing in a terminal:

sudo vol_id -u /dev/sdxx

To get a listing of all the UUIDs in the system type in a terminal:

sudo blkid

Example: UUID=010619e3-7c2f-43c3-b71f-133f736c8bff /home/fred/data ext3 ...


Instructions:

I will use the CLI to do this as it is faster, and more universal to the various flavors of Mint. If you look at the line you will be pasting into the terminal you can probably figure out what it is doing. In the instructions below I will use the legacy partition identifiers and place the mounting folder in my home folder or in the /media folder. You can of course modify the instructions for your own purposes if you wish. Be sure to substitute your user name in place of mine and put the right partition designator in the command.

Be sure to modify the parts in bold to match your system.

To auto mount an ntfs Windows partition in your /home open a terminal and type:

mkdir /home/fred/Windows

sudo su

echo "/dev/sdxx /home/fred/Windows ntfs defaults,umask=007,gid=46 0 0" >> /etc/fstab


To auto mount an ntfs Windows partition in /media open a terminal and type:

sudo mkdir /media/Windows

sudo su

echo "/dev/sdxx /media/Windows ntfs defaults,umask=007,gid=46 0 0" >> /etc/fstab


To auto mount a fat32 data partition in your /home open a terminal and type:

mkdir /home/fred/Data

sudo su

echo "/dev/sdxx /home/fred/Data vfat umask=0000,uid=1000,gid=1000,auto,rw,users 0 0" >> /etc/fstab


To auto mount a fat32 data partition in /media open a terminal and type:

sudo mkdir /media/Data

sudo su

echo "/dev/sdxx /media/Data vfat umask=0000,uid=1000,gid=1000,auto,rw,users 0 0" >> /etc/fstab


To auto mount an ext3 data partition in your /home open a terminal and type:

mkdir /home/fred/Data

sudo su

echo "/dev/sdxx /home/fred/Data ext3 defaults,noatime 0 2" >> /etc/fstab


To auto mount an ext3 data partition in /media open a terminal and type:

sudo mkdir /media/Data

sudo su

echo "/dev/sdxx /media/Data ext3 defaults,noatime 0 2" >> /etc/fstab


The mounting options I used above are typical and can be changed to meet your needs, if you so choose and know what you are doing. Be careful transcribing the above commands. Typos are not allowed. All the spaces and punctuation are required. There are no returns in the above lines.

I hope this is helpful to you and will take some of the mystery out of auto mounting partitions on boot.

Fred



Booting Linuxmint Gloria from External USB HDD - 500GB

Hi Fred,

First off thanks very much for a detailed guide on mounting.

Im new to linux and am sure that I would be using it sometime in future. I have installed the above mentioned on my usb drive. I have also selected my bootloader as the / partition on my external hard drive. But when I boot from my usb drive it says;

Loading GRUB 1.5

Loading GRUB, Please wait...
Error 22

Could you please guide me as to what I need to do now?

My intention is to keep everything on the usb hdd i.e. when the hdd is connected it should load into linux and when its disconnected into Windows Vista.

Thanks
Ecronic
ecronic
Level 1
Level 1
 
Posts: 10
Joined: Thu Sep 17, 2009 2:09 pm

Re: Auto Mount Partitions on Boot (also Windows partitions)

Postby moshari on Tue Oct 06, 2009 9:02 am

Hi all, it's been a while but other matters have kept me away from my learning curve.

I hope that someone is still watching this thread as unfortunately what I thought was fine & dandy is not quite right.

In short I have created a LV that using the basic instructions above works & auto mounts correctly with each & every boot but under the normal user I can only read the files / directories - NO Write access at all. If I use terminal and sudo su I can make changes as well to the LV but as normal user, feel free to look but don't touch.

I have done a fair bit of searching for answers but only have found little clues along the way. Below are the only 2 things that mounted the drive that worked for me but still no RW just R - fstab in /etc is what I have been editing of course.

/dev/akbtorrent/Torrents /home/alex/Downloads ext3 defaults,noatime 0 2
or
/dev/akbtorrent/Torrents /home/alex/Downloads ext3 rw,user,auto, 0 2
As I said both of these mount the drive but no W just R, if I remark out these I can change the /home/alex/downloads folder as much as I like but of coarse this is not changeing the LV at all. From what I had read previously I thought that I would have full RW because the mount point is owned by the user wthl full access except when this LV is mounted to the download folder.

Sorry not sure what other info would help or is needed for an answer.

Please help, the dent in my forehead is going to start bleeding soon.
Last edited by moshari on Tue Oct 06, 2009 11:52 pm, edited 1 time in total.
moshari
Level 1
Level 1
 
Posts: 8
Joined: Sun Jun 14, 2009 1:13 am
Location: Melbourne, Australia

Re: Auto Mount Partitions on Boot (also Windows partitions)

Postby moshari on Tue Oct 06, 2009 11:47 pm

Hi again,
I finally worked it out, I was concentrating on the /home/alex/Downloads folder and missing the point of ownership.
I used the following to resolve the issue
"sudo su"
"chown -R alex:alex /dev/akbtorrent/Torrents"
This solved the issue straight away no reboot needed.

More info on chown thanks to Fred viewtopic.php?f=55&t=27279&p=158834&hilit=fred+numerical#p158834

Thanks to all for your fantastic past & future support, without you all guys like me would never see that flicker of light at the end of the tunnel. :D
moshari
Level 1
Level 1
 
Posts: 8
Joined: Sun Jun 14, 2009 1:13 am
Location: Melbourne, Australia

Re: Auto Mount Partitions on Boot (also Windows partitions)

Postby David Hunter on Sat Oct 31, 2009 8:44 pm

Oh, Fred, I pray to thee to deliver me from my auto-mounting woes!
Lol, no but obviously we all have a great reverence for you, Fred.

I'm trying to mount an NTFS partition on my PC.
This works in fstab:

/dev/sda10 /home/david/Music ntfs defaults,umask=007,gid=46 0 0

But I'd like to get a folder inside that partition to mount into my Music folder. The folder on the partition is also called "Music".
So I tried

/dev/sda10/Music /home/david/Music ntfs defaults,umask=007,gid=46 0 0

But that didn't work. Do you know of a way of mounting that folder inside the /home/Music folder?

Thanks for the guide and help! :)
Image
Thanks beyecixramd!

Husse wrote:Actually I've never broken a Linux I have managed to install - but there are a few I never managed to install :)
David Hunter
Level 3
Level 3
 
Posts: 131
Joined: Sat Sep 26, 2009 9:03 am
Location: Melbourne, Australia

Re: Auto Mount Partitions on Boot (also Windows partitions)

Postby Fred on Sun Nov 01, 2009 9:24 am

David Hunter,

There are several ways to go about this but the easiest to understand would probably be to mount sda10, as sda10, in /media instead of your home.

Then create a symlink in your home called Music that points to the Music folder on sda10.

I am going to assume you now know how to mount sda10 in /media, and have done so. Then in a terminal:

cd /home/david

......... .......... target ........... symlink
ln -sf /media/sda10/Music Music

If you have a problem accessing your music, which you probably will, run the ownership command below.

sudo su

chown -R david:david /media/sda10/Music

I hope this has been helpful. If I confused you post back.

Fred
Insanity: Doing the same thing over and over and each time expecting a different result.

Democracy is 2 wolves and a lamb voting on the menu. Liberty is an armed lamb protesting the electoral outcome. A Republic negates the need for an armed protest.
User avatar
Fred
Level 10
Level 10
 
Posts: 3356
Joined: Fri Jan 04, 2008 11:59 am
Location: NC USA

Re: Auto Mount Partitions on Boot (also Windows partitions)

Postby altair4 on Sun Nov 01, 2009 9:45 am

Fred, could you also do something like this in fstab?

/dev/sda10 /media/sda10 ntfs defaults,umask=007,gid=46 0 0
/media/sda10/Music /home/david/Music auto bind 0 0

Making sure that the the second line, which is "Music" specific, follows the first line, which is device specific, in fstab.

Or have I not thought something through :?:
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
altair4
Level 15
Level 15
 
Posts: 5514
Joined: Tue Feb 03, 2009 10:27 am

Re: Auto Mount Partitions on Boot (also Windows partitions)

Postby Fred on Sun Nov 01, 2009 10:11 am

altair4,

I don't see any reason right off the top of my head why this shouldn't work. The only question that occurs to me would be related to NTFS-3g, as that is what we are actually using to recognize and manipulate this partition.

I don't have or use any NTFS file systems so I can't easily test it. Try it and see, if you have a NTFS partition. Post back your results. I would be interested in the outcome. Good question. :-)

Fred
Insanity: Doing the same thing over and over and each time expecting a different result.

Democracy is 2 wolves and a lamb voting on the menu. Liberty is an armed lamb protesting the electoral outcome. A Republic negates the need for an armed protest.
User avatar
Fred
Level 10
Level 10
 
Posts: 3356
Joined: Fri Jan 04, 2008 11:59 am
Location: NC USA

Re: Auto Mount Partitions on Boot (also Windows partitions)

Postby altair4 on Sun Nov 01, 2009 10:36 am

After "shooting from the hip" in earlier posts I did test it on an ntfs partition then mounted it using a "mount -a" before posting. I just now did a reboot to make sure there wasn't a timing issue and it appears to work:

Using the example in my post /home/david/Music is mounted as owner:group = david:plugdev with read/write access to both. It follows the permissions set in the previous mount of the sda10 partition in media.

I just didn't know if there where any repercussions in doing something like this because I only remember doing this a while ago and I'm becoming old and feeble minded :lol:

EDIT: I told you I was getting feeble minded :wink: . The owner:group was root:plugdev with read/write access to both owner and group and "david" is a member of the plugdev group.
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
altair4
Level 15
Level 15
 
Posts: 5514
Joined: Tue Feb 03, 2009 10:27 am

Re: Auto Mount Partitions on Boot (also Windows partitions)

Postby Fred on Sun Nov 01, 2009 5:52 pm

altair4,

I don't remember teaching you anything about binding. You have been doing some reading on your own. Good for you. :-)

Keep it up and you will become my go-to person when I get in trouble. :-)

Fred
Insanity: Doing the same thing over and over and each time expecting a different result.

Democracy is 2 wolves and a lamb voting on the menu. Liberty is an armed lamb protesting the electoral outcome. A Republic negates the need for an armed protest.
User avatar
Fred
Level 10
Level 10
 
Posts: 3356
Joined: Fri Jan 04, 2008 11:59 am
Location: NC USA

Re: Auto Mount Partitions on Boot (also Windows partitions)

Postby altair4 on Sun Nov 01, 2009 6:30 pm

Fred wrote:altair4,
I don't remember teaching you anything about binding. You have been doing some reading on your own. Good for you. :-)
Keep it up and you will become my go-to person when I get in trouble. :-)
Fred


I doubt that will ever happen. But like I keep trying to tell my wife, I'm more than just a pretty face :lol:
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
altair4
Level 15
Level 15
 
Posts: 5514
Joined: Tue Feb 03, 2009 10:27 am

Re: Auto Mount Partitions on Boot (also Windows partitions)

Postby Fred on Sun Nov 01, 2009 6:41 pm

altair4 wrote:
But like I keep trying to tell my wife, I'm more than just a pretty face :lol:

I made the mistake of telling my wife that one time too. She laughed hysterically for about an hour, then stopped to think about it for a min. and started to cry. :-)

Fred
Insanity: Doing the same thing over and over and each time expecting a different result.

Democracy is 2 wolves and a lamb voting on the menu. Liberty is an armed lamb protesting the electoral outcome. A Republic negates the need for an armed protest.
User avatar
Fred
Level 10
Level 10
 
Posts: 3356
Joined: Fri Jan 04, 2008 11:59 am
Location: NC USA

Re: Auto Mount Partitions on Boot (also Windows partitions)

Postby David Hunter on Sun Nov 01, 2009 7:07 pm

Fred wrote:altair4 wrote:
But like I keep trying to tell my wife, I'm more than just a pretty face :lol:

I made the mistake of telling my wife that one time too. She laughed hysterically for about an hour, then stopped to think about it for a min. and started to cry. :-)

Fred

lol. I'm too young to have a wife, so I don't have to worry about that sort of thing... yet.

Just tried Altair's idea... directly copied from his post:

/dev/sda10 /media/local ntfs defaults,umask=007,gid=46 0 0
/media/sda10/Music /home/david/Music auto bind 0 0

into fstab. Upon rebooting, partition doesn't mount and when I go to do so manually I get an error message saying that I don't have permissions to mount the partition (and because it's not mounted, I can't run Fred's chown command)...

I'm about to try

/dev/sda10 /media/local ntfs defaults,umask=007,gid=46 0 0

and then the symlink, then I'll reboot and let you know how it goes.. but I saw you two are online and chatting now, so figured I'd post a reply now.

Thanks for your help.
Image
Thanks beyecixramd!

Husse wrote:Actually I've never broken a Linux I have managed to install - but there are a few I never managed to install :)
David Hunter
Level 3
Level 3
 
Posts: 131
Joined: Sat Sep 26, 2009 9:03 am
Location: Melbourne, Australia

Re: Auto Mount Partitions on Boot (also Windows partitions)

Postby David Hunter on Sun Nov 01, 2009 7:16 pm

OK just tried

/dev/sda10 /media/local ntfs defaults,umask=007,gid=46 0 0

and I'm still getting no auto-mount and the mount permissions error.
(Note my use of /media/local instead of /sda10 - merely for aesthetic purposes...). Do I need to make a folder called "local" (or "sda10") inside the media folder first for this to work?

(Going to try that now and reboot).
Image
Thanks beyecixramd!

Husse wrote:Actually I've never broken a Linux I have managed to install - but there are a few I never managed to install :)
David Hunter
Level 3
Level 3
 
Posts: 131
Joined: Sat Sep 26, 2009 9:03 am
Location: Melbourne, Australia

Re: Auto Mount Partitions on Boot (also Windows partitions)

Postby David Hunter on Sun Nov 01, 2009 7:20 pm

OK silly me, making the folder makes it work now. :)
Going to try altair's 2nd line now in fstab.
Image
Thanks beyecixramd!

Husse wrote:Actually I've never broken a Linux I have managed to install - but there are a few I never managed to install :)
David Hunter
Level 3
Level 3
 
Posts: 131
Joined: Sat Sep 26, 2009 9:03 am
Location: Melbourne, Australia

Re: Auto Mount Partitions on Boot (also Windows partitions)

Postby Fred on Sun Nov 01, 2009 7:22 pm

David Hunter,

Did you create a folder in /media called local first? You always need a folder that exists in the file system before you can mount anything to it. Go back and re-read my first post at the beginning of the thread.

EDIT: ok... I see you found it while I was posting. :-)

Fred
Insanity: Doing the same thing over and over and each time expecting a different result.

Democracy is 2 wolves and a lamb voting on the menu. Liberty is an armed lamb protesting the electoral outcome. A Republic negates the need for an armed protest.
User avatar
Fred
Level 10
Level 10
 
Posts: 3356
Joined: Fri Jan 04, 2008 11:59 am
Location: NC USA

Re: Auto Mount Partitions on Boot (also Windows partitions)

Postby David Hunter on Sun Nov 01, 2009 7:34 pm

Fred wrote:David Hunter,

Did you create a folder in /media called local first? You always need a folder that exists in the file system before you can mount anything to it. Go back and re-read my first post at the beginning of the thread.

EDIT: ok... I see you found it while I was posting. :-)

Fred


Looks like we had the same thought at the same time.
Yep, all's working perfectly now.
Thanks Fred and altair for your help. :D
Image
Thanks beyecixramd!

Husse wrote:Actually I've never broken a Linux I have managed to install - but there are a few I never managed to install :)
David Hunter
Level 3
Level 3
 
Posts: 131
Joined: Sat Sep 26, 2009 9:03 am
Location: Melbourne, Australia

Linux Mint is funded by ads and donations.
 
PreviousNext

Return to Tutorials / Howtos

Who is online

Users browsing this forum: No registered users and 13 guests