From owner-freebsd-questions@FreeBSD.ORG Mon Aug 6 08:55:18 2012 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3EA43106566C for ; Mon, 6 Aug 2012 08:55:18 +0000 (UTC) (envelope-from navarre.matthew@gmail.com) Received: from mail-gh0-f182.google.com (mail-gh0-f182.google.com [209.85.160.182]) by mx1.freebsd.org (Postfix) with ESMTP id EA8E58FC0A for ; Mon, 6 Aug 2012 08:55:17 +0000 (UTC) Received: by ghrr13 with SMTP id r13so511722ghr.13 for ; Mon, 06 Aug 2012 01:55:16 -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 :content-type; bh=M+DTvE3I/UslXEiJgeE8mwMjRuggj70LFv1iHEuwScA=; b=oi9G+5nnBZN0WrANkVe+7tF1BANSMnmW4bEVv0tpdhbbF8I5syVY3i4Vr/fwR4RuGv U+FVkgfuAAcqTuq9rn2CTNlEPMinN1UvDm5E7Ix+3CJjo/iatw70m6VIsG35GNO+4tRJ 35wdOZQgU+0lvOOAOt/CbAjdltX7HRBPJZutXc7SJuteuUb3a1GscK61Dzy3M2jiwsij RSudY/q+YAM4TkSp2z+TJitJ0Bgvz6sWUAs0klO5hPiyePNMMWinms8qVx4jPCTwIdzh 90crwufLKCvC7VKv9oaygNADUKK83zxVqX9LuSCJth1JvcSq+Cbh4hK0ARhNw3yc0hsI g+XA== MIME-Version: 1.0 Received: by 10.66.75.228 with SMTP id f4mr16639225paw.52.1344243316521; Mon, 06 Aug 2012 01:55:16 -0700 (PDT) Received: by 10.68.52.197 with HTTP; Mon, 6 Aug 2012 01:55:16 -0700 (PDT) In-Reply-To: <20120806090858.29dd77dd.freebsd@edvax.de> References: <20120806090858.29dd77dd.freebsd@edvax.de> Date: Mon, 6 Aug 2012 01:55:16 -0700 Message-ID: From: Matthew Navarre To: freebsd-questions@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: Re: Mounting raw disk backup file. X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Aug 2012 08:55:18 -0000 On Mon, Aug 6, 2012 at 12:08 AM, Polytropon wrote: > On Sun, 5 Aug 2012 23:12:48 -0700, Matthew Navarre wrote: > > I can probably fix the partition table using testdisk, but now that I've > > got this image file I'd rather work with that instead of the physical > disk. > > I've read the Handbook section on using mdconfig, but that assumes the > > image file is of a filesystem, not a whole disk. I think I've > > found instructions for how to do it on linux, but if there's a way to > mount > > it on FreeBSD I'd rather do that. > > It depends on _what_ your disk image (typically created by a > dd-like utility to make a 1:1 copy of a whole disk) contains. > If there are several slices and partitions, each of them can > be accessed like it was a physical disk. > > Let's assume you have /home/you/ada1.dd which is the copy of > your former /dev/ada1 disk. You do: > > # mdconfig -a -t vnode -u 0 -f /home/you/ada1.dd > > This results in a file /dev/md0 as well as any "partitional > qualifier specials" that might correspond to the disk the copy > has been taken from. You can check that with > Yep. Unfortunately the partition table and disklable are screwed, so md1s(1,2) don't appear in dev. Same with ada1, which is the physical disk. The drive has two primary partitions, both of which had a single UFS file system on them. So now I just need to figure out how to fix the partition table and the disklabel and I should be golden getting the data out. That drive is getting replaced, though. > # fdisk /dev/md0 > > and it should print the same partition table as for the real > disk. > here's the fdisk output for /dev/ada1, which is the real drive: mnavarre@pcbsd-1810] /# fdisk ada1 ******* Working on device /dev/ada1 ******* parameters extracted from in-core disklabel are: cylinders=310098 heads=16 sectors/track=63 (1008 blks/cyl) Figures below won't work with BIOS for partitions not in cyl 1 parameters to be used for BIOS calculations are: cylinders=310098 heads=16 sectors/track=63 (1008 blks/cyl) Media sector size is 512 Warning: BIOS sector numbering starts with sector 1 Information from DOS bootblock is: The data for partition 1 is: sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD) start 63, size 167766732 (81917 Meg), flag 80 (active) beg: cyl 0/ head 1/ sector 1; end: cyl 1023/ head 254/ sector 63 The data for partition 2 is: sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD) start 167766795, size 144809910 (70707 Meg), flag 80 (active) beg: cyl 1023/ head 255/ sector 63; end: cyl 1023/ head 254/ sector 63 The data for partition 3 is: The data for partition 4 is: Now, the first partition looks sane (size is right, geometry looks right). The second partition, however, looks a bit wrong, since it ends before it starts, but the size is right. And now I've gone and screwed up the disk image file. So, it's math and manpages from here. OK, MCN