Move FreeBSD System Between ZFS Disks | ๐๐๐๐๐๐๐๐
I made a funny mistake in one of my clients when installing FreeBSD 15.1-RELEASE on their server โฆ I have chosen wrong disk for the installation. The server had 4 local disks โ 2 of them were some really low end SATA SSD drives (ada0 and ada1 ) and the server also had 2 fast NVMe disks (nda0 and nda1 ). I used Auto (ZFS) option in the bsdinstall(8) installer and chosen (wrongly) the ada1 disk.
This is how my ZFS pool looked like after installation.
freebsd # zpool status zroot<br>pool: zroot<br>state: ONLINE<br>config:
NAME STATE READ WRITE CKSUM<br>zroot ONLINE 0 0 0<br>ada1p4 ONLINE 0 0 0
โฆ but this is the ZFS world โ nothing stops You from adding as many drives to ZFS mirror as You want โ so for a start I used FreeBSD gpart(8) tool to copy the partitions from ada1 disk to the NVME nda0 and nda1 drives.
freebsd # gpart backup ada1 | gpart restore nda0
freebsd # gpart backup ada1 | gpart restore nda1
Then as FreeBSD was installed with BIOS+UEFI option I cloned the freebsd-boot partition and the UEFI partition.
freebsd # dd bs=1m if=/dev/ada1p1 of=/dev/nda0p1 status=progress
freebsd # dd bs=1m if=/dev/ada1p1 of=/dev/nda1p1 status=progress
freebsd # dd bs=1m if=/dev/ada1p2 of=/dev/nda0p2 status=progress
freebsd # dd bs=1m if=/dev/ada1p2 of=/dev/nda1p2 status=progress<br>Next I added these nda0 and nda1 as mirror devices for ada1 disk. For the record โ the ada1p3 is a SWAP device โ no need to clone it for obvious reasons.
freebsd # zpool attach zroot ada1p4 nda0p4
freebsd # zpool attach zroot ada1p4 nda1p4
This is when ZFS decided to do the resilvering process immediately (which is good).
freebsd # zpool status zroot<br>pool: zroot<br>state: ONLINE<br>status: One or more devices is currently being resilvered. The pool will<br>continue to function, possibly in a degraded state.<br>action: Wait for the resilver to complete.<br>scan: resilver in progress since Thu Aug 13 18:47:35 2026<br>199G / 199G scanned, 15.5G / 199G issued at 428M/s<br>31.0G resilvered, 7.76% done, 00:07:20 to go<br>config:
NAME STATE READ WRITE CKSUM<br>zroot ONLINE 0 0 0<br>mirror-0 ONLINE 0 0 0<br>ada1p4 ONLINE 0 0 0<br>nda0p4 ONLINE 0 0 0 (resilvering)<br>nda1p4 ONLINE 0 0 0 (resilvering)
errors: No known data errors
We can even track the status of that replication.
freebsd # zpool iostat -v zroot 5<br>capacity operations bandwidth<br>pool alloc free read write read write<br>zroot 199G 229G 25 758 3.11M 42.6M<br>mirror-0 199G 229G 3.21K 95.9K 402M 5.38G<br>ada1p4 - - 25 693 3.11M 36.5M<br>nda0p4 - - 0 4.15K 281 403M<br>nda1p4 - - 0 4.41K 305 413M<br>capacity operations bandwidth<br>pool alloc free read write read write<br>zroot 199G 229G 2.89K 8.29K 369M 850M<br>mirror-0 199G 229G 2.89K 8.29K 369M 850M<br>ada1p4 - - 2.89K 383 369M 37.1M<br>nda0p4 - - 0 4.00K 0 406M<br>nda1p4 - - 0 3.91K 0 406M<br>capacity operations bandwidth<br>pool alloc free read write read write<br>zroot 199G 229G 2.99K 7.30K 378M 827M<br>mirror-0 199G 229G 2.99K 7.30K 378M 827M<br>ada1p4 - - 2.99K 185 378M 19.9M<br>nda0p4 - - 0 3.54K 7.20K 404M<br>nda1p4 - - 0 3.58K 0 404M
After resilvering process is finished we can detach the ada1 drive from the ZFS mirror.
freebsd # zpool detach zroot ada1p4
โฆ and after all these quite simple and predictable operations โ everything when the system was still running โ we have FreeBSD installation migrated from ada1 disk to ZFS mirror on two NVMe nda0 and nda1 disks as shown below.
freebsd # zpool status zroot<br>pool: zroot<br>state: ONLINE<br>scan: scrub repaired 0B in 00:00:08 with 0 errors on Thu Aug 13 23:20:15<br>2026<br>config:
NAME STATE READ WRITE CKSUM<br>zroot ONLINE 0 0 0<br>mirror-0 ONLINE 0 0 0<br>nda0p4 ONLINE 0 0 0<br>nda1p4 ONLINE 0 0 0
errors: No known data errors
Its kinda short article (for my standards) but it shows what was needed and possible with ZFS and other FreeBSD tools to do the job.
EOF
Share this:
Share on X (Opens in new window)
Share on Facebook (Opens in new window)<br>Facebook
Like Loading...
Related
Leave a comment Cancel reply
Comment
Reblog
Subscribe
Subscribed
๐๐๐๐๐๐๐๐
Join 270 other subscribers
Sign me up
Already have a WordPress.com account? Log in now.
Privacy
๐๐๐๐๐๐๐๐
Subscribe
Subscribed
Sign up
Log in
Copy shortlink
Report this content
View post in Reader
Manage subscriptions
Collapse this bar
Loading Comments...
Write a Comment...
Email (Required)
Name (Required)
Website
%d
Design a site like this with WordPress.com<br>Get started