Replacing ZFS disk

Over on How to replace a failed disk in a ZFS mirror I found this command:

# sudo zpool replace -f storage 18311740819329882151 /dev/disk/by-id/ata-WDC_WD80EFAX-68LHPN0_7HJSWL7F

I’m gonna need that later on.
The number is the old device and the path is the new device.

Update. This is done.

-------------------
Tue Feb 21 21:31:53 [bash:5.1.16 jobs:0 error:0 time:3]
root@order:/home/jj5
# zpool replace -f data 12987390290044433012 /dev/disk/by-id/ata-WDC_WD30EFZX-68AWUN0_WD-WX72D1273L06
-------------------
Tue Feb 21 21:55:32 [bash:5.1.16 jobs:0 error:0 time:1422]
root@order:/home/jj5
# zpool status
  pool: data
 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 Tue Feb 21 21:34:26 2023
        749G scanned at 605M/s, 88.2G issued at 71.1M/s, 5.71T total
        27.9G resilvered, 1.51% done, 23:01:31 to go
config:

        NAME                                             STATE     READ WRITE CKSUM
        data                                             DEGRADED     0     0     0
          raidz1-0                                       DEGRADED     0     0     0
            ata-WDC_WD30EFRX-68EUZN0_WD-WMC4N0D8E3C9     ONLINE       0     0     0
            replacing-1                                  DEGRADED     0     0     0
              12987390290044433012                       UNAVAIL      0     0     0  was /dev/disk/by-id/ata-WDC_WD30EFRX-68EUZN0_WD-WMC4N2473766-part1
              ata-WDC_WD30EFZX-68AWUN0_WD-WX72D1273L06   ONLINE       0     0     0  (resilvering)
            ata-WDC_WD30EFRX-68EUZN0_WD-WMC4N0D5506W     ONLINE       0     0     0
        cache
          ata-WDC_WDS120G1G0A-00SS50_171905A00F49-part4  ONLINE       0     0     0

errors: No known data errors
-------------------

Removing PowerStor Aerogel from OGXbox

Today I watched PSA: Your Original Xbox may be ROTTING AWAY right now… which explained how to remove the PowerStor Aerogel cap from an OGXbox. These capacitors are known to leak and cause corrosion. Indeed when I popped the motherboard out of my console the PowerStor had pissed itself all over the board. So I desoldered it and took it out and cleaned up its mess with a liberal application of isopropyl. I was thinking I’d replace it with a new component but I found this which basically said it’s cheaper and more reliable to just leave it out. So up next is replacing the 3000uF 6.3V caps next to the CPU, I’ve ordered a bunch of these ones, which I hope will do the trick!

Below you can see the dead cap. It’s a bit blurry but you can see the corrosion. I’m gonna start a collection!

Replace a disk in a ZFS pool

So smartd is suddenly emailing me about problems with one of the disks in my ZFS zpool. I have ordered a replacement disk and am waiting for it to arrive. While the smartd email says there is a problem `zpool status` says everything is fine. So I’m running a `zpool scrub` to see if ZFS can pick up on the disk errors.

Preparing for the disk replacement I searched the web and found Replace a disk in a ZFS pool.

I found the serial number of the faulty disk with `lsblk -I 8 -d -o NAME,SIZE,SERIAL`. The process is then:

  1. Shutdown the server
  2. Replace the faulty disk
  3. Boot the server
  4. Run zpool replace: sudo zpool replace data sdc
  5. Check zpool status: sudo zpool status data

I hope it turns out to be that easy! Now I just wait for my scrub to complete and my disk to arrive.

Update

Click through on the link below for some excellent documentation about how to handle this error:

Every 2.0s: zpool status                                              love: Fri Apr 30 07:52:40 2021

  pool: data
 state: ONLINE
status: One or more devices has experienced an unrecoverable error.  An
        attempt was made to correct the error.  Applications are unaffected.
action: Determine if the device needs to be replaced, and clear the errors
        using 'zpool clear' or replace the device with 'zpool replace'.
   see: http://zfsonlinux.org/msg/ZFS-8000-9P
  scan: scrub in progress since Thu Apr 29 02:30:54 2021
        4.32T scanned out of 5.03T at 42.9M/s, 4h48m to go
        466K repaired, 85.93% done
config:

        NAME         STATE     READ WRITE CKSUM
        data         ONLINE       0     0     0
          mirror-0   ONLINE       0     0     0
            sda      ONLINE       0     0     0
            sdb      ONLINE       0     0     0
          mirror-1   ONLINE       0     0     0
            sdc      ONLINE       0     0     4  (repairing)
            sdd      ONLINE       0     0     0
        cache
          nvme0n1p4  ONLINE       0     0     0

errors: No known data errors

Replacing new lines with nulls in bash

If you have a list of file names separated by new lines, and you want to turn it into a list of file names separated by null characters, for instance for use as input to xargs, then you can use the tr command, like this:

  $ cat /path/to/new-lines | tr '\n' '\0' > /path/to/null-separated

I found a whole article on various ways to replace text on *nix: rmnl — remove new line characters with tr, awk, perl, sed or c/c++.