Labeling SATA ports

Johan Hendriks joh.hendriks at gmail.com
Wed Apr 2 10:33:37 UTC 2014


Tobias Famulla schreef:
> Hello,
>
> I use a server with several HDDs in one enclosure. I use ZFS which
> identifies the disks via UUID, so the system knows which HDDs are in the
> slots, eventhough the naming (ada0...) might change.
> I added the HDDs one after another to map the the slots to the 'scbus',
> 'target' and 'lun', shown via camcontrol.
> Now I would like to label the slots (not the partitions or drives,
> because this is done by ZFS) to a name like (slot0...slot7) to put a
> sticker on the enclosure to be easily able to change a HDD with a
> failure and do not have to guess in which slot the HDD is located.
> Of course i could write the scbus, target and lun number on the slots,
> but is there an easier way to map these numbers (the physical SATA port)
> to a name, for example by using camcontrol or anything else?
>
> I imaging changing a drive like this: zpool tells me a drive has a
> defect, do 'zpool detach tank slot5', go to the server room and put a
> new drive in slot with number 5 printed on it, do 'zpool attach tank
> slot5', be happy.
>
> Cheers,
>
> Tobias
> _______________________________________________
> freebsd-questions at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe at freebsd.org"
I took another route.
I label my disks with gpart. Then I label the drive with a sticker 
matching the gpart label.
I create the pool using the gpt labels so I always know which disk is where.
This way if zpool tells me disk5 is offline or bad, I can walk into the 
server room and replace disk5.
Even if someone takes out all the disk, shuffles them and insert them in 
another slot, if zpool tells me disk5 is bad, then i yank out the disk 
with the sticker disk5

I create my disks like this. ( da0, da1 ....)
I insert a disk and then I do the gpart thing, and sticker the disk

# gpart create -s GPT /dev/da0
# gpart add -t freebsd-zfs -a4k -l DISK0 /dev/da0
Print a sticker with DISK0 and put it on the front of the disk.

Insert the next disk, look which device it is and do the gpart thing again
# gpart create -s GPT /dev/da1
# gpart add -t freebsd-zfs -a4k -l DISK1 /dev/da1
Print a sticker with DISK1 and put it on the disk.

Then I create the pool  (a mirror in this example) I did not do the 
gnop  trick because my example drives are 4k formatted :D.
# zpool create tank mirror gpt/DISK0 gpt/DISK1

backup02 ~ # zpool status
   pool: tank
  state: ONLINE

         NAME           STATE     READ WRITE CKSUM
         tank              ONLINE       0     0     0
           mirror         ONLINE       0     0     0
             gpt/DISK0  ONLINE       0     0     0
             gpt/DISK1  ONLINE       0     0     0

errors: No known data errors

So now even if disks are shuffled around, and even if they change from 
da(x) to ada(x) as they are in a different box with different hardware, 
it does not matter any more.
DISK0 is still DISK0

regards
Johan





More information about the freebsd-questions mailing list