LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   USB storage devices difficult to mount and use (https://www.linuxquestions.org/questions/slackware-14/usb-storage-devices-difficult-to-mount-and-use-383727/)

jaakkop 11-16-2005 12:41 PM

USB storage devices difficult to mount and use
 
Hi,

I would like to know if I could mount USB storage devices more easily. I don't need it to be all fancy one-click-to-a-image-to-mount, I just want to get it mounted easily without root and so that it recognizes the fs properly.

Here is my problem:
When I plug a USB device, it appears as /dev/sda1. If I umount it, plug it off and then plug the same or different usb device, it appears as /mnt/sdb1. Again if I do the same the next one appears as /dev/sdc1. This becomes difficult when I have to use multiple devices.

Another problem is that I got different kind of partitions in my USB devices so if I put auto to automagically recognize the fs type in fstab, it just uses usbfs. So if I want to use the device with vfat, I would have to replace the auto with vfat but can cause problems cos all my devices aren't vfat. I could also mount it by hand but it requires the usage of root and I can't write with my normal user.

This has haunted me for a long time so now I want to fix it. I would really appreciate if you would help me with this problem.

Here is my fstab:
Code:

/dev/hda10    swap            swap        defaults                          0  0
/dev/hda9      /                    reiserfs    defaults                          1  1
/dev/hda8      /boot              ext3          defaults                          1  2
/dev/hda1      /mnt/win-c      vfat          umask=0000                  1  0
/dev/hda5      /mnt/win-d      ntfs          umask=0222                  1  0
/dev/hda6      /mnt/win-e      vfat          umask=0000                  1  0
/dev/hda7      /mnt/win-f        ntfs            umask=0222                  1  0
/dev/cdrom    /mnt/cdrom    iso9660    noauto,user,ro                0  0
/dev/dvd1      /mnt/dvdrw    iso9660    noauto,user,ro                  0  0
/dev/fd0        /mnt/floppy    auto          noauto,user                        0  0
devpts          /dev/pts        devpts      gid=5,mode=620              0  0
proc              /proc              proc          defaults                              0  0
/dev/sda1      /mnt/sda1      auto          noauto,user,umask=0000  0  0
/dev/sdb1      /mnt/sdb1      auto        noauto,user,umask=0000  0  0
/dev/sdc1      /mnt/sdc1      auto        noauto,user,umask=0000  0  0
/dev/sdd1      /mnt/sdd1      auto        noauto,user,umask=0000  0  0

(edit)
I forgot to tell the kernel version, it's 2.6.13.4, sorry.
(/edit)

yuchai 11-16-2005 12:56 PM

On your first problem:

Do you use a 2.6 kernel? If you do you can use udev to handle creating symlinks correctly to your usb devices.

Here's a how-to on how to do that:

http://www.reactivated.net/writing_udev_rules.html

I do not know how to do something similar on the 2.4 kernel since I don't think it supports udev.

No insights on your second problem. All my usb storage devices use the vfat filesystem (to maintain compatibility with windows, etc) so it wasn't a problem for me.

Tinkster 11-16-2005 01:06 PM

I'm using usbmgr for these tasks ... you can script it quite well, what
I do is to associate each devices USB identifier with a mount-script
that parses the output of dmesg (dmesg | grep /dev/sd|tail -n 1) and
modify fstab from there, and then mount to the appropriate partition
to the correct mountpoint.


Cheers,
Tink

Alien Bob 11-16-2005 02:00 PM

Re: USB storage devices difficult to mount and use
 
Quote:

Originally posted by jaakkop
Hi,

Another problem is that I got different kind of partitions in my USB devices so if I put auto to automagically recognize the fs type in fstab, it just uses usbfs. So if I want to use the device with vfat, I would have to replace the auto with vfat but can cause problems cos all my devices aren't vfat. I could also mount it by hand but it requires the usage of root and I can't write with my normal user.

This has haunted me for a long time so now I want to fix it. I would really appreciate if you would help me with this problem.


Create a file
Code:

/etc/filesystems
and put something like this in it:
Code:

ext3
ext2
vfat
umsdos
msdos
usbfs
xfs
iso9660
reiserfs
minix
ntfs

It is the order in which the mounter looks for filesystems on the partition. If you omit a filesystem here, it will not be used in determining what "auto" translates to.
For a list of filesystems your kernel supports (as well as the order in which the mounter will use them for probing) run
Code:

cat /proc/filesystems
Cheers, Eric

alienDog 11-16-2005 04:03 PM

I think it could also be possible to solve the problem using hotplug. It executes scripts in /etc/hotplug/usb on usb events. What it could do is create (and update if needed) symlinks under /dev/. So for example if you would connect a device called "exthd", it would create a symlink /dev/exthd pointing to whatever it currently is (sda, sdb, sdc and so on). You could then use the symlinks in fstab instead of sd?? device nodes.

I have the same problem and am using 2.4 series kernel, so this is the solution I will be using as soon as I have time and energy to look into it properly. If anyone has done something similar or knows where to get more information about it, I'd be happy to hear about it.

--edit--

Getting there... I have a working script that will do this, I'll brush it up some and post a link to it shortly along with information on how it works and how to use it. Currently it gets confused if you connect two identical devices. In that case you'll only see the one connected later. I'll have to figure out a way to deal with it (well... actually I don't own two identical usb devices, but I _might_... anyway it should work).


All times are GMT -5. The time now is 12:29 AM.