TrueNAS had been working with one disk for data for some time. It was time to install a second one. What could be simpler? I installed the disk physically, logged in. The UI found the new disk, offered to choose a new pool or add to an existing one. I chose existing.
And then something went wrong. It suggests stripe mode (increases speed, but decreases reliability), not mirroring.
Most likely, because it created another swap for some reason during the initial installation:
root@nas[~]# parted /dev/sdc unit s print
Model: JMicron Tech (scsi)
Disk /dev/sdc: 7814037168s
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 128s 4194304s 4194177s swap
2 4194432s 7814037134s 7809842703s zfs
So no mirrors through the UI.
Well, let’s go to the console. Switch to root (sudo su -) and create the same partitions:
parted /dev/sdc unit s print
parted /dev/sdb mktable gpt
parted /dev/sdb mkpart primary linux-swap 128s 4194177s
parted /dev/sdb mkpart primary zfs 4194432s 7814037134s
root@nas[~]# parted /dev/sdb unit s print
Model: JMicron Tech (scsi)
Disk /dev/sdb: 7814037168s
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 128s 4194177s 4194050s primary swap
2 4194432s 7814037134s 7809842703s primary
root@nas[~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 238.5G 0 disk
|-sda1 8:1 0 1M 0 part
|-sda2 8:2 0 512M 0 part
`-sda3 8:3 0 238G 0 part
sdb 8:16 0 3.6T 0 disk
|-sdb1 8:17 0 2G 0 part
`-sdb2 8:18 0 3.6T 0 part
sdc 8:32 0 3.6T 0 disk
|-sdc1 8:33 0 2G 0 part
|| `-sdc1 253:0 0 2G 0 crypt [SWAP]
`-sdc2 8:34 0 3.6T 0 part
There were some warnings about speed and the swap was created a bit differently, but we’re only interested in the second partition (the first can be deleted).
Now let’s actually attach it:
root@nas[~]# zpool status default-pool
pool: default-pool
state: ONLINE
scan: scrub repaired 0B in 14:56:00 with 0 errors on Tue Jul 23 05:26:02 2024
config:
NAME STATE READ WRITE CKSUM
default-pool ONLINE 0 0 0
1e6fd139-4e95-4a51-84ee-267773d9d463 ONLINE 0 0 0
errors: No known data errors
root@nas[~]# ls -l /dev/disk/by-partuuid
total 0
lrwxrwxrwx 1 root root 10 Aug 17 20:47 0602e2ac-4edc-412f-a447-378046660829 -> ../../sdc1
lrwxrwxrwx 1 root root 10 Aug 17 20:35 082ae472-b688-4925-aacd-ec032b56a66d -> ../../sda3
lrwxrwxrwx 1 root root 10 Aug 17 20:47 1e6fd139-4e95-4a51-84ee-267773d9d463 -> ../../sdc2
lrwxrwxrwx 1 root root 10 Aug 17 20:49 35e8f7f0-ff98-4392-a529-b613605fe98f -> ../../sdb1
lrwxrwxrwx 1 root root 10 Aug 17 20:35 9c1d90c0-beba-4aeb-9e94-4f539401199e -> ../../sda2
lrwxrwxrwx 1 root root 10 Aug 17 20:49 f09d7c50-0423-46e2-b1e1-5947f269731a -> ../../sdb2
lrwxrwxrwx 1 root root 10 Aug 17 19:48 f4d2e993-32a7-4982-9d32-f9b7abce9754 -> ../../sda1
# main command
zpool attach default-pool /dev/disk/by-partuuid/1e6fd139-4e95-4a51-84ee-267773d9d463 /dev/disk/by-partuuid/f09d7c50-0423-46e2-b1e1-5947f269731a
root@nas[~]# zpool status default-pool
pool: default-pool
state: ONLINE
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 Sat Aug 17 20:55:33 2024
282G scanned at 7.04G/s, 1.58M issued at 40.4K/s, 1.81T total
0B resilvered, 0.00% done, no estimated completion time
config:
NAME STATE READ WRITE CKSUM
default-pool ONLINE 0 0 0
mirror-0 ONLINE 0 0 0
1e6fd139-4e95-4a51-84ee-267773d9d463 ONLINE 0 0 0
f09d7c50-0423-46e2-b1e1-5947f269731a ONLINE 0 0 0
errors: No known data errors
Synchronization took about 30 hours: a lot, but the NAS worked calmly, without any high loads.
It’s just unclear how an unprepared person should do this. TrueNAS is still a bit complex (where did that swap come from initially? and there’s no partition support in the UI).
Well, and initially it booted from one disk (SSD). I also decided to install a new disk, as bad sectors had already appeared on the old one (and it could die completely at any moment). In this case, there is a UI, but it’s a bit hidden: https://www.truenas.com/docs/core/coretutorials/systemconfiguration/mirroringthebootpool . It took literally a few minutes to synchronize, there’s really up to 10 GB of data there (which is adequate for an OS without data).