![](/posts/disk-compression/images/featured_hu9eedbd0aaa4ab2ac6a10d667cdf44e0e_440944_1200x300_fill_q75_box_center.jpg)
Disk Compression
Even though disk space is getting cheaper every year, the price per GiB is still more than zero. Saving disk space by minimizing wasted space should be high on the priorities list for every halfway decent systems administrator.
Running the following command will compress the space used on your root file
system. If you have a separate file system for /home
consider running the
same command for that file system first.
|
|
What it does
This command searches, depth-first, for every file on your root file system,
and then compresses those files using xz
.
Why it works
We never said it would transparently compress those files. It just replaces every single <file>
with <file>.xz
The find command searches the root file system (find /
), and only that file system (-xdev
) depth-first (-depth
) for all regular files (-type f
), then prints a list of all files found using null-byte termination. This is then piped into xz
as a list of files to compress (xz --files0
)
TL;DR
- Usable files
- Wasted space
- Fun