Zfs import mirrored device.

ozgurerdogan

Renowned Member
May 2, 2010
613
5
83
Bursa, Turkey, Turkey
I need to replace disk for a pve zfs root installed system.
Previously it was:

Code:
NAME        STATE     READ WRITE CKSUM
        rpool       ONLINE       0     0     0
       mirror-0  ONLINE       0     0     0
          sda2      ONLINE       0     0     0
           sdb      ONLINE       0     0     0

And I had to replace first disk. And now it is:
Code:
NAME        STATE     READ WRITE CKSUM
        rpool       ONLINE       0     0     0
          sda2      ONLINE       0     0     0

sdb hold data.
Code:
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
 config:

        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. What are the steps? Do I need to import old pool ?
 
Hi,

- connect your new hdd on the server
- test it is ok at least with smartctl -t long /dev/sdX
- the last step is to use zfs replace rpool old-disk new-disk
- it is advisable to test this process on a desktop using plain files instead of real disks - so when you learn this steps, you can use the same steps on the real pool

You do not need to import any pool. This is done by proxmox at server boot.
 
There is no 'old-disk' in the current top vdev, for the zfs replace.

if you want to use your current booting vdev containing sda2 you can zfs attach rpool sda2 new-disk

if you want the data on new-disk, boot it and zfs replace rpool sda2
 
There is no 'old-disk' in the current top vdev, for the zfs replace.

if you want to use your current booting vdev containing sda2 you can zfs attach rpool sda2 new-disk

If the pool have a mirror with one faulty device, you use replace. If the pool have only a single device and you want to covert the pool in a mirror with 2 device you can use attach.
 
Issue I am facing is, when I detach faulty device from degraded pool. There I have two different pools. One is rpool and other is sdb pool. So I can not attach sdb to rpool. I think I have to destory pool first. But to keep data, I have to snd/rcv data to rpool. Any way to mirror two pools without destoying one will solve my plan.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!