LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
LinkBack Search this Thread
Old 06-23-2011, 01:51 PM   #1
wjtaylor
Member
 
Registered: Feb 2009
Posts: 78

Rep: Reputation: 15
hard drive device assignment - question


Can someone give a basic description of how linux assigns drive letters?

I understand that a drive letter assignment is not static. If I add a drive between /dev/sda and /dev/sdb, my /dev/sdb will become /dev/sdc and the new drive will become /dev/sdb.

I have a hot swap tray and have come into some unexpected behavior. I removed /dev/sde from the hot swap tray and then loaded another drive into this same tray. When I mounted the new drive with options in fstab, it wouldn't mount because the new drive was /dev/sdf, not /dev/sde. Apparently, linux is looking at the id of the drive in addition to it's place in the BIOS chain.

My fstab entry is:
/dev/sde /backups auto noauto,rw,noexec,async,user 0 0

I was avoiding using UUIDs in the fstab so that new HDDs would not have to be "registered" in the fstab prior to use.

Is there a way to tell linux (or fstab) whatever drive is plugged into SATA channel X mount to /mountpoint?

Thanks,
WT
 
Old 06-23-2011, 02:06 PM   #2
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Servers: Debian Squeeze and Wheezy. Desktop: Slackware64 14.0. Netbook: Slackware 13.37
Posts: 8,520
Blog Entries: 27

Rep: Reputation: 1174Reputation: 1174Reputation: 1174Reputation: 1174Reputation: 1174Reputation: 1174Reputation: 1174Reputation: 1174Reputation: 1174
udev. Writing udev rules is slightly outdated (the udevadm command has replaced some of the commands shown) but is the best guide I know of.
 
Old 06-27-2011, 07:35 PM   #3
wjtaylor
Member
 
Registered: Feb 2009
Posts: 78

Original Poster
Rep: Reputation: 15
I'm answering my own questions so others know the answer:

udev is not necessary.

tree /dev/disk will list not only the disks by id and UUID, but also by hardware path.

Next add a line to your fstab similar to:
/dev/disk/by-path/pci-0000:03:00.0-scsi-1:0:0:0-part1 /backups auto noauto,user,noexec,rw,async 0 0


The entry will always mount the disk connected to the specified scsi port to backups. Note the -part1 for partition number.

Best,
WT
 
Old 06-27-2011, 09:23 PM   #4
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 11,821

Rep: Reputation: 924Reputation: 924Reputation: 924Reputation: 924Reputation: 924Reputation: 924Reputation: 924Reputation: 924
Quote:
Originally Posted by wjtaylor View Post
udev is not necessary.
Wanna bet ?
It wasn't necessary (in this case) for you to write your own udev rules - different thing altogether.

by-path is handy in situations, but by being so specific (bus, port ...) can be a PITA also. Another option for you might be to label all your backup filesystems the same name (say BACKUP). Single line in fstab for that LABEL - then when you plug any of those disks in, they mount as above.
Won't work if you ever try to plug two in at once of course ...
 
Old 06-27-2011, 09:26 PM   #5
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Servers: Debian Squeeze and Wheezy. Desktop: Slackware64 14.0. Netbook: Slackware 13.37
Posts: 8,520
Blog Entries: 27

Rep: Reputation: 1174Reputation: 1174Reputation: 1174Reputation: 1174Reputation: 1174Reputation: 1174Reputation: 1174Reputation: 1174Reputation: 1174
Thanks for sharing wjtaylor; that tree /dev/disk is a neat technique
 
  


Reply


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
No Hard Drive device detected during Installation Poposh Linux - Newbie 4 12-25-2007 02:50 AM
Need Help Moving Files From Hard Drive to USB Device Nobody404 Linux - Newbie 20 09-17-2007 07:39 PM
[SOLVED] hard drive dev assignment in GRUB daisychick Fedora 14 12-09-2006 11:33 AM
External Hard Drive Device File?/?? indrid Linux - Hardware 2 03-16-2004 02:13 PM
Locating the device my first hard drive is bound to... LinuxBAH *BSD 2 12-05-2003 08:45 AM


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

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration