This section covers Network Attached Storage (NAS) and Storage Area Networks (SAN).
This the multi-page printable view of this section.Click here to print.
This section covers Network Attached Storage (NAS) and Storage Area Networks (SAN).
Technically TrueNAS Core is FreeBSD and not Linux but this section contains notes for both TrueNAS as well as accessing it from Linux based machines.
If you want to replace a disk in a ZFS pool you normally do it from the UI, selecting a spare drive that is at least the same size as the one to replace, then use it as the replacement for the original drive. An hour or so later the new drive has been populated with the data from the old one and the original disk is removed from the pool so that it can be replaced.
In my instance I was upgrading a two-drive pool from two 2TB drives to two 4TB drives, so I had to replace each one, one at a time by installing the new drive in a spare bay, then get ZFS to replace the original disk with the new one.
This works fine as long as the new drive is the same size or larger than the original.
In TrueNAS Core 13.0-Release, that process is broken and you have to use a script to perform this task.
Now that script works fine and the link above does show how to do it, but one issue I had was that TrueNAS uses gptid's as the identifiers in the pool, so how do I map the actual gptid to remove to the disk?
If this was replacing a degraded disk then that's not a problem as it would show, but in my case I was increasing the size so the drive's state is ONLINE so not easily identifiable.
Run zpool status <pool name>
where <pool name>
is the name of the
Pool.
In this example it's Pool1
Here we have 2 disks, ada1 which is the one to replace and is a member of the pool and ada2 which is our new one. In the TrueNAS UI we don't see gptid's so we need to identify which one of the above relates to the ada1 disk.
To do this we can use the glabel status
command which lists the mappings:
From this we can see that drive ada1 partition 2 (ada1p2) maps to gptid/746cf510-8712-11ea-b4bb-28924a2f0b10 which is what we need.
First download the tool, either with
curl -s https://raw.githubusercontent.com/truenas/gist/main/replace_disk.py -o
replace_disk.py
or the copy listed in the Resources' section at the top right of this page.
Next run it with python3 replace_disk.py <pool_name> <gptid/####> <ada#>
substituting the pool_name, gptid and ada parameters:
You should then see it appear in the UI that it's now replacing the disk and the ETA on when it will complete.