WipeFreeSpace - a program for secure cleaning of free space on filesystems.

Requirements for compiling the full version:

- a working C compiler. XFS, ReiserFS, Reiser4 and NTFS support require the
  'long long' data type. NTFS support may require the gcc compiler.
  C++ compilers won't work due to variable casts.

- development package for the C library (like glibc-devel and glibc-headers)
  XFS support requires the following headers: unistd.h, fcntl.h, mntent.h
  (but sys/wait.h, sched.h and paths.h can be useful, too) and the following
  functions: fork(), execvp(), dup2(), close(), pipe(), kill() and
  waitpid() or wait() (sleep() can be useful, too).

- the 'make' program

- Ext2/3/4: the development package for the ext2 file system library, libext2fs
  (usually included in something like e2fsprogs-devel). If you don't have
  anything like this installed or available (check twice), then go to
  	http://e2fsprogs.sf.net/
  Then compile and install that package. Ext4 support requires new enough
  versions, like 1.41.

- NTFS: the development package for the NTFS file system library,
  ntfs3g-ntfsprogs. If you don't have anything like this installed or
  available (check twice), then go to
	http://www.tuxera.com/community/ntfs-3g-download/
  Then compile and install that package. You can also use libntfs (usually
  included in something like ntfsprogs-devel).

- XFS: xfsprogs installed and in your PATH variable.
  Get these at https://kernel.org/pub/linux/utils/fs/xfs/xfsprogs/. The
  following utilities should be available: xfs_db, xfs_freeze, xfs_unfreeze.
  The xfs_db program should support the following command-line options: "-i",
  "-c" and the following interactive mode commands: "quit", "freesp -d",
  "blockget -n", "ncheck", "sb 0", "print". Version 2.7.11 is enough, earlier
  versions will probably also work.

- ReiserFSv3: development package for reiserfsprogs (header files - *.h - and
  compiled static libraries - *.a - from the package). ReiserFS requires either
  the fork() function (unistd.h) and one of the waitpid(), wait() functions
  (sys/wait.h), the mntent.h header file (with at least one of its functions
  - getmntent() or getmntent_r()).

  If you're having trouble compiling, try to apply the patch first:
	patch -F10 -p1 < /path/to/wipefreespace-XX/patches/reiser-3.6.XX-compile-fix.diff

  See below for other patches that may be necessary.

- Reiser4: development package for reiser4progs, libuuid (e2fsprogs or
  e2fsprogs-libs), libaal and the mntent.h header file. Go to
  	http://www.kernel.org/pub/linux/utils/fs/reiser4/
  and
  	http://e2fsprogs.sf.net/
  to get the libraries. After installing, libmisc.a needs to be copied
  in the same place as libreiser4.a, but under a different name,
  libreiser4misc.a:

  cp reiser4progs-XX/libmisc/.libs/libmisc.a /dst/path/libreiser4misc.a

  Libmisc.a is in reiser4progs, of course. Nobody thought it would be
  needed, but libreiser4.a is useless without it.

- FAT12/16/32: tffs-lib, the Tiny FAT FS library. Go to
	https://github.com/likema/tffs-lib
  to get the library (former address: http://code.google.com/p/tffs-lib/).
  To make WipeFreeSpace work faster, apply the patch that removes synchronising
  the filesystem from TFFS (WipeFreeSpace does its own synchronising):

	patch -F10 -p0 < /path/to/wipefreespace-XX/patches/tffs-speed.diff

  If you experience crashes (especially on x64), you may try to apply three
  more patches:

     patch -F10 -p0 < /path/to/wipefreespace-XX/patches/tffs-free-fix.diff
     patch -F10 -p0 < /path/to/wipefreespace-XX/patches/tffs-overflow-fix.diff
     patch -F10 -p0 < /path/to/wipefreespace-XX/patches/tffs-fat-eof-fix.diff
     patch -F10 -p0 < /path/to/wipefreespace-XX/patches/tffs-dir-fix.diff

  After applying any patch, you need to recompile and install the library -
  libtffs.a - and ALL its header files - *.h - (including the private ones,
  from the src directory).

- MinixFS: "mfstool", the MinixFS tool. Go to
	http://mfstool.sourceforge.net/
  to get this program. Before compiling, perform:

  	sed -i 's/opt_squash/0/g' `ls *.c | egrep -v main`

  then compile the program (./configure && make), then perform

  	ar surf libminixfs.a `ls *.o | egrep -v main`

  Then copy the files libminixfs.a, minix_fs.h and protos.h to a directory
  where the C compiler can find them (or put the correct -I and -L options
  in the compiler flags). You can use the provided patches to do this
  instead of the sed command:

	patch -F10 -p1 < /path/to/wipefreespace-XX/patches/mfstool-0.5.diff

- JFS: jfsutils and libuuid (the <uuid/uuid.h> header file). Go to
	http://jfs.sourceforge.net/
  to get jfsutils. Libuuid can be a part of "util-linux-ng", which can be
  found on the kernel site:
	ftp://ftp.kernel.org/pub/linux/utils/util-linux-ng/
  or as a part of e2fsprogs available at
  	http://e2fsprogs.sf.net/

  Compile jfsutils, then copy all the jfs_*.h header files from the
  "include" subdirectory and the libfs.a file to a directory where the
  C compiler can find them (or put the correct -I and -L options in the
  compiler flags).

  If you're having trouble compiling, try to apply the patch first:
	patch -F10 -p1 < /path/to/wipefreespace-XX/patches/jfsutils-1.1.11-compile-fix.diff

- HFS+: the "hfsplus" package. Go to
https://launchpad.net/ubuntu/+archive/primary/+files/hfsplus_1.0.4.orig.tar.gz
  to get it. Before compiling, apply the patch:

	patch -F10 -p1 < /path/to/wipefreespace-XX/patches/hfsplus-1.0.4.diff

  After compiling, install all the libraries - *.a - and ALL the header
  files - *.h - from the libhfsp/src/ directory where the C compiler can
  find them (or put the correct -I and -L options in the compiler flags).

- OCFS: the "ocfs2-tools" series 1.6.x package (other versions also work, but
  disable wiping undelete data in such case). Go to
	http://oss.oracle.com/projects/ocfs2-tools/
  to get it. Then compile and install that package.

  If you're having trouble compiling, try to apply the patch first:
	patch -F10 -p1 < /path/to/wipefreespace-XX/patches/ocfs2-tools-1.6.4-compile-fix.diff


WARNING: If both ReiserFSv3 and ReiserFSv4 are enabled, the program may
 refuse to link if the compiler doesn't support the command line option
 "-Wl,-z -Wl,muldefs" that makes the linker accept multiple symbol
 definitions. If you have this problem, disable the support for either
 of these filesystems (you can compile two versions of the program).
 Don't complain to me, complain to the guys that made reiserfsprogs and
 reiser4progs. You can fix either of these libraries yourself, by running

	find . -type f -exec sed -i 's/misc_mntent/new_misc_mntent/g' '{}' \;

 in the root directory of either reiserfsprogs or reiser4progs (but
 NOT both, because this would bring back the same problem, but with a
 different name). Type the command as above. The command must be run
 BEFORE compiling the reiserfs programs. You can use the provided patches
 to do this:

	patch -F10 -p1 < /path/to/wipefreespace-XX/patches/reiser-3.6.XX.diff
	patch -F10 -p1 < /path/to/wipefreespace-XX/patches/reiser4-1.0.7.diff

WARNING: If both ReiserFSv3 and MinixFS are enabled, the program
 may refuse to link if the compiler doesn't support the command line option
 "-Wl,-z -Wl,muldefs" that makes the linker accept multiple symbol
 definitions. If you have this problem, disable the support for either
 of these filesystems (you can compile two versions of the program).
 You can fix either of these libraries yourself, by running

	find . -type f -exec sed -i 's/die/new_die/g' '{}' \;

 in the root directory of either reiserfsprogs or mfstool (but
 NOT both, because this would bring back the same problem, but with a
 different name). Type the command as above. The command must be run
 BEFORE compiling reiserfs/mfstool. You can use the provided patches
 to do this:

	patch -F10 -p1 < /path/to/wipefreespace-XX/patches/mfstool-0.5.diff
	patch -F10 -p1 < /path/to/wipefreespace-XX/patches/reiser-3.6.XX.diff

WARNING: If both ReiserFSv3 and JFS are enabled, you MUST either disable
 the support for either of these filesystems (you can compile two
 versions of the program) or fix either of these libraries yourself,
 by running

	find . -type f -exec sed -i 's/bread/new_bread/g' '{}' \;

 in the root directory of either reiserfsprogs or jfsutils (but
 NOT both, because this would bring back the same problem, but with a
 different name). Type the command as above. The command must be run
 BEFORE compiling reiserfs/jfsutils. You can use the provided patches
 to do this:

	patch -F10 -p1 < /path/to/wipefreespace-XX/patches/jfsutils-1.1.11.diff
	patch -F10 -p1 < /path/to/wipefreespace-XX/patches/reiser-3.6.XX.diff

 Even if your linker/compiler accepts the "-Wl,-z -Wl,muldefs" option, it
 won't help in this case.

The patches for ntfsprogs are optional. Whether or not they will be included
 in the official release of ntfsprogs, WipeFreeSpace still will compile.

Type

	./configure

to configure the program for your system.
If you do not wish support for a filesystem, give the '--enable-FS=no'
 option to ./configure (FS=EXT234, NTFS, XFS, REISERFS, REISER4, FAT,
 MINIX, JFS, HFSP, OCFS).
If you do not wish support for a particular wiping operation, give the
 '--enable-OPER=no' option to ./configure (OPER=wfs, unrm, part - these
 are wiping free space, undelete data and partially-used blocks,
 respectively). You cannot disable all of these.
Run './configure --help' for details.

If you do NOT wish WipeFreeSpace to use the network or get the computer's IP
 address, get LibHideIP>=0.2 and LibNetBlock and configure WipeFreeSpace with

	./configure --enable-LIBHIDEIP --enable-LIBNETBLOCK

NOTE: this may cause network filesystem wiping to fail.

Type

	make

to compile the program.

Documentation will be compiled, if you have the 'makeinfo' program
 ('texinfo' package).
Translations will be compiled, if you have the 'gettext' package.

NOTE: if you have trouble compiling, send me some of the first error messages
in each file and the config.h file generated by the 'configure' script.

Type

	make install

to install the program (NOT recommended) or read below on how to make an
RPM package (recommended).

Type 'info wipefreespace' (or 'info doc/wipefreespace.info' before install)
 to get help.

=======================================================

Building an RPM package:

1) copy the wipefreespace.spec file to $HOME/rpmbuild/SPECS
2) copy the source package wipefreespace-XX.tar.gz to $HOME/rpmbuild/SOURCES
3) type
        rpmbuild -ba $HOME/rpmbuild/SPECS/wipefreespace.spec
4) get the RPMs from $HOME/rpmbuild/RPMS/<arch> and $HOME/rpmbuild/SRPMS

Building an RPM package (the old way):

1) copy the wipefreespace.spec file to /usr/src/redhat/SPECS
2) copy the source package wipefreespace-XX.tar.gz to /usr/src/redhat/SOURCES
3) type
	rpmbuild -ba /usr/src/redhat/SPECS/wipefreespace.spec
4) get the RPMs from /usr/src/redhat/RPMS/<arch> and /usr/src/redhat/SRPMS

NOTE: some systems may use other directories than these.
