Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Finding correct sd* drive [unsolved]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
jonfr
Veteran
Veteran


Joined: 20 Jul 2003
Posts: 1008
Location: Denmark

PostPosted: Sun Sep 26, 2010 3:08 pm    Post subject: Finding correct sd* drive [unsolved] Reply with quote

The latest minimal installation disk of Gentoo Linux does not reflect the change that has happened in the kernel recently. That is the change from hd* deprecation and to sd* only. Due to this issue it is quite hard to find the boot drive on PC's that are using a mix of ATA and SATA drives.

I was installing a Gentoo Linux on a computer that has this type of setup. But I cannot find the boot drive. I did try for sdd but that did not work. On the old stack the sda and sdb goes to the SATA drives already in the computer.

The layout is like this.

Code:
dmesg  | grep hd
hda: WDC WD5000AAKB-00H8A0, ATA DISK drive
hda: host max PIO4 wanted PIO255(auto-tune) selected PIO4
hda: UDMA/100 mode selected
hdc: TSSTcorpCD/DVDW SH-W162C, ATAPI CD/DVD-ROM drive
hdc: host max PIO4 wanted PIO255(auto-tune) selected PIO4
hdc: UDMA/33 mode selected
hda: max request size: 512KiB
hda: 976773168 sectors (500107 MB) w/16384KiB Cache, CHS=60801/255/63
hda: cache flushes supported
 hda: hda1 hda2 hda3
ide-cd: hdc: ATAPI 24X DVD-ROM DVD-R CD-R/RW drive, 2048kB Cache
EXT3-fs (hda1): mounted filesystem with writeback data mode
EXT3-fs (hda3): mounted filesystem with writeback data mode
hda: UDMA/100 mode selected
hdc: UDMA/33 mode selected
EXT3-fs (hda3): using internal journal
EXT3-fs (hda3): mounted filesystem with writeback data mode
EXT3-fs (hda1): using internal journal
EXT3-fs (hda1): mounted filesystem with writeback data mode


Code:
dmesg  | grep sd
sd 0:0:0:0: [sda] 156301488 512-byte logical blocks: (80.0 GB/74.5 GiB)
sd 0:0:0:0: [sda] Write Protect is off
sd 0:0:0:0: [sda] Mode Sense: 00 3a 00 00
sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
 sda:
sd 1:0:0:0: [sdb] 156301488 512-byte logical blocks: (80.0 GB/74.5 GiB)
sd 1:0:0:0: [sdb] Write Protect is off
sd 1:0:0:0: [sdb] Mode Sense: 00 3a 00 00
sd 1:0:0:0: [sdb] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
 sdb: sda1
sd 0:0:0:0: [sda] Attached SCSI disk
 sdb1
sd 1:0:0:0: [sdb] Attached SCSI disk
sd 0:0:0:0: Attached scsi generic sg0 type 0
sd 1:0:0:0: Attached scsi generic sg1 type 0
EXT3-fs (sda1): mounted filesystem with writeback data mode
EXT3-fs (sdb1): mounted filesystem with writeback data mode
EXT3-fs (sda1): warning: maximal mount count reached, running e2fsck is recommended
EXT3-fs (sda1): using internal journal
EXT3-fs (sda1): mounted filesystem with writeback data mode


Any ideas on where the boot drive might be in the new sd* setup are welcomed. Thanks in advance for the help.
Back to top
View user's profile Send private message
krinn
Watchman
Watchman


Joined: 02 May 2003
Posts: 7470

PostPosted: Sun Sep 26, 2010 3:18 pm    Post subject: Reply with quote

Code:
file -s /dev/sda


=

/dev/sda: x86 boot sector; GRand Unified Bootloader, stage1 version 0x3, stage2 address 0x2000, stage2 segment 0x200; partition 1: ID=0x83, active, starthead 1, startsector 63, 144584937 sectors; partition 2: ID=0x82, starthead 254, startsector 144585000, 11711385 sectors, code offset 0x48

easy no ?
Back to top
View user's profile Send private message
jonfr
Veteran
Veteran


Joined: 20 Jul 2003
Posts: 1008
Location: Denmark

PostPosted: Sun Sep 26, 2010 3:23 pm    Post subject: Reply with quote

In this setup the boot disk is hda, not sda. But in the new stack all the ATA disks get a sd id and it follows the sd* line. But what is hard to know is where the boot sector ends up being. Where that be sdd or sdc etc.
Back to top
View user's profile Send private message
krinn
Watchman
Watchman


Joined: 02 May 2003
Posts: 7470

PostPosted: Sun Sep 26, 2010 3:27 pm    Post subject: Reply with quote

Kernel will name the drives as they appears sda, then sdb...


So how you can be sure your sata boot drive will be sda while your ata drives will get last_sata_drive+1 ?

Just tell the kernel to load SATA driver before ATA driver.
This just mean, set SATA drivers as include in kernel, and just set ATA driver as module, this way kernel MUST load SATA driver before the ATA driver (as it is module now)


edit: and if your boot were hda, then include PATA driver and module the SATA driver :)
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54300
Location: 56N 3W

PostPosted: Sun Sep 26, 2010 4:32 pm    Post subject: Reply with quote

jonfr,

This is partly a BIOS issue and partly a kernel issue.

On some systems, you can alter if the SATA or IDE drives are detected first by the kernel by changing the boot order in the BIOS.
e.g. My A7N8X works that way. Its a matter of trial and error.

Grub can help you here. Boot to the grub prompt and press 'e'.
Edit the line root (x,y) so it reads root (0, and press tab.
Grub will show the partitions on drive 0, (the first drive detected by the BIOS)
repeat for root (1, press tab and see the partitions on drive 1.

You can often identify your drives from this.

You can also use the same technique to change the (real_)root=/dev/sd... until the kernel mounts root.
Then you know where root is. Once you have that, the rest is easier.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Cyker
Veteran
Veteran


Joined: 15 Jun 2006
Posts: 1746

PostPosted: Mon Sep 27, 2010 10:16 am    Post subject: Reply with quote

<rant>
Ugh, this is a pet hate of mine.

The whole sd? system is completely useless for identifying drives as, unlike the hd? assignments, it is completely decoupled from anything.

The most fun thing is you can break the boot up by leaving an eSATA and/or USB drive plugged in while rebooting as it will often totally mess up drive order depending on what PCI order the controllers are and when the kernel loads that driver module.

I'm hoping at some point the sd? assignments will be split again (They were originally just nice sensible predictable hd? for ATA and FCFS* sd? for SCSI drives, but now *every* storage device, be it SATA, SCSI, USB, or ATA gets given a FCFS sd? assignment. It's like being back in DOS land)

The most annoying thing is you can't even use udev to 'kludge' more sensible names because there's not enough information to tell what kind of device is being connected!




*First Come First Served
Back to top
View user's profile Send private message
DuzaK
n00b
n00b


Joined: 31 Mar 2009
Posts: 14
Location: Glückstadt, Germany

PostPosted: Mon Sep 27, 2010 3:52 pm    Post subject: Reply with quote

I don't understand the hate with the "new" sd? assignments. There is nothing new about it only that hd isn't used, besides that the naming scheme is exactly the same.
If you want to be on the save side then just use the UUID of your partitions in grub/fstab and never have any problem with changing device nodes.
Code:
# blkid
Back to top
View user's profile Send private message
Cyker
Veteran
Veteran


Joined: 15 Jun 2006
Posts: 1746

PostPosted: Mon Sep 27, 2010 4:50 pm    Post subject: Reply with quote

The hate is because sd? is now completely abstracted from the hardware;

In my system right now I *know* that hda is always Primary Master, hdb is always Primary Slave etc.

I have no idea what sda is; It could be eSATA port 1, Sil SATA port 6 some USB stick or anything.

At the moment, I can't break my boot up by plugging in, say, an eSATA drive, but when I tried using libata for everything I could and that is just annoying.

I know you can use things like UUID (I prefer labels myself) as a disk identifier, but there are occasions where you have to use the base /dev/sd? assignment to access a disk or partition and where I could intuitively know what port was what, this is now lost on newer systems :(

If you could assign sda1-4 to IDE PM/PS/SM/SS, and sda 5-12 to SATA ports 1-8 then it wouldn't be so bad, but you can't even do that because the sd? naming is done on a first-come-first-served basis, and there is no sane way to get around it, even with udev!

And I don't understand why *all* storage has to use sd? now - Would it not be more sensible to keep hd? for ATA, sd? for SCSI, and then use new ones for other devices, e.g. um? for USB Mass storage, st? for SATA devices etc.?!

I'm just glad the madness hasn't spread to the RAID section (If my RAID array was given an sd? assignment I'd be screaming!)
Back to top
View user's profile Send private message
DuzaK
n00b
n00b


Joined: 31 Mar 2009
Posts: 14
Location: Glückstadt, Germany

PostPosted: Mon Sep 27, 2010 5:23 pm    Post subject: Reply with quote

I see, yes it is hard to know which drive is what.
I have it easy with just 5 different hard drives where each one has different sizes. A little fdisk -L helps me a lot when i need to know the exact location of some partitions. But i would be troubled if all of them were the same size.
In this light it sounds indeed pretty neat to have the old behavior back, but only if i even use this many different ports. I myself only have sata drives connected it would be useless for me.

I think the best solution would be to scrap all the sd? hd? naming and use Labels instead. Dunno if this would break something but it would make me pretty happy.

*edit*
discard the above. The names of HDDs are probably too long and have spaces, so it wouldn't be a good idea to use it in this way.
Back to top
View user's profile Send private message
Yak
Tux's lil' helper
Tux's lil' helper


Joined: 01 Sep 2002
Posts: 107

PostPosted: Tue Nov 02, 2010 2:50 am    Post subject: Reply with quote

You're right it's a bunch of crap everything is sd*

I just installed a sas card and apparently it put it first because i got a kernel panic cannot mount root fs.. its bullshit.

Seriously putting parts as modules is the best current solution for this? There's udev rules in gentoo for net and cd for god's sake, and if those fuck up it's not like it makes the system totally unbootable.

So I have.. let's see..

Onboard SATA
Promise SATA pci card
SAS -> SATA card
USB mass storage

Tell me, which should I make modules or compile in??
Back to top
View user's profile Send private message
krinn
Watchman
Watchman


Joined: 02 May 2003
Posts: 7470

PostPosted: Tue Nov 02, 2010 11:18 am    Post subject: Reply with quote

It's simple, all as module except the one that hold your root disk

So for you it should be SAS build-in with logic
And without it, we can't guess it for you, but you can still keep crying for nothing.
Back to top
View user's profile Send private message
Yak
Tux's lil' helper
Tux's lil' helper


Joined: 01 Sep 2002
Posts: 107

PostPosted: Tue Nov 02, 2010 1:34 pm    Post subject: Reply with quote

I just did that, promise and sas as modules.. same thing kernel panic cannot mount root. Need to look into how system rescue cd does it, seems to be in a sane order. The whole plug in a monitor, cdrom, boot, mount, chroot, recompile kernel, reboot and hope it comes up in some kind of sane order is just a pita.

Edit: Okay apparently it didn't compile/install as modules.. not in lsmod noticed it after I changed /etc/fstab and grub.conf from sda to sde to boot and saw what was going on. Not sure whats up with that, maybe it depends on something else being compiled as a module?
Code:

# cat .config | grep -i sata     
CONFIG_SATA_PMP=y
CONFIG_SATA_AHCI=y
# CONFIG_SATA_SIL24 is not set
# CONFIG_SATA_SVW is not set
# CONFIG_SATA_MV is not set
# CONFIG_SATA_NV is not set
# CONFIG_SATA_QSTOR is not set
CONFIG_SATA_PROMISE=m
# CONFIG_SATA_SX4 is not set
CONFIG_SATA_SIL=m
# CONFIG_SATA_SIS is not set
# CONFIG_SATA_ULI is not set
# CONFIG_SATA_VIA is not set
# CONFIG_SATA_VITESSE is not set
# CONFIG_SATA_INIC162X is not set

# cat .config | grep -i sas
CONFIG_SCSI_SAS_ATTRS=m
CONFIG_SCSI_SAS_LIBSAS=m
CONFIG_SCSI_SAS_ATA=y
CONFIG_SCSI_SAS_HOST_SMP=y
CONFIG_SCSI_SAS_LIBSAS_DEBUG=y
# CONFIG_SCSI_3W_SAS is not set
CONFIG_SCSI_MVSAS=m
CONFIG_SCSI_MVSAS_DEBUG=y
# CONFIG_MEGARAID_SAS is not set
# CONFIG_SCSI_MPT2SAS is not set
Back to top
View user's profile Send private message
jburns
Veteran
Veteran


Joined: 18 Jan 2007
Posts: 1214
Location: Massachusetts USA

PostPosted: Wed Nov 03, 2010 2:28 am    Post subject: Reply with quote

See https://forums.gentoo.org/viewtopic-p-4588037.html#4588037 for how to reference disks by UUID in fstab and grub. It is also possible to reference partitions by labels.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum