From owner-freebsd-questions@FreeBSD.ORG Mon Aug 6 07:09:05 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 79A0C10657CF for ; Mon, 6 Aug 2012 07:09:05 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from mx02.qsc.de (mx02.qsc.de [213.148.130.14]) by mx1.freebsd.org (Postfix) with ESMTP id 398B58FC08 for ; Mon, 6 Aug 2012 07:09:04 +0000 (UTC) Received: from r56.edvax.de (port-92-195-22-218.dynamic.qsc.de [92.195.22.218]) by mx02.qsc.de (Postfix) with ESMTP id 8978E24706; Mon, 6 Aug 2012 09:08:58 +0200 (CEST) Received: from r56.edvax.de (localhost [127.0.0.1]) by r56.edvax.de (8.14.5/8.14.5) with SMTP id q7678wsK001931; Mon, 6 Aug 2012 09:08:58 +0200 (CEST) (envelope-from freebsd@edvax.de) Date: Mon, 6 Aug 2012 09:08:58 +0200 From: Polytropon To: Matthew Navarre Message-Id: <20120806090858.29dd77dd.freebsd@edvax.de> In-Reply-To: References: Organization: EDVAX X-Mailer: Sylpheed 3.1.1 (GTK+ 2.24.5; i386-portbld-freebsd8.2) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: freebsd-questions@freebsd.org Subject: Re: Mounting raw disk backup file. X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Polytropon List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Aug 2012 07:09:05 -0000 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 # fdisk /dev/md0 and it should print the same partition table as for the real disk. Now you can access and mount from that disk image, e. g. # mount -t ufs -o ro /dev/md0s1a /mnt as this maybe is the root file system of the 1st slice. Note the use of "-o ro" in this case. If you have had partitioned your system, you can "add" those partitions into a fully accessible /mnt tree for that system disk, e. g. # mount -t ufs -o ro /dev/md0s1d /mnt/tmp # mount -t ufs -o ro /dev/md0s1e /mnt/var # mount -t ufs -o ro /dev/md0s1f /mnt/usr # mount -t ufs -o ro /dev/md0s1g /mnt/home Note that unmounting must happen in the reversed order. If there was another file system, e. g. for sharing with "Windows" stuff, it's also possible to mount it: # mount -t msdosfs -o ro /dev/md0s2 /mnt/win Of course you can access all slices and partitions independently. That should be the best approach for recovering data. -- Polytropon Magdeburg, Germany Happy FreeBSD user since 4.0 Andra moi ennepe, Mousa, ...