Recovering data from a newfs filesystem

Michaël Grünewald michael.grunewald at laposte.net
Sun Jan 20 02:20:15 PST 2008


"Kelly Jones" <kelly.terry.jones at gmail.com> writes:

> Months ago, I got a new USB drive for my Mac OS X, did "newfs
> /dev/disk1" on it, and it's been working fine.
>
> I then foolishly did "disklabel -create /dev/disk1", which broke
> it. How can I recover my data? I've tried fsck w/ alternate
> superblocks to no avail.

Create a disk image with dd(1), connect the image to a md device with
mdconfig(8) and run a disk image analysis tool on it, like testdisk
(available from the ports). If testdisk manages to recover disk
structure and you're happy with it, you can use the corrected image
back to the USB drive with dd(1).

Creating the disk image is optional, but since you'll allow testdisk
to modifiy the data it works on, it's bet to do a copy.

You may want to test integrity of the image with sha256(1) and/or
md5(1), before running disk analysis software on it.

Notes: 1/I do not know if mdconfig(8) is available for OS-X, although
 something is likely to provide the same functionality;
       2/On Mac OS-X you may use PKGSRC (see NetBSD website) or Fink to
 install disk analysis software.
-- 
Best wishes,
Michaël


More information about the freebsd-questions mailing list