Drive Label to Physical SATA Port
I have a server with multiple hard drives in it. Because I won't have physical access to this server, I need a way to tell someone which drive to pull out in event of a drive failure. Because of the way linux labels drives, I have no guarantee that /dev/sda is on SATA port 1.
Is there a command that shows me which drive in /dev/ is connected to which SATA port? The output should give me something like:
/dev/sda ==> SATA 3
/dev/sdb ==> SATA 1
/dev/sdc ==> SATA 2
teammatt3 posted this at 03:17 — 24th April 2009.
He has: 2,102 posts
Joined: Sep 2003
Well my searching isn't turning up much. You can write the drive serial and model number on the outside of the drive, and look it up using `hdparm -i /dev/sdb1` where sdb1 is your failed drive (identified by `mdadm --details /dev/md0`)
The other option is to use `dd if=/dev/sdb1 of=/dev/null` and see which hard drive light flashes.
Seems like there should be a better way
greg posted this at 03:45 — 24th April 2009.
He has: 1,581 posts
Joined: Nov 2005
I did have a search for you when you posted this, but I also found nothing.
Well, more to the point, as I'm sure you have found, the keywords for the searching of this issue are all individually weighty.
And Google in its infinite wisdom places weight on them all individually, thereby returning a bunch of useless results with the keywords taken out of context as they are found separately and individually throughout people's pages.
And of course using quotes (") for a phrase search even with minimal keywords returns
(sorry for the temporary thread hijack for a Google-bash, but I'm sure you felt the pain too while searching for this)
I'm not 100% up with mounting and whatnot, and you said that Linux wont mount drives on specific connections, but can't you make it mount them specifically to connections so you will know where they are?
I'm guessing this is beyond the realms of the fstab, but there is surely a way to either list them like you originally wanted, or make it use what you tell it.
In my experience so far with Linux, total control over devices, functions and the system in general is what Linux is good for.
pr0gr4mm3r posted this at 09:37 — 24th April 2009.
He has: 1,502 posts
Joined: Sep 2006
I would ask the datacenter what their procedure is. I'm sure they deal with failed hard drives pretty regularly.
teammatt3 posted this at 01:31 — 25th April 2009.
He has: 2,102 posts
Joined: Sep 2003
Good idea. I just did, and didn't get anything out of them. They said most of their customers use hardware raids, which I want to avoid.
That's what I'm looking for. And so far, no luck.
Natcoweb.com posted this at 13:44 — 7th May 2009.
They have: 14 posts
Joined: Mar 2009
lsscsi command is the simplest i can think of.
It allows you to see the list of devices and their attributes, as in my case
# lsscsi
[0:0:0:0] disk ATA WDC WD1002FBYS-0 03.0 /dev/sda
[1:0:0:0] disk ATA WDC WD1002FBYS-0 03.0 /dev/sdb
[2:0:0:0] disk ATA WDC WD1002FBYS-0 03.0 /dev/sdc
[3:0:0:0] disk ATA WDC WD1002FBYS-0 03.0 /dev/sdd
the first column is bus id that hdd is connected.
logically, the first sata port is connected to the first hdd bay, the second port to the second correspondingly...
more about scsi here http://www.ibm.com/developerworks/wikis/display/LinuxP/SCSI+-+Hot+add,+r...
hope this has helped
teammatt3 posted this at 00:27 — 8th May 2009.
He has: 2,102 posts
Joined: Sep 2003
That's some interesting info, but those numbers don't correspond to the mapping of sata port to serial number in the BIOS.
That output of lsscsi is more readable than hdparm so I'll be using that when I identify failed drives. Thanks.
Shaggy posted this at 16:31 — 8th May 2009.
They have: 121 posts
Joined: Dec 2008
Any provider I've been with has typically run a diagnostic to tell them which drive to replace. In any instance where they've had to pull one (Oddly, I've had cables go bad more often than drives), they've sent me a request to confirm the one they're going to pull, along with its /dev entry and filesystem mount point (if applicable).
I imagine most providers do similar, though it is a bit disconcerning to not get that type, or any answer when requested...
Cheers,
Shaggy.
nas123 posted this at 11:01 — 16th May 2012.
They have: 3 posts
Joined: May 2012
Hi teammatt3,
Did u manage to solve your issue. i want to some how identify my sata drives which are hot swapple trays, and mount them to specify folders.
this is so i can interchange harddrives and depending on which tray i place the harddirve in, it will be mounted to the folder associated with that sata tray.....
thanks guys
teammatt3 posted this at 02:38 — 17th May 2012.
He has: 2,102 posts
Joined: Sep 2003
Nope, I haven't solve the problem. Someone posted a similar question on a different site, but I tried both, and I can't find the relevant information.
It seems like a pretty useful piece of information. I can't imagine why it is so hard to find it!
Greg K posted this at 21:49 — 16th May 2012.
He has: 2,145 posts
Joined: Nov 2003
Could always do trial and error, assign each drive to a separate folder, yank a drive, and see which folder is now blank
-Greg
nas123 posted this at 11:11 — 18th May 2012.
They have: 3 posts
Joined: May 2012
-Greg
Hi Greg,
its not a plug and play issue... the way udev works it will assign a mount point like sdb..sdc and so on to wat ever is plugged in regardless of where it is plugged..in regards to hot plug trays. (just dont quote me on it lol, as there is more to it then tht)
so instead of it doing this i would like there to be persistance in regards to the sata trays.
thanks.
nas123 posted this at 11:07 — 18th May 2012.
They have: 3 posts
Joined: May 2012
Been trying for a few days now and still meeting obstacles in the way.. so surprised why there is no way of doing this as logically it shud be a matter of assigning some sort of udev rule..
but to assign the the udev rule is not the hard bit.... it is actually determining what is the Sata Port to assin the Udev rule to....
i found this very usefull but still no Cigar...!
http://wiki.kotelett.no/wiki/index.php/Udev
ptaach posted this at 22:58 — 7th January 2013.
They have: 4 posts
Joined: Jan 2013
Just use smart data to get serial number of a failed/working disk and pass it to support!
nholtz posted this at 15:08 — 9th September 2013.
They have: 2 posts
Joined: Sep 2013
If the drive is S.M.A.R.T. enabled, you can use 'smartctl' (in ubuntu package smartmontools)
to display results of tests. Documentation at
http://www.cyberciti.biz/tips/linux-find-out-if-harddisk-failing.html
what you want is probably
smartctl -H /dev/sdx
cheers
nholtz posted this at 15:12 — 9th September 2013.
They have: 2 posts
Joined: Sep 2013
Or, probably better docs at
https://wiki.archlinux.org/index.php/S.M.A.R.T.
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.