LowEndBox - Cheap VPS, Hosting and Dedicated Server Deals

How to Stretch a 10GB VPS Disk: Compressed Folders, tmpfs, and Space-Saving Magic

Man in a Small BoxRunning a VPS with a tiny 10GB disk can feel like living in a studio apartment: you need to get creative with every bit of space. Whether you’re working with budget plans or just want to maximize efficiency, Linux offers powerful tools to stretch limited storage without compromising functionality.

In this guide, we’ll show you how to use some techniques to make the most of small disks.

Start With the Basics: Clear the Junk

Before getting into advanced tricks, reclaim wasted space:

Remove Unnecessary Packages

apt-get autoremove --purge
apt-get clean

Delete Old Logs and Caches

journalctl --vacuum-time=7d
du -sh /var/cache/*
rm -rf /var/cache/*

Find Big Files

du -ahx / | sort -rh | head -n 20

Once you’ve trimmed the fat, move on to structural solutions.

tmpfs: Move Temporary Data Into RAM

Now if you have a small VPS you may not have a lot of RAM, but if you do have some extra memory (or don’t need much), you can create a tmpfs filesystem.  tmpfs mounts directories in memory. This is great for temporary or high-churn data like logs or caches.  Of course, it goes away when you reboot, so don’t put anything critical there.

mount -t tmpfs -o size=256m tmpfs /tmp

This moves /tmp into RAM, saving disk writes and space.  Of course, you can mount other directories as -t tmps as well.

Create a Compressed Folder

If you have the option to partition your VPS, you can create compressed partitions,  But most of the time with small VPSes, you’re working with a template the provider gives you.  One way you can squeeze some space is to setup a directory in which all files are automatically compressed.

Keep in mind that some kinds of files compress very well, and some do not compress at all.  For example, there’s no purpose in putting a bunch of mp3 files into a compressed folder (they’re already compressed).  But if you had a lot of raw text data, those files would compress very nicely.

# apt -y install btrfs-progs
# dd if=/dev/zero of=/compressed.img bs=1M count=2048
# mkfs.btrfs /compressed.img
# mkdir /compressed
# echo "/compressed.img   /compressed   btrfs   loop,compress=zstd   0   0" >> /etc/fstab
# mount /compressed

And there you go.  Now you have a directory called /compressed which will automatically compress any file you put in it.  If you issue a “df -h” command you’ll see it mounted:

# df -h | grep compressed
/dev/loop0      2.0G  5.8M  1.8G   1% /compressed

Let’s test it.  We’re going to download the Enron email database from Carnegie Mellon University, which is 400MB compressed.  We’ll uncompress it and then copy it to /compressed as an example to show that it’ll use less space there.

# wget https://www.cs.cmu.edu/~enron/enron_mail_20150507.tar.gz
# tar xzf enron_mail_20150507.tar.gz 
# du -sh maildir
2.6G maildir
# cp -R maildir /compressed
# df -h /compressed
Filesystem      Size  Used Avail Use% Mounted on
/dev/loop0      2.0G  1.7G  182M  91% /compressed

So the 2.6GB of maildir is only 1.7GB on a compressed filesystem.

Keep in in mind that writing to and reading from that filesystem is going to burn some CPU for the compression work.  During the above activity, the load average was 1.5 and the cp process used 37% of CPU.

Final Thoughts

A 10GB VPS disk doesn’t have to feel like a prison.  Combine the above with good housekeeping practices (removing unneeded files and log rotation) and you can get a little breathing room.

What’s Your Favorite Trick?

Have your own VPS space-saving hacks? Share them in the comments and let the LowEndBox community know how you manage small disks!

1 Comment

  1. SplitIce's avatar

    10GB is small now? I’ve got plenty of embedded (pi like) systems running on 8GB eMMCs without resorting to anything this extreme.

    Journalctl BTW has settings for limiting its max disk (and ram) usage which is usually better than periodic trimming.

    September 27, 2025 @ 8:36 am | Reply

Leave a Reply

Some notes on commenting on LowEndBox:

  • Do not use LowEndBox for support issues. Go to your hosting provider and issue a ticket there. Coming here saying "my VPS is down, what do I do?!" will only have your comments removed.
  • Akismet is used for spam detection. Some comments may be held temporarily for manual approval.
  • Use <pre>...</pre> to quote the output from your terminal/console, or consider using a pastebin service.

Your email address will not be published. Required fields are marked *