Page 1 of 1

SATA disk order on boot...

Posted: August 28th, 2011, 4:50 pm
by fpp
More fun with Ubuntu and disk drives... Here is something I noticed after adding all the disks.

My motherboard has 5 SATA ports. Ports 1 to 4 are grouped together on the back panel, and port 5 sits by itself inside the motherboard.

I plugged the system disk (SSD) in port 5 and the Samsung spindles in ports 1 to 4.

What happens now is this (as I understand it, at least) :

When the server powers up (cold boot), the SSD comes online immediately, while the regular drives take some time spinning up and initializing.
The result is :
/dev/sda : SSD (port 5)
/dev/sdb : Disk1 (port 1)
/dev/sdc : Disk2 (port 2)
/dev/sdd : Disk3 (port 3)
/dev/sde : Disk4 (port 4)

But if I just reboot the server while everything is running, SATA port numbers get precedence :
/dev/sda : Disk1 (port 1)
/dev/sdb : Disk2 (port 2)
/dev/sdc : Disk3 (port 3)
/dev/sdd : Disk4 (port 4)
/dev/sde : SSD (port 5)

More scary stuff, although again everything works fine in both cases, thanks to the magic of partition IDs
(which is why I resent Webmin making it difficult :-)

However, commands that use device names directly (like your temperature and spindown scripts) will not work consistently depending on how the machine was booted, which could be a problem (you don't want to spin down your system drive :-).

Fortunately, things like hdparm and smartctl will happily accept names like /dev/disk/by-label/DRU1 instead of /dev/sda, which is a lot more dependable.
(for smartctl you need to add '-d ata' to the command line)

This is one place where file system labels come in real handy : in $MyList you put a list of labels instead of drive letters.
As a bonus the output is more explicit.

Re: SATA disk order on boot...

Posted: August 28th, 2011, 5:44 pm
by Ian
Hi fpp, scary stuff indeed! :shock: I'm guessing this must be pertinent to SSD disks because mine (all spinning SATA disks) are labelled consistently no matter what I do.

I tried googling to see if anyone else is seeing the same but I couldn't find anything at all (might be a bad choice of search terms by me I guess).

Re: SATA disk order on boot...

Posted: August 28th, 2011, 6:17 pm
by fpp
Yup, the system SSD seemed like a good idea at the planning stage, but it does have its downsides...

Hence, partition UUIDs and labels FTW ! :-)