You are not logged in.

#1 2007-04-04 04:04:22

cschep
Member
Registered: 2006-12-02
Posts: 125
Website

Can you change which drive is /dev/sda or /dev/sdb?

This might be a really stupid question but here goes.

Is there anyway to change which drive gets set as /dev/sda or /dev/sdb ??


I have a pata drive, 120gigs, just an extra drive, regular ide.

I have a 320 gig SATA drive that i have my OS's on. (and lots of other junk)

I want the Serial ATA drive to be /dev/sda, but it's detecting the regular IDE drive first. So the the SATA drive is /dev/sdb and the regular IDE drive is /dev/sda.

Is this a big deal? Not really, it's just bugging me. I decided to reinstall arch and it messed with grub big time. I had to tinker forever to get it working.

I can install arch without it just fine, the sata drive detects as /dev/sda , but if i put the drive back in, everything breaks because it shows up at /dev/sdb.

Really irritating.

I checked everywhere in the bios to hopefully say "detect SATA first" but I had no luck.

Is this possible? or should I just deal with it?

thanks for the help!

Offline

#2 2007-04-04 06:36:25

paranoos
Member
From: thornhill.on.ca
Registered: 2004-07-22
Posts: 442

Re: Can you change which drive is /dev/sda or /dev/sdb?

well, if your sata drive contains your OS, then only your sata modules should be in your /etc/mkinitcpio.conf. once you edit the conf, run mkinitpio to test, then mkinitcpio -g /boot/kernel26.img (i assume you're running the default kernel)

if mkinitcpio only loads your sata drivers, then they will definitely be loaded first, ie before your pata drivers, thus the sata drive will be sda, and pata sdb.

edit: to clarify, HOOKS="base udev autodetect sata filesystems"
pata drivers should be loaded after init, by udev.

Last edited by paranoos (2007-04-04 06:38:32)

Offline

#3 2007-04-04 06:44:35

Dieter@be
Forum Fellow
From: Belgium
Registered: 2006-11-05
Posts: 2,001
Website

Re: Can you change which drive is /dev/sda or /dev/sdb?

or just make an udev rule :-)


< Daenyth> and he works prolifically
4 8 15 16 23 42

Offline

#4 2007-04-04 08:19:51

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: Can you change which drive is /dev/sda or /dev/sdb?

Or use Persistent block device naming - couldn't live without it myself.

Last edited by tomk (2007-04-04 08:20:09)

Offline

#5 2007-04-04 08:51:20

cschep
Member
Registered: 2006-12-02
Posts: 125
Website

Re: Can you change which drive is /dev/sda or /dev/sdb?

it's late and I need some sleep, but I really appreciate the help and I'll be futzing with this tommorow!

Offline

#6 2007-04-04 09:12:03

cschep
Member
Registered: 2006-12-02
Posts: 125
Website

Re: Can you change which drive is /dev/sda or /dev/sdb?

because sleep is for the weak (and it was bothering the hell out of me) i got it working...mostly.

I deciced to go the way of taking things out of my mkinitcpio.conf. I took out things from the HOOKS line and it didn't seem to do anything, still loaded up as sdb.

but then i took out the ide driver from the modules at the beginning of the file and everything worked out...except now my second hard drive is hda.

This is totally fine, but I just thought i'd post to ask, is it using a different driver now? hopefully not something terribly slow? I haven't really used the partition for anything so I haven't noticed a speed difference or anything..

anything I should know that is different about it detecting as hda?

thanks again for the suggestions. the udev rule seems like it's probably more elegant, I googled it and will probably try it during work tommorow smile

thanks!

Offline

#7 2007-04-04 20:11:32

Weeks
Member
Registered: 2006-01-26
Posts: 91

Re: Can you change which drive is /dev/sda or /dev/sdb?

I'm not totally sure if I understand you. But I have a problem with linux sometimes swapping my sda and sdb.

The device names are important at two stages. The first is when the system boots up and needs to find the boot-loader specified root= device. The second is when the machine boot into multiuser mode and needs to mount all those devices featured in /etc/fstab.

For the first I edit grub's boot menu on boot (I love that feature). So for instance if the machine I'm booting to has two SCSI devices my usb key is normally /dev/sdb, and if it has only one SCSI device my usb key is normally /dev/sda. So I edit the line accordingly.

For the second I use UDEV's rules. So, basically, my usb key is always whatever I name it, no matter how many SCSI devices my system has. Of course you need UDEV running before the system tries to mount everything in /etc/fstab. But that's the case in arch, and all other distribution as far as I know. I've posted a short section on that in the wiki:

* Run udevinfo -p /sys/block/sdx/ -a (where sdx is the device name of your usb key)
    * Find unique information pertaining to your usb key. I chose `SYSFS{model}=="DataTraveler 2.0"`
    * Make a new file: /etc/udev/udev.rules/10-my-usb-key.rules and insert: KERNEL=="sd**", SYSFS{product}=="DataTraveler 2.0", SYMLINK+="WHATEVERYOUWANTOTCALLIT%n" (KERNEL=="sd**" is because the kernel - 2.6.16 here - names all usb devices sd as it uses the scsi sub-system and you want to look at every sd device and apply the setting to every partition), with SYSFS{model}== being the unique identifier collected from udevinfo.
    * Run /etc/start-udev uevents and make sure the symlinks appears in /dev.
    * If so, edit /etc/fstab, replacing your old sdx with the new symlinks.

Last edited by Weeks (2007-04-04 20:13:00)

Offline

#8 2007-04-04 21:32:23

cschep
Member
Registered: 2006-12-02
Posts: 125
Website

Re: Can you change which drive is /dev/sda or /dev/sdb?

Thanks for the repsonse Weeks.

Basically I've taken the IDE modules out mkinitcpio.conf, and only the SATA drive gets detected when booting, making it SDA.

This seems like more of a hack then making udev rules though, is it worth figuring out the rules? Does my IDE drive detecting as HDA instead of SDB make any difference?

Offline

Board footer

Powered by FluxBB