Have you looked at your
VPS and said to yourself,
"10 GB? Is that all it has?!" Yup, I was there too. The first VPS that I used was tiny, and I quickly realized how limited that can be. But then I learned some tricks, and I freed up a ton of space. If you have a
small VPS, and you want to make
10 GB work, here is what I did.
Step 1: Delete Old files
Before we try anything fancy, let’s remove the junk. You may be shocked at the space that clears by just taking this step.
Run the following commands:
apt-get autoremove --purge – removes any packages that are not being used.
apt-get clean – cleans the cached files.
journalctl --vacuum-time=7d – removes any logs older than 7 days.
To look for the big files:
du -ahx / | sort -rh | head -n 20
This last command tells you what is using your space.
Step 2: Utilize tmpfs to Conserve Disk Space
This is a cool trick: use your
RAM and not your disk for temporary files. That’s how we introduce: tmpfs.
To set up tmpfs
mount -t tmpfs -o size=256m tmpfs /tmp
This will move your /tmp folder into memory and leave your disk free of junk. Just remember, anything in /tmp will be gone after you reboot, so don’t use this for important files.
Step 3: Use Compressed Folders
Want a real space saver, as in “magic”? Use a
compressed filesystem. In a nutshell, it means that your files take up less space, and you don’t have to do anything differently.
You would do it like this:
1. Install btrfs-progs.
2. Make a file for your new folder:
dd if=/dev/zero of=/compressed.img bs=1M count=2048
3. Format your new file:
mkfs.btrfs /compressed.img
4. Mount it with compression:
mount -o loop,compress=zstd /compressed.img /compressed
In one of my tests, a
2.6GB folder showed up at
1.7GB after compression — that's a savings of
900MB!
Step #4: When to Use These Tricks
These tricks can be used when:
- You are using a small VPS (ex: 10GB).
- You mostly store text or log files (these compress well).
- You don't mind using additional CPU or RAM to save space.
Overall Thoughts
So there you have it — even a 10GB VPS can feel bigger using a few tricks. Just declutter your files, utilize temporary files on tmpfs, and add another compressed folder for the rest. I have done it, and save a lot of space; The question is, why be limited, when you can stretch your VPS for free.