ufs recovery

Frank Leonhardt freebsd-doc at fjl.co.uk
Sun Sep 8 10:02:03 UTC 2013

On 08/09/2013 10:39, Laszlo Danielisz wrote:
> On 2013.09.08., at 11:07, Frank Leonhardt <freebsd-doc at fjl.co.uk 
> <mailto:freebsd-doc at fjl.co.uk>> wrote:
>> On 08/09/2013 09:46, Laszlo Danielisz wrote:
>>> Hi,
>>> By mistake I forgot to edit my crontab on my FreeBSD 8.3 after I 
>>> took out one of the hard drives.
>>> I had a little rsync script which I used to synchronise a directory 
>>> between those two hard drives, because one of the hard drives were 
>>> not present anymore and rsync had the --delete parameter I end up 
>>> deleting the whole directory, of course with precious informations.
>>> I have ufs on the hdd, after the "accident" I've turned off the 
>>> computer to avoid any writings on the disk.
>>> Do you have any idea how can I recover the lost directory?
>>> Thank you!
>>> Laci
>> Hi Laci,
>> I'm sorry to have to tell you that recovering UFS is not easy. It's 
>> not like MS-DOS or NFTS at all in that respect. When you delete from 
>> UFS it removes inode data and adds the space released to the free 
>> block list. It's a one-way process; there is no journalling and no 
>> way to undo any of it.
>> I don't know of any public domain utilities that will do what you 
>> need. EnCase can do something with UFS, and a utility called "Raise 
>> Data Recovery" will get stuff from damaged disks. This isn't the same 
>> as getting back deleted files.
>> The only option I've ever found to work is to scan the disk's free 
>> blocks (all of them in your case) with a utility that recognises 
>> specific file formats and pieces the file together using the contents 
>> it reads from each block, using "best guess" and manual choice to 
>> decide which the next block is. This is no joke if you've lost a lot 
>> of files, but worth it if you have one or two vital ones amongst them.
>> Sorry I can't be of any more comfort. As I'm sure someone will chip 
>> in, there are things you can do before the event.
>> Regards, Frank.
> Hi Frank,
> Thank you very much for the information!
> Meanwhile I've found this software: http://www.ufsexplorer.com/, I'm 
> going to give a try.
> Regards,
> Laci

That's the company that produces the "Raise Data Recovery" product I 
mentioned. However, I believe it's better for recovering data from a 
broken FS in the case of UFS2, not for undeleteing a whole 
directory/disk full of "deliberately" deleted files. I just checked, and 
it has a try-before-buy feature so you have nothing to lose. Good luck, 
and please keep us informed!

FWIW I use Pandora for jobs similar to this, although it doesn't 
specifically support UFS. Piriform's Recuva also has its uses. But where 
UFS is involved I've failed to find a magic solution - just recovery 
from a backup unless it's one or two odd files. About the only thing you 
have going for you with UFS is the directory retains the file name after 
deletion if you haven't created any new files over it. But the inode 
(where it is on the disk) is another matter.

Regards, Frank.

More information about the freebsd-questions mailing list