From owner-freebsd-questions@freebsd.org Fri Apr 8 20:08:54 2016 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7A60EB0947D for ; Fri, 8 Apr 2016 20:08:54 +0000 (UTC) (envelope-from vsasjason@gmail.com) Received: from mail-wm0-x22c.google.com (mail-wm0-x22c.google.com [IPv6:2a00:1450:400c:c09::22c]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0A3A71DD3 for ; Fri, 8 Apr 2016 20:08:54 +0000 (UTC) (envelope-from vsasjason@gmail.com) Received: by mail-wm0-x22c.google.com with SMTP id l6so77189559wml.1 for ; Fri, 08 Apr 2016 13:08:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc; bh=UdSkjH43riPXmlMFkWJB4rsYrw9rN1pit1kJCziHyP8=; b=U6WRpQlYrikciB2yVdScH9ebgRDOTmW+pqMYBY2NEhP1Z1SNLCFWCt1sUw9kwotPdS dphW/lFDGcXQMPDdm5uFoEfHys82OiI+BJqQs/Vo+Twz/z/wTP0DljpQwd3Qo6ByOjLu yGJuqzrlqb1tot7Mq07ChjRqj0GRswc0Y2GsUy0LC7eQyFlz/EL+S/racCTMcNo75kyK MLmSsSxAb/Rp7aEiAiYCg61N5oBG+ZXoSn7eZZ6sQy+ofvBLWTASG4lrLvcSEG3cFZ6r kwQtu9TJxxhMjWoo0K1DoIUrkd7lr225A9V84RPXTQWXhXn/Yn+2FT8n3QnLDo4rf3FT i9kw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc; bh=UdSkjH43riPXmlMFkWJB4rsYrw9rN1pit1kJCziHyP8=; b=ILujnsgpOerudvq4LmVTHbcsBcsJgeOjdTt1C9p7lzGUV2NfmnpA2BGvFqH27Zxk08 fUL0bxlIeULf/RBsdFTx7UT6WdpTnPehnfdgiMxlEgm33CE75XXr2g4veD9AQaD0UKl2 BXcRilRhZ+j6d+6iPdWrZM6/xlTQmKIS1Vvv3SiEKfkmaDxnS+vqnrlqrLK28ezeZkmI ZS/fY6+fiX8sjCyrHTYmjBGXedIlrB6KEcbL64vJHDwvhc06XND+oZPwOCLYrkd0rCSD ixUIRIzOX/NNmXuLzCisI9FmXkB1h42zQ9enCUf496rt787M44Zl0yc79hWpv3xx5pr3 mrbQ== X-Gm-Message-State: AD7BkJLJtfpY2C6UQY7T7hkG0fQHXzHC3QcZRn7/NgyuhNIXbpofgHF0l8dKd1fZg3pHp/iS9ZyyR30rYsg4Ug== MIME-Version: 1.0 X-Received: by 10.28.92.13 with SMTP id q13mr5464963wmb.43.1460146132558; Fri, 08 Apr 2016 13:08:52 -0700 (PDT) Received: by 10.194.246.73 with HTTP; Fri, 8 Apr 2016 13:08:52 -0700 (PDT) Received: by 10.194.246.73 with HTTP; Fri, 8 Apr 2016 13:08:52 -0700 (PDT) In-Reply-To: References: <6ACA8DAA-7D86-4FD0-B08C-2030CFF575C1@wolfgarten.com> Date: Fri, 8 Apr 2016 23:08:52 +0300 Message-ID: Subject: Re: Zfs - broken disk - add instead of attach - How to go back to mirrored setup? From: Anton Sayetsky To: Sebastian Wolfgarten Cc: freebsd-questions@freebsd.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.21 X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Apr 2016 20:08:54 -0000 8 =D0=B0=D0=BF=D1=80. 2016 =D0=B3. 22:59 =D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0= =BE=D0=B2=D0=B0=D1=82=D0=B5=D0=BB=D1=8C "Sebastian Wolfgarten" < sebastian@wolfgarten.com> =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB: > > 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 ALTROO= T > 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.