[SOLVED] Hard Drive naming question

The place to post if you need help or advice

Moderators: ChriThor, LXF moderators

[SOLVED] Hard Drive naming question

Postby jmangan » Sun Apr 23, 2017 2:33 pm

I recently tried to move a group of three software RAID-ed disks from one machine to another for a quick performance upgrade. I hoped that the startup hardware detection would smooth over any slight issues and I could sort the rest out without having to do a complete rebuild. Well it didn't work; I think the fact that I had also RAID-ed the boot partition meant that the system couldn't mount /boot so I would have needed to do a partial rebuild to get it all loaded. I didn't want to risk breaking a working system, I was short of time and also didn't need the hassle so I reverted the disks.

Then I decided that a better approach would be to use two small-ish disks as a RAID 'system' and stick all of my data on a separate stack of disks. Then, when upgrade time came round, I could build a new minimal system and just migrate the data stack over. And here's my problem.

I'm using CentOS 7 on an Asus M4A78LT-M motherboard. This has six on-board SATA ports. I have 2* 250GB disks (for the system) and 3* 3TB disks for all of the data. So I want the small disks to be /dev/sda, /dev/sdb and the 'data' disks to be sdc, sdd, sde. I have a DVD reader on SATA port 6.

When the PC boots up the board recognises the disks in the correct/cabled order but when the installation screen comes up the disks are ordered: 3TB, 250GB, 3TB, 250GB, 3TB? ('System' disks are sdb/sdd).

The SATA ports can be set as RAID (don't want to use this because of hardware dependence), AHCI (1-3, 4-6) or IDE (1-3, 4-6).

If 1-3 are IDE then 4-6 MUST be IDE. For devices 5-6 to be recognised before the OS loads 4-6 MUST be IDE. I tried 1-3(AHCI), 4-6 (IDE) and then 1-3/4-6 (IDE) but with no difference.

Then I tried 1-3,4-6 (AHCI) and connected a DVD reader to the IDE port (disconnected SATA 6). Now the drives are seen as 250GB, 3TB, 250GB, 3TB, 3TB ('System' disks are sda/sdc).

Anyone know what's going on? Everything I've looked at suggests that disks should be named/numbered according to the SATA ports they're connected to?

Not too bothered about whether my original scheme will work or not now but I would REALLY like to know why this is happening.

Thanks.
Last edited by jmangan on Mon Apr 24, 2017 8:05 pm, edited 1 time in total.
jmangan
 
Posts: 64
Joined: Fri Apr 29, 2005 7:37 am

Re: Hard Drive naming question

Postby Dutch_Master » Sun Apr 23, 2017 4:27 pm

Essentially there 2 methods, each with pro's and con's.
1) write udev rules that force particular disks into either of the arrays, based on their UID
2) write mdadm rules to accomplish the same, again based on their UID

There is a 3rd method, use UID's of the disks to force fstab allocations of disk names. However, this method only really works with single disks, I'm not so sure on success with RAID, unless there's only one RAID in the machine.
Dutch_Master
LXF regular
 
Posts: 2586
Joined: Tue Mar 27, 2007 1:49 am

Re: Hard Drive naming question

Postby jmangan » Sun Apr 23, 2017 4:52 pm

Dutch_Master, thanks for the suggestions - which I've come across elsewhere - I'm just wondering what is determining the disk naming at the point of installation?

It can't be SATA port for the reasons given, it can't be disk serial nos (or similar) because it changes with use of AHCI/IDE. It can't be disk sizes because it interleaves the different sizes, it can't be random because the ordering is deterministic for a specific configuration.

I'm thinking I could just do the installation with the two 'system' drives attached which would presumably set them as sda/sdb and then add the other drives to the running config but I would REALLY like to know how it's getting the current ordering.

Thanks for the response.
jmangan
 
Posts: 64
Joined: Fri Apr 29, 2005 7:37 am

Re: [SOLVED] Hard Drive naming question

Postby jmangan » Mon Apr 24, 2017 8:13 pm

Solved it by installing with just my two 'system' drives connected - came up as sda and sdb.

Then I installed one more drive on SATA Port 3 and, sure enough, it went in as sdb and sdb moved to sdc.

So I looked in /dev/disks/by-path to find that the disks were showing up as pci-0000:00:11.0-ata-N.0........

So
SATA Port 1 -> N=1
SATA Port 2 -> N=3
SATA Port 3 -> N=2
SATA Port 4 -> N=4
SATA Port 5 -> N=5
SATA Port 6 -> N=6

and CentOS was clearly ordering the disks by 'N'. Presumably when the different IDE/AHCI options are chosen these numbers change slightly as well. Just a bit confusing that the disks always show up int eh BIOS boot screen in the expected order.

Some oddity of the board I suppose but hope this may help someone else.
jmangan
 
Posts: 64
Joined: Fri Apr 29, 2005 7:37 am

Re: [SOLVED] Hard Drive naming question

Postby nelz » Tue Apr 25, 2017 7:20 am

If you use UUIDs rather than device names, the port ordering doesn't matter.
"Insanity: doing the same thing over and over again and expecting different results." (Albert Einstein)
User avatar
nelz
Site admin
 
Posts: 9041
Joined: Mon Apr 04, 2005 11:52 am
Location: Warrington, UK

Re: [SOLVED] Hard Drive naming question

Postby jmangan » Tue Apr 25, 2017 9:29 am

Nelz, I was aware of that but I wanted to understand why the disks weren't appearing in the expected order.

I still have my long term plan of potentially moving my data disk 'stack' from one machine to another and I really wanted to be sure that each disk was the one I thought it was and to understand how it would be named.

And it passed an hour or two . . . .
jmangan
 
Posts: 64
Joined: Fri Apr 29, 2005 7:37 am

Re: [SOLVED] Hard Drive naming question

Postby nelz » Tue Apr 25, 2017 10:08 am

There is no guaranteed order for disk naming, so any expectations you may have are subject to change. That's why we use UUID and filesystem labels. This is even more important if you want to be able to move disks between machines.
"Insanity: doing the same thing over and over again and expecting different results." (Albert Einstein)
User avatar
nelz
Site admin
 
Posts: 9041
Joined: Mon Apr 04, 2005 11:52 am
Location: Warrington, UK

Re: [SOLVED] Hard Drive naming question

Postby jmangan » Tue Apr 25, 2017 4:22 pm

Yes, I've seen that. But now I know, for my disks, that sdc IS the disk in SATA Port 2, sdd IS the disk in SATA Port 4, etc. so I at least know which is which. I'm assuming (perhaps incorrectly) that for the RAID to work the disks need to be in the right order if not necessarily the same names

You have also implied an answer to a question I hadn't asked that UUIDs are written or preserved on the disks when moved between machines. Good to know.

Thanks.
jmangan
 
Posts: 64
Joined: Fri Apr 29, 2005 7:37 am

Re: [SOLVED] Hard Drive naming question

Postby nelz » Tue Apr 25, 2017 7:37 pm

The UUID is a feature of the disk, so it won't change. The device node depends on the kernel drivers, their loading order BIOS settings, whet else you may have connected and the phase of the moon. The only guarantee with them is that there are no guarantees. The RAID will be assembled correctly as long as all the drives are identified, it does not matter on which order.
"Insanity: doing the same thing over and over again and expecting different results." (Albert Einstein)
User avatar
nelz
Site admin
 
Posts: 9041
Joined: Mon Apr 04, 2005 11:52 am
Location: Warrington, UK


Return to Help!

Who is online

Users browsing this forum: No registered users and 7 guests

cron