Can I recover a ZFS pool if the OS HDD died without exporting ZFS?

craigsnyders picture craigsnyders · Oct 11, 2013 · Viewed 12.2k times · Source

Unfortunately my main OS HDD died. I had a 4TB ZFS pool configured over 3 drives, as below:

  1. 120GB HDD - Ubuntu 10.12. The ZFS pool was setup from this hdd.
  2. 1TB HDD - part of the pool
  3. 1TB HDD - part of the pool
  4. 2TB HDD - part of the pool

The main HDD is unrecoverable.

Is ZFS clever enough to recognize the existing pool if I plug those 3 HDDs into a new machine? I already have a new HDD which I'll install Ubuntu on again.

Is a simple zfs import going to suffice? If I need to rebuild the pool, can I maintain all of the data? As you can tell, I'm not a ZFS expert at all, but I really hope that ZFS is designed to accommodate circumstances such as this...

Does the answer here cover all my worries?

Answer

ArtemB picture ArtemB · Oct 22, 2013

ZFS should be able to find the pools when HDDs are moved to the new system.

When you attempt to import the pool ZFS will warn you if the pool was previously used on another system and will not import it unless you run zpool import with '-f'.

zpool import -f [pool name|ID] should import your pool. Be careful if your old pool had mount points affecting the system -- anything that's already mounted from somewhere else on the new system. You may want to use -R /some/new/mount/root to make sure imported filesystems don't overlay existing ones or -N to avoid mounting filesystems from the imported pool altogether.