HD labeling/device mapping
Hi,
I am a new comer to the Linux word. Therefor, please bear with me. The device labeling (especially the HDs) confuses me all the time in linux. For example: If I have two HDs, let's say (HDA and HDB), if they are mapped as: HDA--> sda and HDB---> sdb for specific configuration. In case I go and change their SATA connectors' location on the main board (I basically plug out HDA and plug into a different slot and same with HDB), would that effect their labeling? Basically, might HDA become sdc and let's say HDB might become sda? How does the linux in general decide to label those HDs? Thanks |
Hi RWTH
That is exactly what would happen. The OS detects your devices in a certain order in terms of the actual SATA channels; thus if you swop your drives between the 2 SATA channels - the OS will detect the channels in the same order (and not the drives). In other words; if you have HDA/sda connected to SATA Channel 1 and HDB/sdb connected to SATA Channel 2; and then you swop the drives around physically; HDB will become sda and HDA will become sdb on an OS level. |
Thanks Yas,
That means as long as I don't touch the physical location of a HD, then the labeling should remain the same? My concern is that I try to setup RAID array and if I replace a bad HD with a new one (which is empty of course) and start rsync the HDs, then the empty one could accidently overwrite the good one, such that I would end up with two empty HDs :). What you are saying that's not possible, because as long as I use the same slot, the numbering will be the same. On the other hand, I tried to give fix and reasonable names via writing udev rules. Are you familar with udev? |
Hi RWTH,
Yes the device identifier (sda/sdb) should stay the same. I am familiar with udev (not an expert) but I don't think you need to do this in your situation. If you had to lose one drive; the other drive would retain its device identifier allocation; based on the fact that its still on the same SATA channel. |
You could look at /dev/disk/by-uuid
|
Hi Yas,
Still I gave a try for fix labels, but it didn't work. Maybe you have a quick idea: Here is what I did: In the "10-local-rules" file, I put the following line: ********************************************************* SYSFS{size}=="156301488", SYSFS{model}=="ST380815AS", SYMLINK="swap_hd_ln" ******************************************************* because when I run the command, udevinfo -a -p /sys/block/sda/, then I get the following: ****************************************************** looking at class device '/sys/block/sda': SYSFS{dev}="8:0" SYSFS{range}="16" SYSFS{removable}="0" SYSFS{size}="156301488" SYSFS{stat}=" 61 1386 2944 419 0 0 0 0 0 297 419" follow the class device's "device" looking at the device chain at '/sys/devices/pci0000:00/0000:00:07.0/host0/target0:0:0/0:0:0:0': BUS="scsi" ID="0:0:0:0" SYSFS{detach_state}="0" SYSFS{device_blocked}="0" SYSFS{model}="ST380815AS " SYSFS{queue_depth}="31" SYSFS{rev}="4.AA" SYSFS{scsi_level}="6" SYSFS{state}="running" SYSFS{timeout}="30" SYSFS{type}="0" . . . ******************************************************************** My understanding from the udev, that I should a symbolink to the /dev/sda from the point /dev/"swap_hd_ln". In general, will I have always the /dev/sda, because it is determined by the kernel, or can I get rid off it? |
I made a quick test:
1) I had 2 HDs connected on the MB, one small and one big HD. The small one was labeled as /dev/sda1 and the big one was labeled as /dev/sdb3, /dev/sdb2 and /dev/sdb1. 2) I removed the small HD from the MB by disconnecting its SATA connector from the back of the HD. 3) I rebooted the system and I get the following: /dev/sda3, /dev/sda2 and /dev/sda1. I thought in the step 3) everything should remain as /dev/sdb*, since I didn't change the SATA location for that HD. |
RWTH - No, it has become sba because that is the FIRST drive it picked up
a = 1st b = 2nd n = nth If you swapped the small disk for a CDRom for example, then the large hdd would still be showing up as sdb as the cdrom would become sda. Hope this makes sense and helps :) :) |
djsmiley2k is correct - you asked what would happen if you swopped the drives around in terms of your SATA channels.
Generally the OS detects a certain channel/device first (in my experience) so hence my explanation in post #2 and #4. If you remove 1 drive altogether; the OS will only detect the one HDD and it should become sda instead of sdb. Try swopping the drives and see what happens. |
I need to leave the office right now. I will update you, once I came back on Monday.
But as summary, as long as I keep the numbers of the HDs constant and I don't change the location of the good HDs and replace a bad HD, then I shouldn't get any problem with a labeling in a RAID array? |
Correct, as long as the number of drives is maintained, you should have no problems.
I'd hope (but I've never used one) that raid software would be able to identify which HDD has been removed and so can respond to you appropately - "Warning this HDD is empty" kind of thing. |
Hi,
If everybody is on the same page :), I swapped both HDs and the system didn't boot. Does it mean that the system couldn't find the boot section/program? In that case hardware should be able to scan the boot section/program in an order? Now this is more confusing! Once I had both HDs I could boot, even the big HD contained the OS and it was mapped as sdb*. Once the big HD was connected standalone then it was moved down to sda, which we could explain and still we could boot. After I swapped the HDs, then I would think that the hardware should scan all the HDs and would find out a boot able sector/program, but obviously it couldn't. Now, what is the mechanism? Thanks |
Hi,
If everybody is on the same page :), I swapped both HDs and the system didn't boot. Does it mean that the system couldn't find the boot section/program? In that case hardware should be able to scan the boot section/program in an order? Now this is more confusing! Once I had both HDs I could boot, even the big HD contained the OS and it was mapped as sdb*. Once the big HD was connected standalone then it was moved down to sda, which we could explain and still we could boot. After I swapped the HDs, then I would think that the hardware should scan all the HDs and would find out a boot able sector/program, but obviously it couldn't. Now, what is the mechanism to select/map the HD and boot? Thanks |
A failsafe solution would involve putting your bootloader on the MBR of all the drives and using UUIDs to identify partitions. Then you could install your drives in any order and it would still work.
|
All times are GMT -5. The time now is 05:20 PM. |