LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
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?

Notices


Reply
  Search this Thread
Old 10-20-2006, 07:45 PM   #1
Dark Carnival
Member
 
Registered: Jun 2003
Posts: 166

Rep: Reputation: 30
Lock different external drives to a set device name ? (/dev/sdX)


Heya. I'm currently messing about with a server one of my friends has (running Debian Etch network install)

First time I booted the machine I had the following drive layout
/dev/sda (3 system partitions)
/dev/sdb (160gb - 1 partition)
/dev/sdc (500gb - 1 partition)
/dev/sdf (250gb - 2 partitions)
/dev/sdd (250gb - 1 partition)
/dev/sde (203gb - 1 partition)

Now a few reboots later, I noticed that sdf and sde had switched places -- this is very unfortunate since /etc/fstab are mounting the disks to directories which are then shared on a Samba server.

Needless to say, the paths would change if devices switch names and things would generally be a bloody mess

INFO: sda and sdb are internal SATA-disks the rest are USB-connected disks

Now I'm thinking about creating a script which filters through dmesg-output and mounts the discs where they ought to be and subsequently booting the samba server (so that the paths will work when the server is booted).

However, I'm asking you guys, is there a more elegant/easy way or has this been done by someone else before ?
 
Old 10-20-2006, 08:36 PM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,120

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
Sounds like you need to be looking at setting up specific udev rules. I don't know Debian, but may try starting at /etc/udev/rules.d
 
Old 10-20-2006, 08:49 PM   #3
randyding
Member
 
Registered: May 2004
Posts: 552

Rep: Reputation: 31
You may be able to mount them using labels. e2label can assign a label to a partition, then in /etc/fstab use LABEL=yourlabel instead of /dev/sde1, and so on.
 
Old 10-20-2006, 09:58 PM   #4
Dark Carnival
Member
 
Registered: Jun 2003
Posts: 166

Original Poster
Rep: Reputation: 30
Thx you guys I didn't know you could set labels to help resolve such things! (hey, learned something new, so thats great!)

e2label can only be used on ext2/ext3 partitions though. However I found that reiserfs has an equivalent option in reisertunefs:

reistertunefs --label <labelname> <device>
ex: reisertunefs --label homedirs /dev/sda2 ((whatever the place the disk is at that boot)

to mount this in fstab:
LABEL=homedirs /home reiserfs auto,notail,noatime 0 0

The cool thing about this is that you don't have to worry about which device node the drive got. With this you can switch your disks cables around or use several USB-drives as we do without worrying about the exact node.. Nice huh ?

FYI: I found that this is doable both when creating partitions and with existing partitions, it's also possible to do on XFS-filesystems!
 
Old 10-20-2006, 10:29 PM   #5
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,120

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
Personally I don't like labels. Try putting a labelled disk into a system that already has a disk with that same label (people tend to use the same name(s) across multiple systems).

Whatever works for you though is good ...
 
Old 10-20-2006, 10:42 PM   #6
randyding
Member
 
Registered: May 2004
Posts: 552

Rep: Reputation: 31
That's a good point, I had that problem installing an old disk with /root for the label and then couldn't boot normally.

The same sort of problem happens with LVM.

What's a better way to get around this, I'd also like to know.
Usually I try to fix these problems by booting first with a live-cd and erasing the new disk's label, then rebooting normally works again.
 
  


Reply



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
/dev/tty0, /dev/tty1, /dev/tty10...and so on...which should be used for a device ??? b0nd Slackware 2 04-02-2006 08:14 AM
connecting external device causes SuSe boot error with /dev/sda2 maxsch LinuxQuestions.org Member Success Stories 3 02-02-2006 01:17 AM
External USB HDD"Mounting local filesystems: /dev/sdb1 is not a valid block device" manudath Linux - Hardware 3 12-13-2004 09:59 PM
external cdrw assigned to /dev/uba instead of /dev/sr0 gchew Slackware 0 11-14-2004 03:22 AM
How can I boot either one of my hard drives /dev/hda or /dev/hdb, I have RH9 and FC2 omogunkristi Linux - General 1 06-21-2004 05:11 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 05:07 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