LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (http://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   Trouble mounting USB device in OpenSUSE 12.2 (http://www.linuxquestions.org/questions/linux-hardware-18/trouble-mounting-usb-device-in-opensuse-12-2-a-4175447581/)

rnturn 01-28-2013 03:41 PM

Trouble mounting USB device in OpenSUSE 12.2
 
Or, perhaps I should say: trouble mounting a USB device where I want it mounted

Background: I've been happily mounting USB drives on OpenSUSE 11.x for a long time. After creating a udev rule and a suitable line in /etc/fstab, I can merely insert a USB drive and it shows up mounted in a predictable place, say, /media/cruzer or /media/attache.

Now: On OpenSUSE 12.2, the system automatically mounts the drive on some odd mount point that seems to be the serial number of the device: /media/79AA-12CD or something completely non-intuitive like that.

I tried copying over the udev rules from an 11.x system, modifying /etc/fstab, and having udev reread the rules. When I do this I get the USB mount behavior I'm looking for. BUT this only works for the duration of the current boot. And... when the system is rebooted, it hangs. Removing the lines for the USB devices in /etc/fstab solves the hanging problem.

Now the biggest difference between the two systems is, of course, 12.2 is using systemd. I suspect the problem I'm encountering is related to systemd though I can't quite tell why the system startup processes should be hanging (other than it's getting hung up on there not being anything accessible on the USB bus to mount). There are no obvious messages on the console that indicate that the system is waiting for something; it just sits there.

What is the mechanism for being able to have USB drives mounted on a nicely predictable mount point that I define and not one that uses some oddball hexadecimal string?

Any pointers to helpful READMEs and/or HOWTOs are most welcome.

TIA,

Rick

bigrigdriver 01-28-2013 06:59 PM

After taking a quick look at the OpenSuse Reference Manual, sections 12.7 and 12.8, I don't see any significant changes to the udev rule structure to account for your problems. You may want to compare your udev rule to the examples in the section 12.7. If you use the device-by-uuid example in both the udev rule and /etc/fstab, you should be able to fix your udev rule to mount persistently at the same mount point.

rnturn 01-29-2013 03:40 PM

Quote:

Originally Posted by bigrigdriver (Post 4879390)
You may want to compare your udev rule to the examples in the section 12.7. If you use the device-by-uuid example in both the udev rule and /etc/fstab, you should be able to fix your udev rule to mount persistently at the same mount point.

I suppose it's possible that there have been some minor syntax changes in the udev rules that have caused the current problem. I'll do some testing this evening to see what's happening on 12.2 and compare the results to what's working on the 11.x systems. Not having things mounted where I would like them is currently merely annoying (but it's making it a pain to implement some directory synchronization I've been trying to implement when files are transported between systems using the USB drive).

I'm still a little mystified by the fstab entries for the USB devices causing the boot to hang. If it was merely a timeout problem I could live with that (though I'd like to shorten the timeout). When I break out of the startup sequence while it's hanging, I get a message noting that I can issue "systemd default" (or something like that; I'm going from memory) but when I enter the root password and try that command the startup still hangs. So breaking out and editing the /etc/fstab to comment out the USB device entries is the only thing I've found that allows the startup to complete. Of course, when I do that the mounts don't work as desired. I guess I've got some more reading to do about systemd. I've only been using 12.2 for a couple of months or so and I'm still discovering new things.

rnturn 01-30-2013 12:57 AM

Quote:

Originally Posted by bigrigdriver (Post 4879390)
After taking a quick look at the OpenSuse Reference Manual, sections 12.7 and 12.8, I don't see any significant changes to the udev rule structure to account for your problems.

I'm not sure if you would consider it significant or not but the "NAME=" directive now seems to be invalid when used as I had been using it under 11.x. Removing that from the udev rules at least got the rules recognized and the symbolic links that are referred to in /etc/fstab created correctly.

But that wasn't enough to get USB devices mounted as I was hoping. I notice that the USB mount points in /etc/fstab must now use the "noauto" option where "auto" worked fine under 11.x. Without this change the boot process would still hang.

I created mount points under /media for the USB drives and rebooted. When a USB drive was inserted, the mount failed as the subdirectory under /media appears to have been cleaned out as part of the boot process. Recreating the mount point subdirectories under /mnt and modifying /etc/fstab to reflect the new mount points now has the USB drives mounting using names that are more human-readable. (Now I'm off to retrofit the 11.x systems so the USB drives are mounted in the same place on all systems.)

John VV 01-30-2013 02:29 AM

if you do not need it to mount to a specific custom named folder

just plug it in
and let it auto mount to /media/??????

jefro 01-30-2013 06:13 PM

You can fix the mount by (device, common name, uuid or such) in Yast I think. I assume you had this/these devices attached when you installed the system.

John VV 01-30-2013 06:51 PM

or use udev
this is a fairly good tutorial
http://www.reactivated.net/writing_udev_rules.html
the usbhdd section
http://www.reactivated.net/writing_u...example-usbhdd

for my 3TB drive i use
udev to lock it to /dev/hdc ( it is always pluged in so it was hdc anyway )
then a fstab line to mount it in a custom location

rnturn 01-31-2013 12:59 PM

Quote:

Originally Posted by John VV (Post 4880460)
if you do not need it to mount to a specific custom named folder

just plug it in
and let it auto mount to /media/??????

Even if I could guarantee that the UUID would be the same across all systems where this USB drive might be plugged in -- and it probably is -- something like "79AA-12CD" isn't something I'm likely to remember. (Plus it's a more of a PITA to type than something like "cruzer" is.) Especially if I had two or more USB drives plugged in simultaneously (which isn't that uncommon, actually).

rnturn 01-31-2013 01:06 PM

Quote:

Originally Posted by jefro (Post 4880955)
You can fix the mount by (device, common name, uuid or such) in Yast I think.

If it's modifiable in YaST I must have missed it; I'll take another look. It might be a useful thing in the future.

Quote:

I assume you had this/these devices attached when you installed the system.
No these are portable USB drives that are moved between multiple systems. They would not be visible when the systems were built.

--
Rick

rnturn 01-31-2013 01:34 PM

[SOLVED] Trouble mounting USB device in OpenSUSE 12.2
 
Quote:

Originally Posted by John VV (Post 4880974)

I've seen those before. Anyway, the rules I have in place on the 11.x systems (based on info found in those tutorials, BTW) worked on the 12.2 system once I removed the "NAME=" directive. So I think many of the examples in those tutorials that employ that directive might now be broken. (So watch out!) The other weird thing was that, on 12.2, the /media directory appears to be cleared at boot time so I couldn't use that as a location for the mount points I was looking to create. "/mnt" works fine. (Until they decide to do something odd in 13.1. :) )

Quote:

for my 3TB drive i use
udev to lock it to /dev/hdc ( it is always pluged in so it was hdc anyway )
then a fstab line to mount it in a custom location
And that's my next project. I have one of those external SATA docking stations that I use with several disks for backup devices. I'll need to set up rules so that all of these disks wind up looking like "/dev/backup" or something like that and mounted on "/mnt/backup" so that backup scripts always know where the backup files should be written.

I'm calling this problem "solved". (At least for my needs.) Thanks, all, for the hints and comments that got me thinking of different places to look to tell what was going wrong.

--
Rick

Shadow_7 01-31-2013 03:12 PM

Couldn't you just delete the entries. And when udev creates them for you, you can go modify what it assumed to suit your needs. It is annoying when udev creates a new eth# for a different machine when I boot my USB version of linux. Since I have to modify my firewall script with the new device name before I can run it. If it's assuming those from the UUID you can create custom UUID's with mkfs as long as the value is HEX. But you can do many interesting names in HEX. ba55c1ef feed deaf cafe beef and others.

rnturn 01-31-2013 03:55 PM

Quote:

Originally Posted by Shadow_7 (Post 4881587)
Couldn't you just delete the entries. And when udev creates them for you, you can go modify what it assumed to suit your needs.

Maybe. I'm satisfied with the udev solution I've come up with.
Quote:

It is annoying when udev creates a new eth# for a different machine when I boot my USB version of linux. Since I have to modify my firewall script with the new device name before I can run it.
You could try modifying your firewall script to reference a shell variable, say "ETHDEV", as it sets up your iptables rules. When you know what the network device name is, run the script using
Code:

ETHDEV=whatever-the-ethernet-device-is  /usr/local/sbin/my_firewall_rules
(Fill in your firewall path/script name.)

I, too, found the udev network device renaming annoying when I was trying to add a second network controller in some systems. I had all sorts of odd configuration problems (and all kinds of "network not accessible" type errors) until I figured out that I could swap the device names in the "persistent-net.rules" file.

Quote:

If it's assuming those from the UUID you can create custom UUID's with mkfs as long as the value is HEX. But you can do many interesting names in HEX. ba55c1ef feed deaf cafe beef and others.
I think that would be almost as confusing as the strings that the system is coming up with. I'd have figure out how to put P-touch labels on my little USB drives. I do like the "ba55clef" name though. There should be a smiley for that. Maybe "7:". :)

--
Rick


All times are GMT -5. The time now is 04:36 AM.