Skip to content

Instantly share code, notes, and snippets.

@khanghh
Last active October 19, 2025 06:08
Show Gist options
  • Select an option

  • Save khanghh/bb3a5d38e1982ba6e1796f395642edbc to your computer and use it in GitHub Desktop.

Select an option

Save khanghh/bb3a5d38e1982ba6e1796f395642edbc to your computer and use it in GitHub Desktop.
Full Disk Backup over Netcat

Full Disk Backup over Netcat (Linux)

Purpose: Backup a full disk from server to client using dd and netcat.


Server

sudo dd if=/dev/vda bs=64K conv=noerror,sync status=progress | nc -l -q1 -p9000
  • -q1 → closes socket 1s after EOF

Client

nc <server_ip> 9000 | dd of=backup.img bs=64K status=progress

With Compression

Server:

sudo dd if=/dev/vda bs=64K conv=noerror,sync status=progress | gzip -1 | nc -l -q1 -p9000

Client:

nc <server_ip> 9000 | gunzip -c | dd of=backup.img bs=64K status=progress
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment