truenas:disks:add_a_second_disk_to_an_existing_pool_in_mirror_configuration_raid1
Table of Contents
TrueNAS - Disks - Add a Second Disk to an Existing Pool in Mirror Configuration (RAID1)
The Plan
There is currently a single disk /dev/ada1 attached to the system.
- This disk is used for the ZFS storage pool called Pool1.
We have a second disk /dev/da0 that we want to mirror the Pool1 pool to it.
Check the status of the existing storage pool
zpool status Pool1
returns:
pool: Pool1 state: ONLINE scan: none requested config: NAME STATE READ WRITE CKSUM Pool1 ONLINE 0 0 0 gptid/c15c2ee5-7070-4fe6-b33a-4c7a190cba02 ONLINE 0 0 0
NOTE: Take a note of the gptid of the existing disk.
Format the new drive as gpt
gpart destroy -F /dev/da0 gpart create -s gpt /dev/da0
Create a swap partition on the new drive
gpart add -b 128 -t freebsd-swap -s 2G /dev/da0
Create a ZFS partition
gpart add -t freebsd-zfs /dev/da0
List the partitions
gpart list [...output truncated...] Geom name: ada1 modified: false state: OK fwheads: 16 fwsectors: 63 last: 625142407 first: 40 entries: 128 scheme: GPT Providers: 1. Name: ada1p1 Mediasize: 2147483648 (2.0G) Sectorsize: 512 Stripesize: 0 Stripeoffset: 65536 Mode: r1w1e1 efimedia: HD(1,GPT,1bdd7438-fd7d-49ff-b0df-0747548b5a0f,0x80,0x400000) rawuuid: 1bdd7438-fd7d-49ff-b0df-0747548b5a0f rawtype: 412e7cb5-6ecf-11d6-8ff8-00022d09712b label: (null) length: 2147483648 offset: 65536 type: freebsd-swap index: 1 end: 4194431 start: 128 2. Name: ada1p2 Mediasize: 317925363712 (296G) Sectorsize: 512 Stripesize: 0 Stripeoffset: 2147549184 Mode: r1w1e2 efimedia: HD(2,GPT,c15c2ee5-7070-4fe6-b33a-4c7a190cba02,0x400080,0x2502ea08) rawuuid: c15c2ee5-7070-4fe6-b33a-4c7a190cba02 rawtype: 412e7cba-6ecf-11d6-8ff8-00022d09712b label: (null) length: 317925363712 offset: 2147549184 type: freebsd-zfs index: 2 end: 625142407 start: 4194432 Consumers: 1. Name: ada1 Mediasize: 320072933376 (298G) Sectorsize: 512 Mode: r2w2e5 Geom name: da0 modified: false state: OK fwheads: 255 fwsectors: 63 last: 625142407 first: 40 entries: 128 scheme: GPT Providers: 1. Name: da0p1 Mediasize: 2147483648 (2.0G) Sectorsize: 512 Stripesize: 0 Stripeoffset: 65536 Mode: r0w0e0 efimedia: HD(1,GPT,1bdd7438-fd7d-49ff-b0df-0747548b5a0f,0x80,0x400000) rawuuid: 1bdd7438-fd7d-49ff-b0df-0747548b5a0f rawtype: 412e7cb5-6ecf-11d6-8ff8-00022d09712b label: (null) length: 2147483648 offset: 65536 type: freebsd-swap index: 1 end: 4194431 start: 128 2. Name: da0p2 Mediasize: 317925363712 (296G) Sectorsize: 512 Stripesize: 0 Stripeoffset: 2147549184 Mode: r0w0e0 efimedia: HD(2,GPT,c15c2ee5-7070-4fe6-b33a-4c7a190cba02,0x400080,0x2502ea08) rawuuid: c15c2ee5-7070-4fe6-b33a-4c7a190cba02 rawtype: 412e7cba-6ecf-11d6-8ff8-00022d09712b label: (null) length: 317925363712 offset: 2147549184 type: freebsd-zfs index: 2 end: 625142407 start: 4194432 Consumers: 1. Name: da0 Mediasize: 320072932352 (298G) Sectorsize: 512 Mode: r0w0e0
NOTE: Write down the ID of the new data partition just created (look for rawuuid).
Here, this shows:
- rawuuid: 1bdd7438-fd7d-49ff-b0df-0747548b5a0f
Attach the new partition to the existing pool, mirroring all data from the old drive to the new one
zpool attach StoragePoolName /dev/gptid/[gptid_of_existing_disk] /dev/gptid/[gptid_of_new_partition]
In our case:
zpool attach Pool1 \ /dev/gptid/1bdd7438-fd7d-49ff-b0df-0747548b5a0f \ /dev/gptid/c15c2ee5-7070-4fe6-b33a-4c7a190cba02
NOTE: Depending on the amount of data that needs copying, this process may take some time.
Check the status of the existing storage pool
zpool status Pool1
returns:
pool: Pool1 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 Dec 4 19:29:14 2021 48.7G scanned at 13.9M/s, 42.2G issued at 12.1M/s, 48.7G total 37.1G resilvered, 86.67% done, 00:09:10 to go config: NAME STATE READ WRITE CKSUM Pool1 ONLINE 0 0 0 mirror-0 ONLINE 0 0 0 gptid/1bdd7438-fd7d-49ff-b0df-0747548b5a0f ONLINE 0 0 0 gptid/c15c2ee5-7070-4fe6-b33a-4c7a190cba02 ONLINE 0 0 0 (resilvering) errors: No known data errors
NOTE: The Pool has the new disk.
truenas/disks/add_a_second_disk_to_an_existing_pool_in_mirror_configuration_raid1.txt · Last modified: 2023/06/18 21:01 by peter