CLASS="sect1" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" >

10. Directory And File Management

Q: How Do I Undelete Files?
Q: How Do I Make Backups?
Q: Is There a Defragmenter for Ext2fs?

Q: How Do I Undelete Files?

A: In general, this is very hard to do on unices because of their multitasking nature. Undelete functionality for the ext2fs file system is being worked on, but don't hold your breath.

There are a number of packages available which instead provide new commands for deleting and copying which move deleted files into a "wastebasket" directory. The files can be recovered until cleaned out automatically by background processing.

The Midnight Commander file manager provides an undelete facility that uses Ext2 file system library functions and an undelete directory for each file system. Commercial distribution packages of MC may or may not have this feature enabled, so be sure to look in the source code distribution for instructions on how to enable the undelete feature.

Alternatively, you can search the raw disk device which holds the file system in question. This is hard work, and you will need to be logged in as root to do this. But it can be done. Run grep on the raw device; e.g.:

 grep -b 'bookmarks' /dev/hda

If the data has not been overwritten, you should be able to recover it with a text editor.

[Dave Cinege, Daniel Novotny]

Q: How Do I Make Backups?

A: You can back up a directory hierarchy or complete file system to any media using GNU tar or cpio, the standard *nix tools for this purpose. tar seems to be the more commonly used program currently, and includes command line options to make compressed, incremental, and multi-volume backups. Complete information is contained in the documentation, which is in GNU Texinfo format.

A: The free program, Amanda, receives a lot of mentions on Usenet. Its home page is http://www.amanda.org.

A: Several commercial backup utilities also exist. They are often included in commercial distributions.

Q: Is There a Defragmenter for Ext2fs?

A: Yes. There is defrag, a Linux file system defragmenter for ext2, Minix, and old-style ext file systems. It is available at ftp://metalab.unc.edu/pub/Linux/system/filesystems/defrag-0.70.tar.gz. Users of the ext2 file system can probably do without defrag, because ext2 contains extra code to keep fragmentation reduced even in very full file systems.