Oh yeah, a disk died, replacing it
So this is prettttttty much only for my benefit, but I had to replace a disk today on my FreeBSD 9.1-RELEASE machine and this was annoying.
Here’s not all of the steps, but some, because listing them all would cause a global DDoS over HTTP. (right, I have that kind of readship, zing!)
[root@storbox:~]# for i in {2..5}; do echo -n "ada${i} " ; camcontrol identify ada${i} 2>&1 | grep serial ; done
ada2 serial number 9XK0CF77
ada3 serial number W1F67NZW
ada4 serial number Z1F25BPT
ada5 serial number Z1F233F3
Then take apart your computer and cut the red wire.
Armed with those serials numbers, one could run this to find the disk you just plugged in, or you know, read the serial number off of it and look for it with camcontrol:
[root@storbox:~]# for i in {2..5}; do echo -n "$i " ; camcontrol identify ada${i} 2>&1 | egrep "Z1F233F3|Z1F25BPT|9XK0CF77" || echo "ada$i is new" ; done 1
2 serial number 9XK0CF77
3 ada3 is new
4 serial number Z1F25BPT
5 serial number Z1F233F3
Cool. Now the fun begins.
Yeah, 4k sectors. That seemed a good idea. I hear FreeBSD 10 has gotten rid of this whole step, but I don’t dare upgrade… because it mostly currently works, and I would rather that than it didn’t work and might have newer stuff.
So I think these are the steps I need to do next time a disk dies, I think!
[root@storbox:~]# gnop create -S 4096 ada3
[root@storbox:~]# gpart add -t freebsd-zfs -l replaced3 ada3
[root@storbox:~]# zpool replace store $( zpool status | awk ' /REMOVED/ { print $1}' ) /dev/gpt/replaced3
And then zpool status for some resilvering action…
In theory, this now has 4k sector sizes (gpart list confirms it), but who cares, because it’s added to the zpool and resilvering. I think. Now to hold tight for “5h32m to go”.
I’ve probably forgotten a step so this is useless, like the other 99% of blogs doing the same (thanks Internet), but I TRIED, okay, WHAT MORE DO YOU WANT?
The ‘zpool replace store olddisk newgptdisk’ to specify the disk to replace, and the ‘gpart add -t freebsd-zfs -l replaced3 ada3’ onced labelled are probably the most important bits…