LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (https://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   Why won't my usb hard drive auto mount when i plug it in (https://www.linuxquestions.org/questions/linux-hardware-18/why-wont-my-usb-hard-drive-auto-mount-when-i-plug-it-in-673444/)

xmrkite 09-30-2008 11:56 PM

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.

htnakirs 10-01-2008 01:08 AM

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.

xmrkite 10-01-2008 10:43 AM

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

htnakirs 10-01-2008 11:33 AM

I think this is influenced by the drive label. Try changing the label of the partition on the drive to 120 GB.

xmrkite 10-01-2008 11:45 AM

How do i change the drive label? isn't that what fstab is for?

Total-MAdMaN 10-01-2008 12:02 PM

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.

jiml8 10-01-2008 12:06 PM

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.

tredegar 10-01-2008 12:24 PM

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.

jiml8 10-01-2008 12:38 PM

Yes, a udev rule is certainly the best way.

xmrkite 10-01-2008 12:44 PM

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

xmrkite 10-01-2008 12:44 PM

how would i go about mounting it with udev?

xmrkite 10-01-2008 12:49 PM

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 :)

xmrkite 10-01-2008 01:03 PM

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)

Total-MAdMaN 10-01-2008 01:37 PM

Quote:

Originally Posted by xmrkite (Post 3297257)
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.

xmrkite 10-01-2008 01:44 PM

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.


All times are GMT -5. The time now is 03:49 AM.