One of the two USB drives you’re running your OS on (in ZFS mirror on root)(to get full use of SATA / SAS ports) failed.
Oh Noes!
*Let’s keep in mind, this is ZFS on root, need to mirror partition to new disk prior to adding zpool*
(For good measure, here’s what things look like when we’re still good:)
root@MikroBSD:/home/colin # zpool status zroot
pool: zroot
state: ONLINE
scan: none requested
config:
NAME STATE READ WRITE CKSUM
zroot ONLINE 0 0 0
mirror-0 ONLINE 0 0 0
gpt/disk0 ONLINE 0 0 0
gpt/disk1 ONLINE 0 0 0
errors: No known data errors
root@MikroBSD:/home/colin # zpool scrub zroot
root@MikroBSD:/home/colin # zpool status zroot
pool: zroot
state: ONLINE
scan: scrub repaired 0 in 0h7m with 0 errors on Mon Mar 17 09:55:38 2014
config:
NAME STATE READ WRITE CKSUM
zroot ONLINE 0 0 0
mirror-0 ONLINE 0 0 0
gpt/disk0 ONLINE 0 0 0
gpt/disk1 ONLINE 0 0 0
errors: No known data errors
root@MikroBSD:/home/colin # gpart list|more
Geom name: da6
modified: false
state: OK
fwheads: 255
fwsectors: 63
last: 15131602
first: 34
entries: 128
scheme: GPT
Providers:
1. Name: da6p1
Mediasize: 65536 (64k)
Sectorsize: 512
Stripesize: 0
Stripeoffset: 20480
Mode: r0w0e0
rawuuid: f4757d9c-4d64-11e3-9615-00e04d2070bf
rawtype: 83bd6b9d-7f41-11dc-be0b-001560b84f0f
label: boot1
length: 65536
offset: 20480
type: freebsd-boot
index: 1
end: 167
start: 40
2. Name: da6p2
Mediasize: 1073741824 (1.0G)
Sectorsize: 512
Stripesize: 0
Stripeoffset: 86016
Mode: r1w1e1
rawuuid: 104facde-4d65-11e3-9615-00e04d2070bf
rawtype: 516e7cb5-6ecf-11d6-8ff8-00022d09712b
label: swap1
length: 1073741824
offset: 86016
type: freebsd-swap
index: 2
end: 2097319
start: 168
3. Name: da6p3
Mediasize: 6442450944 (6.0G)
Sectorsize: 512
Stripesize: 0
Stripeoffset: 1073827840
Mode: r1w1e2
rawuuid: 4cc50657-4d65-11e3-9615-00e04d2070bf
rawtype: 516e7cba-6ecf-11d6-8ff8-00022d09712b
label: disk1
length: 6442450944
offset: 1073827840
type: freebsd-zfs
index: 3
end: 14680231
start: 2097320
Consumers:
1. Name: da6
Mediasize: 7747397632 (7.2G)
Sectorsize: 512
Mode: r2w2e5
Geom name: da7
modified: false
state: OK
fwheads: 255
fwsectors: 63
last: 15131602
first: 34
entries: 128
scheme: GPT
Providers:
1. Name: da7p1
Mediasize: 65536 (64k)
Sectorsize: 512
Stripesize: 0
Stripeoffset: 20480
Mode: r0w0e0
rawuuid: f19cb150-4d64-11e3-9615-00e04d2070bf
rawtype: 83bd6b9d-7f41-11dc-be0b-001560b84f0f
label: boot0
length: 65536
offset: 20480
type: freebsd-boot
index: 1
end: 167
start: 40
2. Name: da7p2
Mediasize: 1073741824 (1.0G)
Sectorsize: 512
Stripesize: 0
Stripeoffset: 86016
Mode: r1w1e1
rawuuid: 0c6b8af1-4d65-11e3-9615-00e04d2070bf
rawtype: 516e7cb5-6ecf-11d6-8ff8-00022d09712b
label: swap0
length: 1073741824
offset: 86016
type: freebsd-swap
index: 2
end: 2097319
start: 168
3. Name: da7p3
Mediasize: 6442450944 (6.0G)
Sectorsize: 512
Stripesize: 0
Stripeoffset: 1073827840
Mode: r1w1e2
rawuuid: 4a10de85-4d65-11e3-9615-00e04d2070bf
rawtype: 516e7cba-6ecf-11d6-8ff8-00022d09712b
label: disk0
length: 6442450944
offset: 1073827840
type: freebsd-zfs
index: 3
end: 14680231
start: 2097320
Consumers:
1. Name: da7
Mediasize: 7747397632 (7.2G)
Sectorsize: 512
Mode: r2w2e5
(Major Meltdown!:)
root@MikroBSD:/home/colin # zpool status zroot
pool: zroot
state: DEGRADED
status: One or more devices has been removed by the administrator.
Sufficient replicas exist for the pool to continue functioning in a
degraded state.
action: Online the device using ‘zpool online’ or replace the device with
‘zpool replace’.
scan: scrub repaired 0 in 0h7m with 0 errors on Mon Mar 17 09:55:38 2014
config:
NAME STATE READ WRITE CKSUM
zroot DEGRADED 0 0 0
mirror-0 DEGRADED 0 0 0
6049986084420409860 REMOVED 0 0 0 was /dev/gpt/disk0
gpt/disk1 ONLINE 0 0 0
errors: No known data errors
Ripping out the USB drive on my custom 9.2 kernel hosed my USB bus. Forced to reboot.
Now, my kernel recognized the new USB drive as da8. We need to recreate the partition layout:
root@MikroBSD:/home/colin # gpart backup da6|gpart restore da8
root@MikroBSD:/home/colin # gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 da8
bootcode written to da8
#relabel partitions:
root@MikroBSD:/home/colin # gpart modify -i1 -l boot2 da8
da8p1 modified
root@MikroBSD:/home/colin # gpart modify -i2 -l swap2 da8
da8p2 modified
root@MikroBSD:/home/colin # gpart modify -i3 -l disk2 da8
da8p3 modified
*I had to reboot to get my new GPT partition to show up by label in /dev/gpt
root@MikroBSD:/home/colin # ls /dev/gpt
boot1 boot2 disk1 disk2 swap1 swap2
Now we need to replace the faulted drive with the new one:
root@MikroBSD:/home/colin # zpool replace zroot /dev/gpt/disk0 /dev/gpt/disk2
Make sure to wait until resilver is done before rebooting.
If you boot from pool ‘zroot’, you may need to update
boot code on newly attached disk ‘/dev/gpt/disk2’.
Assuming you use GPT partitioning and ‘da0’ is your new boot disk
you may use the following command:
gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 da0
root@MikroBSD:/home/colin # zpool status zroot
pool: zroot
state: DEGRADED
status: One or more devices is currently being resilvered. The pool will
continue to function, possibly in a degraded state.
action: Wait for the resilver to complete.
scan: resilver in progress since Mon Mar 17 11:50:58 2014
13.5M scanned out of 4.18G at 494K/s, 2h27m to go
12.6M resilvered, 0.32% done
config:
NAME STATE READ WRITE CKSUM
zroot DEGRADED 0 0 0
mirror-0 DEGRADED 0 0 0
replacing-0 REMOVED 0 0 0
6049986084420409860 REMOVED 0 0 0 was /dev/gpt/disk0
gpt/disk2 ONLINE 0 0 0 (resilvering)
gpt/disk1 ONLINE 0 0 0
errors: No known data errors
Let it resilver – CELEBRATE!!