13.07.2015 Views

Linux System Administration Recipes A Problem-Solution Approach

Linux System Administration Recipes A Problem-Solution Approach

Linux System Administration Recipes A Problem-Solution Approach

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

CHAPTER 4 ■ TAKING BACKUPS AND MANAGING DATA4-11. Using Foremost to Retrieve DataIf fsck and dd aren’t enough to retrieve your data, you’ll need to try a little harder. You’ll need to startlooking through the raw disk data. You can do this manually by grepping through the disk image or usingstrings (see recipe 9-6), but it’s very hard work and will get you somewhere only if you’re lucky and ifyou’re just looking for text files.An easier alternative is Foremost (http://foremost.sourceforge.net/, available as theDebian/Ubuntu package foremost). This software was originally developed by the U.S. government fordata recovery, and it searches through a disk image to look for file headers, file footers, and otherinternal data structures.■ Note It’s a better bet to run this on a disk image, produced with dd as in recipe 4-8, than on your bad disk.The default rescue is straightforward and will output to the directory from where you ran it:foremost image.ddOr you can search for all defined types. These include text files; .jpg and other image files; .doc files;OLE files (a format used by PowerPoint, Excel, and so on); zipped files; media files using .avi, .wmv, andother formats; and some source code files). Then write them to a specified output directory:foremost -t all -o /rescue/dir -i image.ddThe -i switch identifies the image, the -o switch identifies the output directory to write to, and the -t switch gives file types (here it’s all). You can use the specific file type options if you’re looking only forspecific file types or if you want to extract and deal with different file types separately.If Foremost works, your files will be extracted without correct ownership and permissions, so you’llneed to go over the data afterward to correct that.■ Note scalpel and magicrescue (both available as Debian/Ubuntu packages of the same names) do the samesort of data recovery but are a little less resource intensive. None of these will re-create your directory structure.4-12. Rescuing Data: AutopsyAutopsy/Sleuthkit (available at http://www.sleuthkit.org/autopsy/ or as a package for most distros,called autopsy and sleuthkit on Debian/Ubuntu) is a Perl disk forensic browser with which you can lookthrough a filesystem in detail. If the previous recipes haven’t got you anywhere, you can try this recipe.116Download at WoweBook.Com

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!