Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Linux Forums > Linux - Hardware
User Name
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?


  Search this Thread
Old 05-18-2008, 01:44 AM   #1
Registered: Nov 2002
Location: /au/qld/bne/4157
Distribution: Gentoo mactel-linux
Posts: 238

Rep: Reputation: 30
getting udev to mount a slow usb sdhc card on boot...

Hi all,

I have built a Gentoo install for my EeePC and am very happy with it overall; everything I need working except a small udev boot issue:

on boot I want the main root to be on the internal sdhc /dev/sda2 and boot is at /dev/sda1 - these are found and work fine from grub and the boot proceeds normally. However conscious of space I have elected to put /home and /tmp on an 8GB SDHC that inserts into the internal slot.

Depending on what other usb disks are inserted this disk gets a different /dev/sd? and therefore I wrote a simple 10local.rule udev rule.

mineeepc ~ # cat /etc/udev/rules.d/10-local.rules
SUBSYSTEMS=="usb", ATTRS{serial}=="146030377350", KERNEL=="sd?", NAME="%k", SYMLINK="sdhc"
SUBSYSTEMS=="usb", ATTRS{serial}=="146030377350", KERNEL=="sd?1", NAME="%k", SYMLINK="sdhc1"
SUBSYSTEMS=="usb", ATTRS{serial}=="146030377350", KERNEL=="sd?2", NAME="%k", SYMLINK="sdhc2"
SUBSYSTEMS=="usb", ATTRS{serial}=="146030377350", KERNEL=="sd?3", NAME="%k", SYMLINK="sdhc3"

SUBSYSTEMS=="usb", ATTRS{serial}=="100", ATTRS{manufacturer}=="Myson Century, Inc.", ATTRS{product}=="USB Mass Storage Device", KERNEL=="sd?2", NAME="%k", SYMLINK="bindport"

# mount block device when added
#SUBSYSTEMS=="block", ACTION=="add", RUN+="/usr/local/bin/ /dev/%k"
mineeepc ~ #
This creates a working instance like this:
mineeepc ~ # ls -l /dev/sdh*
lrwxrwxrwx 1 root root 3 May  9 08:42 /dev/sdhc -> sdb
lrwxrwxrwx 1 root root 4 May  9 08:42 /dev/sdhc1 -> sdb1
lrwxrwxrwx 1 root root 4 May  9 08:42 /dev/sdhc2 -> sdb2
lrwxrwxrwx 1 root root 4 May  9 08:42 /dev/sdhc3 -> sdb3
mineeepc ~ #
However when booting the system reports that local filesystems failed to mount at around the time that the udev rules are initially processed.

Once the boot process has completed I can log in as root and execute

mount /home
mount /tmp

and all is well giving me the mtab that I need:
mineeepc log # cat /etc/mtab
/dev/sda2 / ext2 rw,noatime 0 0
proc /proc proc rw,nosuid,nodev,noexec 0 0
sysfs /sys sysfs rw,nosuid,nodev,noexec 0 0
udev /dev tmpfs rw,nosuid 0 0
devpts /dev/pts devpts rw,nosuid,noexec 0 0
shm /dev/shm tmpfs rw,noexec,nosuid,nodev 0 0
usbfs /proc/bus/usb usbfs rw,noexec,nosuid,devmode=0664,devgid=85 0 0
/dev/sdc2 /mnt/usbhdd ext2 rw,noatime 0 0
/mnt/usbhdd/maint/bindport /usr/portage none rw,bind,noatime 0 0
/mnt/usbhdd/maint/bindlport /usr/local/portage none rw,bind,noatime 0 0
/mnt/usbhdd/maint/bindvartmp /var/tmp none rw,bind,noatime 0 0
So how do I make sure that the internal card is ready and/or able to be mounted during boot by udev - or should I get it to delay the mounting of home and tmp till later in the process to give the usb bus time to catch up with the disk??

Help appreciated guys!
Old 05-21-2008, 07:35 AM   #2
LQ Addict
Registered: Oct 2003
Location: Australia
Distribution: MX 16
Posts: 5,291

Rep: Reputation: Disabled
until you get a better reply I suggest a work a round

1) boot process with init and all that stuff wants to find and mount the root system

2) so why not create back on your internal drive..../home and /tmp and refix your /etc/fstab to point to those files.

the part /etc/rc.local with already root created folders (say)

/bin/mount -t /dev/sd1 /home2
/bin/mount -t /dev/sd2 /tmp2

note when you look at /var/log/syslog....your usb system is not available for quite a while so by running it in rc.local you give it the max time to settle

3) if that fails still keep internal fstab etc and manually mount on boot up

4) I am sure you have your reasons for choosing gentoo but consider dsl or puppy pls as they are better suited to run on small footprints (puppy small footprints get it?)
Old 05-22-2008, 05:51 AM   #3
Registered: Nov 2002
Location: /au/qld/bne/4157
Distribution: Gentoo mactel-linux
Posts: 238

Original Poster
Rep: Reputation: 30
Great answer; thank you.

1) true; very relevant in this context
2) very true - mount bind them after booting with a script?
3) good fallback - might even work better as a bind mount with the basics there as fallback.
4) yeah I just like gentoo and thought of it as a challenge to cram it onto the lil 'puter 'cause that is the linux I like to use day to day.
Portage is all mount bind to an external disk and it seems to be working pretty well for me.

Thanks again for the help; I will try these suggestions.

Old 05-22-2008, 06:10 AM   #4
LQ Guru
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 671Reputation: 671Reputation: 671Reputation: 671Reputation: 671Reputation: 671
Would it help to simply use "UUID=" instead of the device entry in /etc/fstab. You can use "udevinfo -q env -n <device node>" and take the number from the FS_UUID line. This will alleviate the problem with the device node being different. It may solve the your other problem as well. This is a lot easier than mounting from a udev rule.
Old 05-24-2008, 06:36 PM   #5
Registered: Nov 2002
Location: /au/qld/bne/4157
Distribution: Gentoo mactel-linux
Posts: 238

Original Poster
Rep: Reputation: 30
I must investigate this approach; thank you for the suggestion.

Old 05-06-2009, 12:42 AM   #6
LQ Newbie
Registered: May 2009
Posts: 3

Rep: Reputation: 0
Has anyone found a solution to this problem?

I have the same issue trying to mount a usb key and a sdcard on boot. It appears that the issue might have to do with the "Mounting USB device filesystem (usbfs)" being executed after fstab has been parsed. It looks like the usb devices are not ready somehow.

I did try editing localmount to move usbfs ahead of fstab, however this did not fix the issue.

Is there not a standard way to mount usb devices on boot with fstab?
Old 12-01-2009, 09:06 PM   #7
LQ Newbie
Registered: May 2009
Posts: 3

Rep: Reputation: 0
Ok, so I finally got around to looking at the issue again.

The solution is to add rootdelay=X to the kernel boot parameters (X in seconds). This is in the kernel docs, kernel-parameters. Add enough time to allow the usb devices to come up (this was the issue).


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
Trying to use udev to auto mount usb drive njnear Linux - General 5 12-04-2007 01:53 AM
Udev newbie wants to mount audio CDs & USB drives spes_hominis Slackware 3 11-26-2006 04:33 AM
udev disables network card on boot byblyk Linux - Hardware 0 04-07-2006 12:46 AM
KDE & hal/dbus/udev problem with USB card... mlaverdiere Debian 7 02-23-2006 08:00 PM
udev, USB Flash Drives, and usb-mount talkingwires Debian 13 11-07-2004 12:15 PM > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 06:37 PM.

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