I need to replace disk for a zfs root installed system.

Previously it was (before reinstalling OS for test purpose which is also I want to accomplish after install):

Created mirror with zpool attach rpool /dev/sda2 /dev/sdb

    rpool       ONLINE       0     0     0
   mirror-0  ONLINE       0     0     0
      sda2      ONLINE       0     0     0
       sdb      ONLINE       0     0     0

And I reinstalled OS:

    rpool       ONLINE       0     0     0
      sda2      ONLINE       0     0     0

sdb holds data...

    pool: rpool-12312656247996879599
     id: 12312656247996879599
    state: DEGRADED
 status: One or more devices contains corrupted data.
 action: The pool can be imported despite missing or damaged devices.  The
        fault tolerance of the pool may be compromised if imported.
   see: http://zfsonlinux.org/msg/ZFS-8000-4J
        rpool-12312656247996879599  DEGRADED
          mirror-0  DEGRADED
            sda2    FAULTED  corrupted data
            sdb     ONLINE

And I want to create mirror and sync data from sdb to current mirror after reinstalling OS. After reinstalling OS, I have one rpool and one sdb pool seperatly. I can send/recv data on two pools and destory sdb pool and attach to rpool and make mirror. But wondering is there any way without manually syncing files (send/recv) and attach sdb which is in pool to rpool without destroying it?

1 Answer 1


You have taken your disk sda2 out of the old pool, erased its content and installed a new pool (with your new system) on it. As this was a redundant vdev (mirror), you essentially have two different pools, each having one disk (meaning no fault tolerance). You still have both options - using the new one or restoring the old one:

If you want to discard your old pool and use your new install (sda2), follow these steps:

  • Format your disk sdb, deleting all data on it
  • Attach the formatted disk to your new pool: zpool attach rpool sda2 sdb
  • Wait for resilvering to complete, check with zpool status rpool
  • Copy over boot sector data so the system can boot from both disks (assuming you use GRUB): installgrub /boot/grub/stage1 /boot/grub/stage2 /dev/rdsk/sdb

If you want to discard your new pool and return to your (degraded) old pool (sdb):

  • Shut down the system and physically remove your disk sda2
  • Start the system, it should now recognize your old pool as a valid bootable root pool (only works if you have added the boot sector to this disk previously, similar to steps above, otherwise you will get a boot error)
  • Physically reconnect your disk sda2 to the system and format it
  • Attach your disk sda2 to your old pool: zpool attach rpool sdb sda2

If you have a Solaris/illumos system, you could (in the future, not in this case) also use beadm to perform upgrades, tests and recovery in-place (inside the same rpool, but on different snapshots). This way, you can revert without giving up redundancy temporarily.

  • Thank you very much. I am managing server remotely. So can not physically touch disks. Only remotely reinstall OS. So first desc is for me but I want to keep data on sdb and mirror it with new rpool. So by reinstalling OS, I have at the end two different pools. So only option I found is, I send/recv between two pools. And do what you wrote at first option. Is there any other option without needing to send/recv files? Like without destrying pool and attaching it to rpool and make mirror. Dec 19, 2017 at 12:20
  • @OzgurErdogan Instead of removing the disks, it could be enough to disconnect them virtually (on Solaris, use cfgadm -c unconfigure and cfgadm -c disconnect). For the rest of your question, could you edit your original question and explain in more detail what you want to do and what to avoid? Generally, send/recv is painless and fast, you might not save much time in avoiding it.
    – user121391
    Dec 19, 2017 at 12:30
  • I added more details. So to make it short; can I attach sdb to rpool after reinstall without destroying/formatting sdb? So I can keep data on sdb and after attaching it it can mirror data to rpool. Dec 19, 2017 at 14:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .