Import ZFS pool into a new computer
In this example hardware has failed and the zpool disks are connected to a new computer. Need to reconstruct the zpool filesystem for continued data use. All disks from the zpool are now connected to a new computer.
Find the pool
root@nas:~# zpool import
pool: zfsdata
id: 466262796876421602
state: ONLINE
status: The pool was last accessed by another system.
action: The pool can be imported using its name or numeric identifier and
the '-f' flag.
see: http://zfsonlinux.org/msg/ZFS-8000-EY
config:
zfsdata ONLINE
raidz1-0 ONLINE
sdb2 ONLINE
sdc2 ONLINE
sdd2 ONLINE
sde2 ONLINEImport the pool
In this case I have a zpool from BSD that is being imported to a Linux system
root@nas:~# zpool import zfsdata
cannot import 'zfsdata': pool was previously in use from another system.
Last accessed by (hostid=83b027b5) at Wed Jun 23 14:04:59 2021
The pool can be imported, use 'zpool import -f' to import the pool.
root@nas:~# zpool import -f zfsdata
root@nas:~# df -h /zfsdata
Filesystem Size Used Avail Use% Mounted on
zfsdata 5.3T 2.7T 2.7T 50% /zfsdataUpgrade
In this case the pool can be upgraded to support new features. Once upgraded the pool will no longer work on the old system. In this scenario the old computer is non functional so going back is not an option. Start an update and the scrub new pool to verify integrity.
root@nas:/zfsdata# zpool upgrade zfsdata
This system supports ZFS pool feature flags.
Successfully upgraded 'zfsdata' from version 28 to feature flags.
Enabled the following features on 'zfsdata':
async_destroy
empty_bpobj
lz4_compress
multi_vdev_crash_dump
spacemap_histogram
enabled_txg
hole_birth
extensible_dataset
…
root@nas:/zfsdata# zpool scrub zfsdata
root@nas:/zfsdata# zpool status -v
pool: zfsdata
state: ONLINE
scan: scrub in progress since Sat Sep 4 18:08:30 2021
155G scanned at 344M/s, 84.1G issued at 187M/s, 3.49T total
0B repaired, 2.35% done, 0 days 05:19:17 to go
config:
NAME STATE READ WRITE CKSUM
zfsdata ONLINE 0 0 0
raidz1-0 ONLINE 0 0 0
sdb2 ONLINE 0 0 0
sdc2 ONLINE 0 0 0
sdd2 ONLINE 0 0 0
sde2 ONLINE 0 0 0Verify drive smart info
Instal smartmontools or package with smartctl for your distro.
for drive in {b..e}
do
smartctl -i /dev/sd$drive
done
Adjust smartctl command and review output based on your specific device.