Home arrow Latest Tutorials arrow Recovering deleted files under FreeBSD
Recovering deleted files under FreeBSD PDF
Saturday, 19 February 2011
If you deleted files by mistake under FreeBSD (or Linux), there is not all lost. You might lost your file name but the data is on the disk (unallocated space). It it is possible to somehow recover your data if you did not copied something else in that free space.

To recover that you will have to follow the following steps:

1. Step 1. Remove your drive and install it on other FreeBSD machine
------------------------------------------------------------------------------------------

Right when the tragedy happens you must shop your FreeBSD machine, remove the hard drive, install it on other FreeBSD machine. Is important not to copy any data on that disk or modify that disk in any way.

We asume that the disk with problem is /dev/ad1 and we installed this disk on a second machine where /dev/ad0 is the primary hard drive, where we will recover lost (deleted) data from /dev/ad1.


2. Step 2. Install testdisk app from ports
----------------------------------------------------

cd /usr/ports/sysutils/testdisk
make install clean



3. Step 3. Run photorec tool from testdisk app
-------------------------------------------------------------


After you've installed testdisk you will find a tool called photorec that belong to testdisk port/package.
Asuming that the drive you want to recover is /dev/ad1 and you have disk space available to recover data on your /dev/ad0 in /home/user/recover you will recover the deleted files with the command:

  mkdir /home/user/recover
  photorec /d /home/user/recover /dev/ad1


Your terminal will look like this:


PhotoRec 6.11, Data Recovery Utility, April 2009
Christophe GRENIER 
http://www.cgsecurity.org

Disk /dev/ad6 - 500 GB / 465 GiB (RO)
Partition Start End Size in sectors
1 * FreeBSD 0 1 1 969020 15 63 976773105


823779 files saved in /home/user/recover/recup_dir directory.  
Recovery completed.
txt: 575605 recovered
elf: 170782 recovered
tx?: 29877 recovered
gz: 26826 recovered
a: 5532 recovered
png: 4999 recovered
gif: 2798 recovered
tz: 2787 recovered
bz2: 1182 recovered
MYI: 980 recovered
others: 2411 recovered

And voila, you will find there your files.
Last Updated ( Saturday, 19 February 2011 )
 
< Prev   Next >

Other BSD Systems

OpenBSD

Misc

Solaris

Polls

Best BSD firewall?