This is the README file for wipefreespace, a program for secure wiping
 of free space on file systems.

Wipefreespace wipes the following things (when supported by the backing
 library):
- free space (space in unused blocks/clusters)
- free space in partially used blocks (also called the "slack space")
- deleted files' names and other data that can be used to undelete a file
  (like the journal)
Wipefreespace does NOT decrease the amount of available free space when
 working.

NOTE: it is best to use this program on un-mounted file systems, which
 makes sure the journal is committed.

NOTE: if a block is damaged, it is only wiped until the first error. There is
 no guarantee that it will be fully wiped.

Read the info documentation (type 'info doc/wipefreespace.info') to get more
 information.

Author: Bogdan Drozdowski, bogdandr @ op . pl
License: GPLv2+

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

The binary version of wipefreespace is linked with the GNU C Library,
 licensed under the GNU LGPL:

Copyright (C) 1991,92,93,94,95,96,97,98,99,2000,2001,2002,2003,2004,2005,
 2006,2007 Free Software Foundation, Inc.

The GNU C Library is free software; you can redistribute it and/or modify
 it under the terms of the GNU Lesser General Public License as published
 by the Free Software Foundation; either version 2.1 of the License, or
 (at your option) any later version.

The GNU C Library is distributed in the hope that it will be useful, but
 WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
 License for more details.

You should have received a copy of the GNU Lesser General Public License
 along with the GNU C Library; if not, write to the Free Software Foundation,
 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

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

Requirements for compiling the full version:

- a non-root account. Please, NEVER compile or 'make' anything as root.

- a working C compiler. XFS, ReiserFS, Reiser4 and NTFS support require the
  'long long' data type. NTFS support may require the gcc compiler.

- 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: 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 versions,
  like 1.41.

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

- XFS: xfsprogs installed and in your PATH variable, if you want XFS support.
  Get these at http://oss.sgi.com/projects/xfs/. 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 and
  compiled static libraries 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()).

- 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
	http://code.google.com/p/tffs-lib/
  to get the library. After compiling, install the library and ALL its
  header files (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).

- 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 and ALL the *.h header files
  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.

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' to get help.

Syntax:

	wipefreespace [options] /dev/XY [...]

Command line options:

--all-zeros		Use only zeros for wiping
--background		Continue work in the background, if possible. This
			disables verose mode.
-b|--superblock <off>	Superblock offset on the given filesystems
-B|--blocksize <size>	Block size on the given filesystems
-f|--force		Wipe even if the file system has errors
-h|--help		Print help
--last-zero		Perform additional wiping with zeros
-l|--license|--licence	Print license information
--method <name>		Use the given method for wiping (read below)
-n|--iterations NNN	Number of passes (greater than 0)
--nopart		Do NOT wipe free space in partially used blocks
--nounrm		Do NOT wipe undelete information
--nowfs			Do NOT wipe free space on file system
--use-ioctl		Disable device caching during work (can be DANGEROUS)
-v|--verbose		Verbose output. Use twice for more. This also enables
			progress bars, but be warned: these may not always be
			accurate or increase at a constant rate.
-V|--version		Print version number

The '/dev/XY' part stands for a device with a supported file system.
 Examples: /dev/hda1, /dev/fd0. More than one device can be given on the
 command line, but they will be wiped sequentially, NOT in
 multiple threads. WipeFreeSpace is not multi-threaded and probably
 won't be, because the libraries used can be not thread-safe.
The following method names (case-insensitive) are available:
 - Gutmann (method similar to Gutmann's, the default, 36 passes)
 - random (shred-like, 25 passes)
 - schneier (Shneier's method, 7 passes, contains ITSG-06)
 - dod (DoD, 3 passes, contains NAVSO P-5239-26 and German Federal
   Office for Information Security)
Each given filesystem is wiped ONLY ONCE, no matter how many times it
 appears on the command line.
WipeFreeSpace also works for file systems created inside regular
 files on any host file system.

Any option affects all filesystems given on the command line, not just
 the ones following it.

To perform a command after wiping (like sending e-mail), simply run a
 program after WipeFreeSpace is finished, for example:
	wipefreespace [options] /dev/XY; mail [options]
 or in a script:
	#!/bin/bash
	wipefreespace [options] /dev/XY
	mail [options]

To run WipeFreeSpace with a higher or lower priority, simply use the
 "renice" utility, for example:
	renice +1 $(pidof wipefreespace)

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

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/i386 and /usr/src/redhat/SRPMS

NOTE: some systems may use other directories than these.

Building an RPM package (the new way):

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/i386 and $HOME/rpmbuild/SRPMS

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

Translating the docs to your language:

 Type `msginit -i wipefreespace.pot -o XX.po', substituting your
2-letter language code for 'XX' (e.g. 'pl' or 'de'). This requires the
'gettext' package installed. You can manually copy the file
wipefreespace.pot to XX.po and manually add the following header, if
you wish.
 In the resulting XX.po file you have to fill in all the fields
marked with capital letters in the header:

# YOUR LANGUAGE translations for wipefreespace package.
# Copyright (C) 2007-2012 Bogdan 'bogdro' Drozdowski
# This file is distributed under the same license as
# the wipefreespace package.
# YOUR FULL NAME <EMAILADDRESS>, YEAR.
#
msgid ""
msgstr ""
"Project-Id-Version: wipefreespace VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-08-03 15:28+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAILADDRESS>\n"
"Language-Team: LANGUAGE <EMAILADDRESS>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"

The rest of the file will contain messages from the program. Translate
them all and send me the resulting XX.po file.

Translating the documentation:
- info: simply change the wipefreespace.texi file
- man: Unpack the page using 'gunzip wipefreespace.1.gz' and
  translate the resulting wipefreespace.1 file.
