LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 05-22-2010, 04:24 AM   #1
pastoreerrante
LQ Newbie
 
Registered: May 2009
Posts: 7

Rep: Reputation: 0
Udev creates the external usb hard disk device node too late


Hi all,

on my debian lenny OS I have an external usb hard disk I would like to automount it at boot.

So I edited the /etc/fstab file in order to automount /dev/sdb1. It worked without problem.

Then I recompiled the kernel and, as consequence, /dev/sdb1 changed to /dev/sdc1. I started playing with udev in order to match the now called /dev/sdc1 and to change its name in /dev/maxtor (being maxtor the brand of the hard disk). Obviously I edited also /etc/fstab: /dev/sdb1 is now /dev/maxtor.

The boot automount doesn't work anymore. On the boot sequence I can read the message "Mounting local filesystem...mount: special device /dev/maxtor does not exist FAILED".

But when I log into the system I can run the command "mount /dev/maxtor /mnt/maxtor" and it works! So, IMHO, my udev rule is correct otherwise also the manual mount wouldn't work, right?

How can I fix this? I have to tell to udev to create /dev/maxtor BEFORE the boot automount process.

Thank you in advance,

Daniele

Update: I tried to delete my udev rule and to edit /etc/fstab changing /dev/maxtor in /dev/sdc1 (the name udev gave to my hard disk after kernel recompile, before was /dev/sdb1) and it didn't work: on boot process I always see the "Mounting local filesystem...mount: special device /dev/sdc1 does not exist FAILED".

Then I tried to change /dev/sdc1 in /dev/sdb1 in /etc/fstab and to reboot with the old original kernel and int this way it works. This is a weird problem, now it seems related to kernel change. With my compiled kernel, the OS seems to have lost the capacity to detect my device node correctly...any clues???

Last edited by pastoreerrante; 05-24-2010 at 12:48 AM. Reason: Update
 
Old 05-22-2010, 07:39 AM   #2
Shadow_7
Senior Member
 
Registered: Feb 2003
Distribution: debian
Posts: 4,137
Blog Entries: 1

Rep: Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874
Two workarounds IMO.

1) Change the point in the boot sequence that udev loads. Or repeat that step by adding a second entry for it.

ls /etc/rc2.d/*

the S## is the start order. K## are termination order. rc#.d is the run level. Debian defaults to run level 2, see inittab. So it should be the only one you HAVE to change on a typical system.

or

2) Add a step at the end of the boot sequence to try again.

# echo "mount /dev/sdc1" >> /etc/rc2.d/S99z_custom
# chmod +x /etc/rc2.d/S99z_custom

And various other ways. You could try to reconfigure udev.

# dpkg-reconfigure udev

But if you didn't use debian tools make-kpkg in relation to your new kernel it might not do much. You might also try adding usb module loading to /etc/modules (old school), or just use an initrd image or include usb support in the kernel and not as a module. Things have to load in a particular sequence. Which doesn't always go as planned if you deviate from the script (custom kernel).

If you need to compile against a distro kernel you can always install the headers. Make the module(s) and copy or move them into the tree manually and run depmod. One way to work around wireless drivers and proprietary video drivers and the likes while still running a distro supplied kernel. And therefor staying within the confines of the script.
 
Old 05-24-2010, 12:42 AM   #3
pastoreerrante
LQ Newbie
 
Registered: May 2009
Posts: 7

Original Poster
Rep: Reputation: 0
Thank you for the reply.

I solved putting the following script in /etc/init.d/

Code:
#! /bin/sh
# /etc/init.d/mountmaxtor.sh
#

case "$1" in
  start)
    echo "Mounting Maxtor Hard Disk"
    mount /dev/sdc1 /mnt/maxtor
    ;;
  stop)
    echo "Umounting Maxtor Hard Disk"
    umount /dev/sdc1 /mnt/maxtor
    ;;
  *)
    echo "Usage: /etc/init.d/mountmaxtor.sh {start|stop}"
    exit 1
    ;;
esac

exit 0
Then I gave the command "update-rc.d mountmaxtor.sh defaults" to create the simbolic links to my script in the /etc/rcX.d/ directories. This is the best practise in debian world to add a script at boot time AFAIK.

Regards, Daniele
 
  


Reply

Tags
udev rules



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
Copy of IBM Server hard disk data to Another USB External Hard disk mazharcdn Linux - Server 2 09-02-2009 12:41 AM
Ahhh, XSane, UDEV and Device Node Permissions? binarybob0001 Linux - Software 2 04-10-2007 12:16 AM
60GB laptop hard disk & 200GB external USB hard disk linux compatibility powah Linux - Hardware 0 03-07-2006 10:55 AM
Created new partition. No device node for it. udev Slack10.2 myslfkeepslippin Linux - General 5 02-01-2006 02:16 PM
udev does not create scsi device node maenho Linux - Software 0 11-27-2004 05:08 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 10:54 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
Open Source Consulting | Domain Registration