Zfs - broken disk - add instead of attach - How to go back to mirrored setup?

Anton Sayetsky vsasjason at gmail.com
Fri Apr 8 20:08:54 UTC 2016


8 апр. 2016 г. 22:59 пользователь "Sebastian Wolfgarten" <
sebastian at wolfgarten.com> написал:
>
> Dear all,
>
> I used to have a ZFS-based mirror and now thanks to a typo I have one big
disk of 5.4TB instead of a 2.7T mirror - how do I get back to having a
mirror?
>
> Here is what happened:
>
> Last week one of my hard drives broke requiring me to detach & replace
the disk:
>
> server1 - ZFS pool - HEALTH fault
>
> NAME    SIZE  ALLOC   FREE   FRAG  EXPANDSZ    CAP  DEDUP  HEALTH  ALTROOT
> zroot  2.72T   763G  1.97T    18%         -    27%  1.00x  DEGRADED  -
>
>  pool: zroot
> state: DEGRADED
> status: One or more devices has been removed by the administrator.
> Sufficient replicas exist for the pool to continue functioning in a
> degraded state.
> action: Online the device using 'zpool online' or replace the device with
> 'zpool replace'.
> scan: scrub repaired 0 in 3h48m with 0 errors on Fri Mar 25 10:48:35 2016
> config:
>
> NAME                     STATE     READ WRITE CKSUM
> zroot                    DEGRADED     0     0     0
>   mirror-0               DEGRADED     0     0     0
>     5383010007106655398  REMOVED      0     0     0  was
> /dev/diskid/DISK-Z1F0LSM7p3
>     gpt/zfs1             ONLINE       0     0     0
>
> errors: No known data errors
>
> # zpool detach zroot /dev/diskid/DISK-Z1F0LSM7p3
>
> After the provider put in a new disk, I made a mistake (i.e. I added the
disk to the zroot pool instead of attaching it) and now I was wondering how
to recover from this situation:
>
> # zpool add zroot ada0
>
> Here is what zroot now looks like:
>
> # zpool status zroot
>   pool: zroot
>  state: ONLINE
>   scan: scrub canceled on Fri Apr  8 21:27:31 2016
> config:
>
>         NAME        STATE     READ WRITE CKSUM
>         zroot       ONLINE       0     0     0
>           gpt/zfs1  ONLINE       0     0     0
>           ada0      ONLINE       0     0     0
>
> errors: No known data errors
>
> I tried to remove/disable/offline the second disk but that did not work:
>
> # zpool offline zroot ada0
> cannot offline ada0: no valid replicas
> # zpool remove zroot ada0
> cannot remove ada0: only inactive hot spares, cache, top-level, or log
devices can be removed
> # zpool detach zroot ada0
> cannot detach ada0: only applicable to mirror and replacing vdevs
>
> Now my question is: How can I get back to having a mirror without loosing
all the data on ada1? Any ideas? Using ZFS split maybe?
Unfortunately, it's impossible. You must backup pool data and recreate it.


More information about the freebsd-questions mailing list