From owner-freebsd-questions@freebsd.org Thu Apr 28 21:23:19 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 8A7DEB20330 for ; Thu, 28 Apr 2016 21:23:19 +0000 (UTC) (envelope-from sebastian@wolfgarten.com) Received: from waldfest.wolfgarten.com (waldfest.wolfgarten.com [144.76.61.234]) by mx1.freebsd.org (Postfix) with ESMTP id 1E5E31D23 for ; Thu, 28 Apr 2016 21:23:18 +0000 (UTC) (envelope-from sebastian@wolfgarten.com) Received: from waldfest (localhost [127.0.0.1]) by waldfest.wolfgarten.com (Postfix) with ESMTP id D10D119036 for ; Thu, 28 Apr 2016 23:14:28 +0200 (CEST) X-Virus-Scanned: amavisd-new at wolfgarten.com X-Spam-Flag: NO X-Spam-Score: -1.821 X-Spam-Level: X-Spam-Status: No, score=-1.821 tagged_above=-9999 required=5 tests=[ALL_TRUSTED=-1, BAYES_00=-1.9, BODY_RULE_1=1, HTML_MESSAGE=0.001, TW_ZF=0.077, URIBL_BLOCKED=0.001] autolearn=no autolearn_force=no Received: from waldfest.wolfgarten.com ([127.0.0.1]) by waldfest (waldfest.wolfgarten.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id Qj8W_MBUKfeC for ; Thu, 28 Apr 2016 23:14:22 +0200 (CEST) Received: from [192.168.0.159] (unknown [84.119.55.188]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by waldfest.wolfgarten.com (Postfix) with ESMTPSA id 1CCAB1902A for ; Thu, 28 Apr 2016 23:14:20 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wolfgarten.com; s=mail; t=1461878062; bh=hNaFNBOil+lZc82lyCcdM7zU0p+BPgaAgCAO8GosHQs=; h=From:Subject:Date:To; b=vCmqFF+Uf0lGbyXRxZjq2R9reXCongyrov+GlwbZrKkys1FZDf+NfVBwgNqkrlgrR 61u+guzAJlKJyQnpvsb0ckIg4S1khglVBsLUiPAjutZLKMu1yqCjqcB4VrgZiVifKZ 0DsSWoqXpt/T55wqzgHxqcG+zqwzO4YUvqTtURSQ= From: Sebastian Wolfgarten Subject: ZFS migration - New pool lost after reboot Message-Id: <0A383C91-FCBA-4B9E-A95A-157A13708125@wolfgarten.com> Date: Thu, 28 Apr 2016 23:14:19 +0200 To: freebsd-questions@freebsd.org Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) X-Mailer: Apple Mail (2.3124) Content-Type: text/plain; charset=us-ascii 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: Thu, 28 Apr 2016 21:23:19 -0000 Dear all, I have a bit of an issue and I hope you are able to point me into the = right direction for solving this. Following a hard disk failure I have accidentally created a striped ZFS = mirror and now I am trying to turn it (back) into a mirrored pool via a = temporary hard disk I put into the server. This was in response to a = post I did some time ago = (https://groups.google.com/forum/#!topic/mailing.freebsd.questions/qT-2WTs= cBqM = ). Now ada0 is the replacement disk, I would like to use it to rebuild my = mirrored pool in line with some instructions I have found online (see = https://blog.grem.de/sysadmin/Shrinking-ZFS-Pool-2014-05-29-21-00.html = ),= however I am experiencing some problems. Here is what I did: 0) Existing zroot pool to migrate zroot/ROOT 126G 5,02T 96K none zroot/ROOT/default 126G 5,02T 126G / zroot/tmp 9,69M 5,02T 9,69M /tmp zroot/usr 34,8G 5,02T 96K /usr zroot/usr/home 30,2G 5,02T 30,2G /usr/home zroot/usr/ports 4,58G 5,02T 4,58G /usr/ports zroot/usr/src 6,64M 5,02T 6,64M /usr/src zroot/var 92,7G 5,02T 96K /var zroot/var/crash 96K 5,02T 96K /var/crash zroot/var/log 412M 5,02T 412M /var/log zroot/var/mail 92,3G 5,02T 92,3G /var/mail zroot/var/tmp 100K 5,02T 100K /var/tmp 1) Create required partitions on temporary hard disk ada0 gpart create -s GPT ada0 gpart add -t freebsd-boot -s 128 ada0 gpart add -t freebsd-swap -s 4G -l newswap ada0 gpart add -t freebsd-zfs -l newdisk ada0 gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 ada0 2) Create new pool (newpool) zpool create -o cachefile=3D/tmp/zpool.cache newpool gpt/newdisk 3) Create snapshot of existing zroot pool and copy it over to new pool=20= zfs snapshot -r zroot@movedata zfs send -vR zroot@movedata | zfs receive -vFd newpool zfs destroy -r zroot@movedata 4) Make the new pool bootable =09 zpool set bootfs=3Dnewpool/ROOT/default newpool 5) Mount new pool and prepare for reboot cp /tmp/zpool.cache /tmp/newpool.cache zpool export newpool zpool import -c /tmp/newpool.cache -R /mnt newpool cp /tmp/newpool.cache /mnt/boot/zfs/zpool.cache zfs set mountpoint=3D/ newpool/ROOT reboot When I execute the steps above, the new pool is not imported = automatically after reboot and as such, the system boots from the old = zpool. Furthermore the new pool only features /tmp, /var and /usr if I = manually import it afterwards - any ideas why the full structure of the = zroot pool is not copied either? Furthermore any ideas on how to = permanently import the new pool? Lastly if somebody has got (better) instructions for how to migrate a = zfs pool, please let me know. Many thanks. Best regards Sebastian