Backup your virtual server through ssh to another cloud server

We offer a number of awesome features  our users can take advantage of so they can experience the true flexibility and control we believe they deserve. However, sometimes , we have some server administrators that would really prefer to do some tasks only on the command line  and call it a day. And although we offer a number of simple to use, intuitive features to  make server administrating as easy as possible, they have become hard wired with preferring to  run a command or two to find the solution they need.

We recently added new backup features in our portal that would allow users to make on-demand backups, scheduled backups, restore the server from a backup created, and even make a customized template from a backup. And despite how incredibly easy  these features are, a handful of  our Linux users still prefer to run their run backups through cron or SSH to another server. So for example, if they had a server in the UK and wanted to make sure they had access to their files at any time regardless of the status of their server, they would backup the server through SSH to a server in Toronto.

Occasionally, Support will receive a ticket from a client curious on how to backup the server through ssh. And all though we recommend to all clients that they take advantage of our backup utility in the Zunicore User portal, we offer our users the following command for backing up a server over ssh :

tar -cvpzf backup.tar.gz --exclude=/backup.tar.gz --exclude=/proc --exclude=/lost+found --exclude=/sys
 --exclude=/mnt --exclude=/media --exclude=/dev / | ssh [email protected] "(cat >filename.tar.gz)"
 
  • tar    command to create the archive
  • -c    create a new backup
  • -v    verbose mode
  • -p    preserves the permissions of the files
  • -z    compress the backup file with gzip
  • -f    the  file name
  • -exclude=    which directories to exclude from the backup.  This can change depending what you would like to achieve and what directories you need backed up.
  • |    pipe the output of tar through ssh  which will then run the cat command on Server B
  • ssh    remotely execute cat on the remote server to create the file name
  • username    the account on the remote server with root priviledges
  • IP   Address    the remote server you are backing up  to
  • filename    the destination file name you wish to give to the new backup on the remote server

In the above example, we have backed up the entire ServerA (excluding mounted directories, lost and found, proc, and media) to ServerB. We provide the back up a distinguishable name we can easily search for when we need to find the file for quick reference.

Once the command has finished, you can log in to the backup server (ServerB) and check if the backup was copied over.

0 Responses to “Backup your virtual server through ssh to another cloud server”



  1. Leave a Comment

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 )

Connecting to %s




Twitter Updates


Follow

Get every new post delivered to your Inbox.