From owner-freebsd-hackers@FreeBSD.ORG Fri Jul 12 12:33:35 2013 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id B673F250 for ; Fri, 12 Jul 2013 12:33:35 +0000 (UTC) (envelope-from c.kworr@gmail.com) Received: from mail-la0-x22c.google.com (mail-la0-x22c.google.com [IPv6:2a00:1450:4010:c03::22c]) by mx1.freebsd.org (Postfix) with ESMTP id 3E68511E3 for ; Fri, 12 Jul 2013 12:33:35 +0000 (UTC) Received: by mail-la0-f44.google.com with SMTP id er20so7703418lab.3 for ; Fri, 12 Jul 2013 05:33:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=NHeR5yvhDvwA3tn61zBM7ZVRIhGMq+SMu39cnSreaRY=; b=FwtzdW/QsA8x4irvHfdmdki9lArEYgvORCUt8gzRvWWgroUNAPm723aMaB0fmV5uC6 ZAqqQ7J/9GJwz78kJjyl95bTg52jO/3B5iNnyOPW20KQpE0GbjWGyzktiL+4bUPK/VWT Xgd0LhVTzbIoRWeFg4QpZ0hwfkF7ECdLM6bWTd9qjNUCrEPwTum3TKwxINgzWvKbruh3 d3ne3tgot0jJ1GbT6Aj/bkTI84JZW3Gze0qh7kRWOd9OxX43BVSuPprJPcaeocOHuZCF K50q2N0+9n78NmGxFI5HYvolrdMXVjp/2S5B0Z4QrV4OTiG4KyF5TQcHGKr4m7EWLlY/ kbqA== X-Received: by 10.152.42.236 with SMTP id r12mr19253762lal.46.1373632414264; Fri, 12 Jul 2013 05:33:34 -0700 (PDT) Received: from [192.168.1.139] (mau.donbass.com. [92.242.127.250]) by mx.google.com with ESMTPSA id e5sm13926010lbw.3.2013.07.12.05.33.33 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 12 Jul 2013 05:33:33 -0700 (PDT) Message-ID: <51DFF79C.905@gmail.com> Date: Fri, 12 Jul 2013 15:33:32 +0300 From: Volodymyr Kostyrko User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/20130710 Thunderbird/17.0.7 MIME-Version: 1.0 To: Reid Linnemann Subject: Re: Attempting to roll back zfs transactions on a disk to recover a destroyed ZFS filesystem References: In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Cc: freebsd-hackers@freebsd.org X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jul 2013 12:33:35 -0000 11.07.2013 17:43, Reid Linnemann написав(ла): > So recently I was trying to transfer a root-on-ZFS zpool from one pair of > disks to a single, larger disk. As I am wont to do, I botched the transfer > up and decided to destroy the ZFS filesystems on the destination and start > again. Naturally I was up late working on this, being sloppy and drowsy > without any coffee, and lo and behold I issued my 'zfs destroy -R' and > immediately realized after pressing [ENTER[ that I had given it the > source's zpool name. oops. Fortunately I was able to interrupt the > procedure with only /usr being destroyed from the pool and I was able to > send/receive the truly vital data in my /var partition to the new disk and > re-deploy the base system to /usr on the new disk. The only thing I'm > really missing at this point is all of the third-party software > configuration I had in /usr/local/etc and my apache data in /usr/local/www. You can try to experiment with zpool hidden flags. Look at this command: zpool import -N -o readonly=on -f -R /pool It will try to import pool in readonly mode so no data would be written on it. It also doesn't mount anything on import so if any fs is damaged you have less chances triggering a coredump. Also zpool import has a hidden -T switch that gives you ability to select transaction that you want to try to restore. You'll need a list of available transaction though: zdb -ul This one when given a vdev lists all uberblocks with their respective transaction ids. You can take the highest one (it's not the last one) and try to mount pool with: zpool import -N -o readonly=on -f -R /pool -F -T Then check available filesystems. -- Sphinx of black quartz, judge my vow.