I have a VPS that we will be shutting down soon, so I want to create a full backup of it. I was thinking about rsync, because if I google linux and backup words, I constantly get hit by rsync, so why the hell not. :) However, here comes the kicker.

The backup machine where I want to backup the VPS in not accessible from the internet. So I can't just use what almost everybody suggests to SSH into the VPS, sudo rsync almost everything and as output mark the backup server. I want to run a bash command that does something similar to dd, so if I run rsync on the remote server, I could mark my local folder as output. Also I have to mention, that root ssh login is not allowed, so I can only SSH into the VPS as a user who can actually turn into sudo, but by default it is just a plain user.

I came up with the following rsync command:

sudo rsync -aAXv --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"} /* /backup/machine/folder

And I wish to use it somehow like this dd command I've used for cloning but the opposite way:

dd if=/dev/sda bs=4096 | pv | ssh root@<<TargetServer-IP>> ”dd of=/dev/sda bs=4096”

1 Answer 1


I love to post questions here because about 50% of them is being answered by myself. I usually take a few hours to decide to upload the question here, and after that a few mutes later, I get my answer. :) Here is the command:

rsync --dry-run root@omd.myserver.hu:/ -aAXvh --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"} /backup/backup/servers/omd

OFC exclude the --dry-run from the command if you want to execute it. Also, you have to add your SSH public key to /root/.ssh/authorized_keys file to make this work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.