How to Backup a Website When Your Server Disk is Completely Full

Have you ever been in this nightmare situation?

  • Your web server disk is ~100% full
  • You urgently need to backup the website files (to fix an issue, migrate, or clean up)
  • But you can’t create a normal .tar.gz or .zip backup because there’s literally no space left to store it

When the server is choking and every megabyte counts, there’s a simple Linux trick that saves the day: send the compressed backup directly to another server without ever creating the archive file on the full server.

The Magic One-Liner Command

Run this command on the server that is full (the one that hosts your website):

tar czvf - /home/user/public_html | ssh user@backup-server "cat > /opt/website_backup.tar.gz"

That’s it. No temporary huge file is created on the full server.

How It Works (Simple Explanation)

  1. tar czvf - /home/user/public_html
  • This compresses your entire website folder (public_html in this example)
  • The - at the end of czvf - tells tar to send the compressed data to stdout (the pipe) instead of writing a file on disk.
  1. The | (pipe) sends that compressed data to the next command.
  2. ssh user@backup-server "cat > /opt/website_backup.tar.gz"
  • Opens an SSH connection to your backup server
  • Takes everything coming from the pipe and saves it as a proper .tar.gz file on the backup server.

Result:

  • The backup file is created only on the backup server
  • Your almost-full web server never uses extra disk space for the archive

If you don’t want the full absolute path inside the archive, use the -C flag:

tar czf - -C /home/user public_html | ssh user@backup-server "cat > /opt/website_backup.tar.gz"

This way the archive contains just the public_html folder, not /home/user/public_html.

Who Needs This Trick?

  • Developers & Sysadmins
    Perfect when the disk is almost full but you need to backup before migrating, rolling back, or cleaning logs.
  • Web Designers / Freelancers
    When a client’s VPS is full, the site is slow, and you need the current files safely backed up before deleting anything.
  • Small Companies & Agencies
    Not a full backup strategy, but an emergency skill that prevents downtime when the disk suddenly fills up.

Tips to Make It Even Better

  • Set up SSH keys (no password typing every time, and you can automate it)
  • Make sure the backup server has enough free space and a decent network connection
  • You can add this to monitoring scripts: when disk usage hits 95%, automatically push a backup to another machine

Final Words

This is a tiny command, but when your server is dying at 2 a.m. and you can’t free up space fast enough, it can save hours of panic and potential data loss.

If you manage even one VPS or Linux server, copy this command somewhere safe. One day you’ll thank yourself.

tar czf - -C /path/to/your/site public_html | ssh user@your-backup "cat > /path/backup.tar.gz"

Simple, zero extra disk usage on the full server, works every time.

(Shared from the internet – a classic admin lifesaver)

Lê Hoàng Tâm (Tom Le) is a Software Engineer and Cloud Architect with over 10 years of experience. AWS Certified. Specializes in distributed systems, DevOps, and AI/ML integration. Founder of Th?nk And Grow — a platform sharing practical technology insights in Vietnamese. Passionate about building scalable systems and helping developers grow through real-world knowledge.