Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 Apr 2016 20:28:49 +0200
From:      Johan Hendriks <joh.hendriks@gmail.com>
To:        Sebastian Wolfgarten <sebastian@wolfgarten.com>, freebsd-questions@freebsd.org
Subject:   Re: Zfs - broken disk - add instead of attach - How to go back to mirrored setup?
Message-ID:  <570BECE1.8070103@gmail.com>
In-Reply-To: <6ACA8DAA-7D86-4FD0-B08C-2030CFF575C1@wolfgarten.com>
References:  <6ACA8DAA-7D86-4FD0-B08C-2030CFF575C1@wolfgarten.com>

Next in thread | Previous in thread | Raw E-Mail | Index | Archive | Help


Op 08/04/16 om 21:53 schreef Sebastian Wolfgarten:
> 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?
>
> Many thanks.
>
> Best regards
> Sebastian
>
> _______________________________________________
> freebsd-questions@freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org"
You have created one pool of two vdevs where the vdevs consist of one
disk. There is not an option to remove a vdev from a pool.

You have two options.
1) get yourself a disk to copy all your data to , destroy the pool and
recreate it as a mirror, and copy your data back.
2) buy two more disk, and create two mirrors. zpool attach zroot
gpt/zfs1 /your/new-disk and zpool attach zroot ada0 /your/new-diks2

Also it is wise to create a GPT partition on the disks, that way you can
use the labels and not raw geom devices.

gpt create -S GPT /dev/ada0
gpart add -t freebsd-zfs -a 1m -l labelname /dev/ada0
If for some reason ada0 is not ada0 anymore but lets say ada1 then you
are not in trouble, because the labels do not change.

This sometimes happens when adding more disks to a system.

regards
Johan



 




Want to link to this message? Use this URL: <http://docs.FreeBSD.org/cgi/mid.cgi?570BECE1.8070103>