Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 6 Aug 2012 09:08:58 +0200
From:      Polytropon <freebsd@edvax.de>
To:        Matthew Navarre <navarre.matthew@gmail.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Mounting raw disk backup file.
Message-ID:  <20120806090858.29dd77dd.freebsd@edvax.de>
In-Reply-To: <CAMZ_P7iuN0WXzvU3BZUovat8hvXYyjB68jz-GWnerkEgJOqrCg@mail.gmail.com>
References:  <CAMZ_P7iuN0WXzvU3BZUovat8hvXYyjB68jz-GWnerkEgJOqrCg@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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, ...



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120806090858.29dd77dd.freebsd>