Skip to main content

A simple program to zero out free blocks on the filesystem.

Project description

cleanfree v0.1a, a simple program to zero out free fs blocks

cleanfree is a relatively simple program written in python, designed to
write zeros to unused data blocks on a filesystem. This is primarily
indented for use on filesystems in virtualized hard disks, where the
virtual machine manager can sometimes reclaim the empty space for reuse
on the host system. Traditionally this would be done using something like
'dd if=/dev/zero of=/somefile'; that method has some major disadvantages:
* It takes a lot of time for a big disk.
* It uses all of the available disk space, causing concurrent writes
to fail.
There have already been some programs made to do essentially the same
thing, but all the ones that I know of at the time are specific to a
particular filesystem, and they lack some otherwise useful features
(like dumping a list of free blocks to stdout), cleanfree is intended
to address these issues.

cleanfree needs Python > 3.0 to run; for more info on Python, check
out <>. Currently, cleanfree only runs on POSIX
derived systems, because it needs to be able to access disk partitions
as files.

Version 1 will support FAT filesystems, support for other filesystems
will be added in subsequent versions.

Filesystems that I specifically plan to support:
* FAT (FAT16, FAT32, VFAT)
* UFS1 (BSD's FFS)
* UFS2 (From FreeBSD)
* Amiga FFS
* Amiga SFS
* BFS (BeOS FS, the newer 64 bit version)
* ext2/3/4
* HFS+
* Btrfs (Once it has stabilized more)

Filesystems that I may support if I can get documentation and have
sufficient time:
* Acorn Disk Filing System
* AthFS
* Fossil
* FAT12
* Novell Storage Services
* ReFS
* Reiser
* Reiser4
* VxFS

Filesystems that I won't support, and the reasons why:
* Any Log structured FS (NILFS, NILFS2, BSD's LFS, WAFL, LogFS):
Won't be supported because rewriting the unused blocks in a log
structured file system essentially invalidates the primary arguments
for using such a filesystem to begin with.
* Flash file systems (exFAT, FFS2, JFFS, JFFS2, TFAT, UBIFS, YAFFS):
Won't be supported for the reasons mentioned above under Log
structured FS; plus, the number of read/erase/rewrite cycles that
doing this to a flash device would generate would severely shorten
the life of the device.
* Any FS that is inherently read-only (cramfs, cromfs, squashfs):
Won't be supported because these filesystems don't have free blocks,
any block that is part of the fs is always in use. If you need to
get rid of redundant or 'unused' blocks in such a FS, you should
rebuild the fs itself.
* CD/DVD Filesystems (ISO9660, UDF, and their derivatives): Won't be
supported because of the reasons mentioned for read only filesystems.
* Distributed/Network Filesystems: Won't be supported because the
operation needs to be done on the underlying filesystem instead.
Some that have a dedicated on disk format may be supported.
* AdvFS (used by Tru64), CP/M FS, Macintosh FS, NetWare FS, Amiga
OFS, Amiga PFS, QNX4fs, QNX6fs, SkyFS: Won't be supported due to
the lack of documentation and/or lack of widespread use, although
if you want to add support yourself, I would be happy to add the
appropriate patches.

Project details

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page