Undelete or recover from badblocks on disks

Roland Smith rsmith at xs4all.nl
Sat Sep 19 08:43:26 UTC 2009

On Fri, Sep 18, 2009 at 10:17:31PM -0700, jaymax wrote:
> Thanks Roland, 
> smartctl showed disk to be fine!
> fls requires a disk image, is there one created by default in FreeBSD 6.0 . 

No, you have to create one.

> Running fls in directory of deleted files/dir produced
> > #fls -adr 2
> > Missing image file names (img_open)
> > 
> Is there a solution to this ?

Create a disk image from the damaged drive, and save it on another disk with
enough space. You can use dd(1) to create a disk image. You can devide the
image into several files. For example, I will use dd to get two consecutive 10
MiB pieces from a disk partition on a USB stick:

# dd if=/dev/da0s1 of=dd1.img bs=1m count=10
10+0 records in
10+0 records out
10485760 bytes transferred in 1.031497 secs (10165575 bytes/sec)
# dd if=/dev/da0s1 of=dd2.img bs=1m count=10 iseek=10
10+0 records in
10+0 records out
10485760 bytes transferred in 1.021128 secs (10268799 bytes/sec)

Without specifying it, dd uses 512 byte blocks. This can take along time,
because dd then needs to do a lot of small reads. Therefore I tend to specify
a larger block size. Note that 'bs=1m count=10' reads the save amount of data
as 'bs=10m count=1' and 'bs=1k count=10240'. Using a larger blocksize will
usually mean faster reads, but I do not know what the practical limits to
block sizes are. I would not start by using 'bs=1g', though.

The (valid, IMHO) reason for using disk images is that you want to investigate
a copy of the data, so you cannot accidentily destroy the original data.

R.F.Smith                                   http://www.xs4all.nl/~rsmith/
[plain text _non-HTML_ PGP/GnuPG encrypted/signed email much appreciated]
pgp: 1A2B 477F 9970 BA3C 2914  B7CE 1277 EFB0 C321 A725 (KeyID: C321A725)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20090919/8176c66a/attachment.pgp

More information about the freebsd-questions mailing list