From owner-freebsd-questions@freebsd.org Mon Apr 11 18:28:52 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 EE51EB0B398 for ; Mon, 11 Apr 2016 18:28:52 +0000 (UTC) (envelope-from joh.hendriks@gmail.com) Received: from mail-wm0-x236.google.com (mail-wm0-x236.google.com [IPv6:2a00:1450:400c:c09::236]) (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 775201588 for ; Mon, 11 Apr 2016 18:28:52 +0000 (UTC) (envelope-from joh.hendriks@gmail.com) Received: by mail-wm0-x236.google.com with SMTP id a140so24154601wma.0 for ; Mon, 11 Apr 2016 11:28:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding; bh=KILQok1wrDruqrfwweSEdDgvwGk5zubpnkSB35DvmDo=; b=fPSc1yzVo3sogESYgFXozhtG6AMhxHYtSj+zl21Nl+BJy89tNLJqAhCxCA2r4jt6pI /7pg4mfj2omdfWQx5afOMHXQ3E7ze/O1f+6qQs8buWNbQH2xniN97ISARJz9nZ/EbTXi m6vqaBFrL3CNRMqyCyQ+1HH+56R92Wl0NMkfW1+DASG3plua2r88zTxNOTYHeBouToK7 bOb4Tq95UerNS24n5Eo/3sgZ7edQSQGk3lkQ1UdKQusS6Qha2OuaN4kq+5i3Oy1rODeG AabwE/FHFxsm6QrriOn7vDh6nwgu7ZDIF1WQXC07Ooz9N+LG18WAtNWP9ILClqWPy//8 MHJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=KILQok1wrDruqrfwweSEdDgvwGk5zubpnkSB35DvmDo=; b=HCsb1huE7vsI+N2A5AzWsgutMYwuO0q8cg0j79Pco6oywQv2YZmgp3MVSo6WoItXoa tPXxC7DKDXdkqVJudk8g1hnyvVEltnyo4UElmvy0812UdBNeXvDTCj+tpiaMvATGnU5/ +hQzdk9dF+LHI7AIjjhI+LCoKOeuwZHK9xuP20oCEk5C8DXH9+YgdSN0RNipI7HV9w07 gu55w467BR72qhypryfvAYv42ttkgaMXiR1BRzsw3/prDytwkeTR4fghzI8FTb//oUQI njSjgo8GEtbB55+BFbpxLPhz77loUKMFCOB2+EfRvrT2zUui1Dj9BeS4A3tFCx2z2/Zs bhlA== X-Gm-Message-State: AD7BkJJRvVR9TCWrsfD+Q8WFCdRrikptqfi2WYecl0b2LJy0bfpzhq9qwlSKuCT+IFcN5A== X-Received: by 10.28.134.67 with SMTP id i64mr19423914wmd.83.1460399331125; Mon, 11 Apr 2016 11:28:51 -0700 (PDT) Received: from Johans-MacBook-Air.local (92-111-79-242.static.chello.nl. [92.111.79.242]) by smtp.googlemail.com with ESMTPSA id d2sm29247076wjf.28.2016.04.11.11.28.49 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 11 Apr 2016 11:28:50 -0700 (PDT) Subject: Re: Zfs - broken disk - add instead of attach - How to go back to mirrored setup? To: Sebastian Wolfgarten , freebsd-questions@freebsd.org References: <6ACA8DAA-7D86-4FD0-B08C-2030CFF575C1@wolfgarten.com> From: Johan Hendriks Message-ID: <570BECE1.8070103@gmail.com> Date: Mon, 11 Apr 2016 20:28:49 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:38.0) Gecko/20100101 Thunderbird/38.7.1 MIME-Version: 1.0 In-Reply-To: <6ACA8DAA-7D86-4FD0-B08C-2030CFF575C1@wolfgarten.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit 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: Mon, 11 Apr 2016 18:28:53 -0000 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