Small Space

Introduction

There are different types of techniques to gain more disk space, such as sharing of space, freeing unused or redundant space, filesystem tuning and compression. Note: some of these techniques use memory instead of disk space. As you will see, there are many small steps necessary to free some space.

Techniques

  1. Stripping: Though many distributions come with stripped binaries today it is useful to check this. For details see man strip. To find every unstripped file you can use the file command or more convenient the tool findstrip. Attention: don't strip libraries, sometimes the wrong symbols are removed due to a bad programming technique. Or use the --strip-unneeded option.

  2. Perforation: zum(1) reads a file list on stdin and attempts to perforate these files. Perforation means, that series of null bytes are replaced by lseek, thus giving the file system a chance of not allocating real disk space for those bytes. Example: find . -type f | xargs zum

  3. Remove Odd Files and Duplicates: Check your system for core files, emacs recovery files <#FILE#> vi recovery files <FILE>.swp, RPM recovery files <FILE>.rpmorig and patch recovery files. Find duplicates, you may try finddup. Choose a system to name your backup, temporary and test files, e.g. with a signature at the end.

  4. Clean Temporary Files: , e.g. /tmp, there is even a tool tmpwatch.

  5. Shorten the Log Files: usually the files in /var/log. You may use logrotate to achieve this task.

  6. Remove Files: Remove files which are not "necessary" under all circumstances such as man pages, documentation /usr/doc and sources e.g. /usr/src .

  7. Unnecessary Libraries: You may use the binstats package to find unused libraries (Thanks to Tom Ed White).

  8. Filesystem: Choose a filesystem which treats disk space economically e.g. rsfs. Tune your filesystem e.g. tune2fs. Choose an appropriate partition and block size.

  9. Reduce Kernel Size: Either by using only the necessary kernel features and/or making a compressed kernel image bzImage.

  10. Compression: I didn't check this but as far as I know you may compress your filesystem with gzip and decompress it on the fly. Alternatively you may choose to compress only certain files. You can even execute compressed files with zexec

  11. Compressed Filesystems: - For e2fs filesystems there is a compression version available e2compr.

    - DMSDOS which enables your machine to access Windows95 compressed drives (drivespace, doublestacker). If you don't need DOS/Windows95 compatibility, i.e. if you want to compress Linux-only data, this is really discouraged by the author of the program.

  12. Partition Sharing: You may share swap-space (see Swap-Space-HOWTO) or data partitions between different OS (see mount). For mounting MS-DOS Windows95 compressed drives (doublespace, drivespace) you may use dmsdos dosfs/ .

  13. Libraries: Take another (older) library, for instance libc5 , this library seems to be smaller than libc6 also known as glibc2 .

  14. Kernel: If your needs are fitted with an older kernel version, you can save some space.

  15. GUI: Avoid as much Graphical User Interface (GUI) as possible.

  16. Tiny Distributions: There are some distributions available which fit from one 3.5" floppy to 10MB disk space and fit for small memories, too. See Appendix A, Other Operating Systems Appendix D and below.

  17. External Storage Devices (Hard Disks, ZIP Drives, NFS, SAMBA): Since many notebooks may be limited in their expandability, using the parallel port is an attractive option. There are external hard disks and ZIP Drives available. Usually they are also connectable via PCMCIA. Another way is using the resources of another machine through NFS or SAMBA etc.

  18. Purging of uneeded locales: localepurge for Debian is just a simple script to recover disk space wasted for unneeded locale files and localized man pages. Depending on your installation, it is possible to save some 200, 300, or even more megabytes of disk space usually dedicated for locales you'll probably never have any usage for.