LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices

Reply
 
Search this Thread
Old 09-30-2008, 11:56 PM   #1
xmrkite
Member
 
Registered: Oct 2006
Location: California, USA
Distribution: Mint 16, Lubuntu 14.04, Mythbuntu 14.04, Kubuntu 13.10, Xubuntu 10.04
Posts: 547

Rep: Reputation: 30
Why won't my usb hard drive auto mount when i plug it in


Hello, this is really getting frustrating.

I have a usb hard drive that i keep turned off except when i want to use it. When i turn it on, i get a nice error saying the system failed to mount my drive cause i am not privileged.

my fstab has this line in it so that it mounts where i want it when i turn it on:
UUID=25bb9ecc-5d12-45a0-b4ef-3d84a8c5e922 /media/120GB/ xfs auto,users 0 0

also, i am able to go to a command line once the drive is turned on and just type in: "mount /media/120GB/" and the drive mounts nicely. So why do i get this error if i AM able to mount the drive without doing any sort of sudo or su command? I don't want to have to type in a command every time i want to use the drive. It's crazy.

-I'm using Xubuntu Gutsy (latest version).

Thanks for any ideas you may have.
 
Old 10-01-2008, 01:08 AM   #2
htnakirs
Member
 
Registered: Mar 2007
Posts: 239

Rep: Reputation: 34
I think you should delete that line from fstab. It worked for me.
I concluded (probably erroneously) that the reason for the auto mount to fail is that at boot time the mount point gets allocated so creating a new mount point requires root access.
 
Old 10-01-2008, 10:43 AM   #3
xmrkite
Member
 
Registered: Oct 2006
Location: California, USA
Distribution: Mint 16, Lubuntu 14.04, Mythbuntu 14.04, Kubuntu 13.10, Xubuntu 10.04
Posts: 547

Original Poster
Rep: Reputation: 30
OK, i deleted the fstab entry, and the drive mounted without any errors, but it mounted to the /media/disk folder and not the /media/120GB folder

So this won't work, cause i need it to mount that drive to the /media/120GB/ folder?

Also, I have more than one usb drive, and I need each to mount to specific folders when they are turned on.

I realize i can run a command as root to do the mounting, but there has to be a way to get it automatically mount into the right folder.

Any ideas?
-Thanks
 
Old 10-01-2008, 11:33 AM   #4
htnakirs
Member
 
Registered: Mar 2007
Posts: 239

Rep: Reputation: 34
I think this is influenced by the drive label. Try changing the label of the partition on the drive to 120 GB.
 
Old 10-01-2008, 11:45 AM   #5
xmrkite
Member
 
Registered: Oct 2006
Location: California, USA
Distribution: Mint 16, Lubuntu 14.04, Mythbuntu 14.04, Kubuntu 13.10, Xubuntu 10.04
Posts: 547

Original Poster
Rep: Reputation: 30
How do i change the drive label? isn't that what fstab is for?
 
Old 10-01-2008, 12:02 PM   #6
Total-MAdMaN
Member
 
Registered: May 2008
Distribution: Gentoo
Posts: 306

Rep: Reputation: 34
You'll need to create a custom rule telling udev where you want the drive mounted. Have a look at this page from Linux From Scratch. It should help you create a rule specific to what you're trying to do.

Last edited by Total-MAdMaN; 10-01-2008 at 12:04 PM.
 
Old 10-01-2008, 12:06 PM   #7
jiml8
Senior Member
 
Registered: Sep 2003
Posts: 3,171

Rep: Reputation: 115Reputation: 115
You also could symlink the name you want it to have to the name the system gives it when it mounts.

This will work so long as you don't mount some other drive at that mountpoint.

For instance:

ln -s /media/disk /media/120GB

would do it.
 
Old 10-01-2008, 12:24 PM   #8
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Debian "Jessie"
Posts: 6,039

Rep: Reputation: 373Reputation: 373Reputation: 373Reputation: 373
If you want things always to be mounted in a particular place, udev is the best way to do it.
See here:
http://www.reactivated.net/writing_udev_rules.html
There are plenty of useful examples.
 
Old 10-01-2008, 12:38 PM   #9
jiml8
Senior Member
 
Registered: Sep 2003
Posts: 3,171

Rep: Reputation: 115Reputation: 115
Yes, a udev rule is certainly the best way.
 
Old 10-01-2008, 12:44 PM   #10
xmrkite
Member
 
Registered: Oct 2006
Location: California, USA
Distribution: Mint 16, Lubuntu 14.04, Mythbuntu 14.04, Kubuntu 13.10, Xubuntu 10.04
Posts: 547

Original Poster
Rep: Reputation: 30
OK, so i figured out how to change the drive label to 120GB, but now when it mounts, it mounts to /media/120GB_/

What is up with that underscore?

Any ideas?
-Thanks
 
Old 10-01-2008, 12:44 PM   #11
xmrkite
Member
 
Registered: Oct 2006
Location: California, USA
Distribution: Mint 16, Lubuntu 14.04, Mythbuntu 14.04, Kubuntu 13.10, Xubuntu 10.04
Posts: 547

Original Poster
Rep: Reputation: 30
how would i go about mounting it with udev?
 
Old 10-01-2008, 12:49 PM   #12
xmrkite
Member
 
Registered: Oct 2006
Location: California, USA
Distribution: Mint 16, Lubuntu 14.04, Mythbuntu 14.04, Kubuntu 13.10, Xubuntu 10.04
Posts: 547

Original Poster
Rep: Reputation: 30
Man, this is so complicated. In windows you just right click on the drive and select the drive letter. I wish it was that simple in linux
 
Old 10-01-2008, 01:03 PM   #13
xmrkite
Member
 
Registered: Oct 2006
Location: California, USA
Distribution: Mint 16, Lubuntu 14.04, Mythbuntu 14.04, Kubuntu 13.10, Xubuntu 10.04
Posts: 547

Original Poster
Rep: Reputation: 30
OK, so i got it. I had to remove the previous /media/120GB folder, and now when i plug it in it mounts to /media/120GB very nicely.

Perfect. This is exactly what i want!!!

So i guess the udev was already built in or something. By changing the drive label, that's what fixed it.

Now if I can just make it so that Thunar does not pop up each time i do this, i'll be set

-Thanks again for all the help (and for letting me rant in that one post)
 
Old 10-01-2008, 01:37 PM   #14
Total-MAdMaN
Member
 
Registered: May 2008
Distribution: Gentoo
Posts: 306

Rep: Reputation: 34
Quote:
Originally Posted by xmrkite View Post
how would i go about mounting it with udev?
udev doesn't mount devices, it's what creates the files in /dev that say what devices are installed and how they can be used. By creating rules you can do different things with the devices, e.g. changing the directory a hard drive is mounted to.
 
Old 10-01-2008, 01:44 PM   #15
xmrkite
Member
 
Registered: Oct 2006
Location: California, USA
Distribution: Mint 16, Lubuntu 14.04, Mythbuntu 14.04, Kubuntu 13.10, Xubuntu 10.04
Posts: 547

Original Poster
Rep: Reputation: 30
So how would i tell it to auto mount when it's plugged in then?

Cause right now, Thunar file manager is taking care of that, but it opens thunar when the drives are mounted, and i don't want that.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to have external eSATA drive auto mount on plug-in?? colbert Linux - Hardware 14 01-19-2009 11:25 AM
auto mount usb drive jag Slackware 3 07-28-2006 03:09 AM
How do I set exec option on USB drive hot plug mount? dhuseby Linux - Hardware 2 05-30-2006 09:16 AM
? Auto mount Hard drive and CD/DVD roms Raticus Linux - Newbie 4 02-13-2006 10:22 AM
Plug-in usb hard drive gives errors in /var/log/messeges and dmesg jasone Linux - Hardware 12 11-18-2005 12:19 AM


All times are GMT -5. The time now is 05:32 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration