Quick System Backup via Netcat

Sometimes a backup is needed but the server storage is not enough, in this case you must backup your data on the fly via the net, without the facility of storing locally and then transfer the data.There are many methods to backup your data on the fly, using rsync via ssh is one for example, but this post is about using netcat for a quick solution.Listening side, where the backup data will be stored, or destination:

~# mkdir /whatever_the_name_of_your_backup_dir~# cd !$~# netcat -l -p 12345 | pv | tar xjf -

Sending side, where the original data are, or source:

~# cd /~# tar cjf - --ignore-failed-read bin boot cdrom dev/ etc/ home/ initrd* lib/ root/ sbin/ usr/ var/ vmlinuz*  | pv | netcat -q 2 <YOUR_DESTINATION_IP> 12345

Don’t forget to create: /bin /media /mnt /opt /proc /selinux /srv /sys /tmpand chmod 1777 /tmp(This FHS is for a Debian Etch, please take care of different directories in your setup)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s