TrueNAS Adding a second disk to a vDev and converting the vDev from a single disk to a 2 disk mirrored vDev using the shell and not losing data.
After setting up and configuring TrueNAS with 1 drive we are able to get a second drive and configure the TrueNAS to recognize the pool as a Mirrored vDev without losing the data we have acquired since the initial setup.
This is important since replacing a drive or adding redundancy to important data is necessary, and this allows us to setup TrueNAS and start using our disks right away even when we don’t have all of them on hand during the initial setup.
After adding the disk to the TrueNAS Machine initialize it with the following:
In Storage > Disks
Select your new disk and select WIPE, Confirm. Then we can navigate to the shell and use the following commands.
Take note of the NAME of the new disk.
Here are the commands to use:
Find the zpool ID’s:
zpool status
Find the glabels for each disk:
glabel status
Create the partition table
gpart create -s gpt /dev/<disk>
Add SWAP partition to the disk:
gpart add -i 1 -b 128 -t freebsd-swap -s 2g /dev/ <disk>
Add the freebsd ZFS Partition
gpart add -i 2 -t freebsd-zfs /dev/ <disk>
See the new disks glabels:
glabel status
Add disks together:
zpool attach <POOL NAME> /dev/gptid/<GPTID of first disk> /dev/gptid/<GPTID of New disk ZFS partition>
Check that the disks are resilvering:
zpool status