Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm setting up a VPS that'll host a couple of sites, and I'd like to back up everything to another host which has a nice massive ZFS, allowing me to snapshot frequently.

With the knowledge I have ATM, I only see rsync as a solution since it does delta backups with the -c flag, pretty necessary since this VPS has a limited bandwidth and potentially a quite large dataset, so transmitting everything one or several times a day isn't feasible.

On the other hand, that means that if I need to properly preserve permissions and back up everything, including stuff that's only readable by root (such as SSL certificates), I need to enable authkey SSH root logins on either one of the hosts (and push or pull backups accordingly). And I'd really like to avoid that.

Or do I need to do that? Is there some trick that you know of that would allow me to run some cronjob on the VPS and push out differential backup data to my other host without having to compromise security yet still be able to back up all files and preserve their permissions and ownerships?

I guess a last resort could be to set up a VM on the ZFS host only for this purpose, enable password-less ssh root logins on a non-standard port inside it, make sure its disk image is on ZFS (or is a ZVOL) and then push the backup files to it. But damn, that seems clunky, it would be a hassle to set up, and it'd eat resources on that host.

Ideas?

Thanks :)

share|improve this question
    
I am not that knoledgable, but I think you could have the host that you are backing up use rysnc to push a backup to the other host? Like on the host you are backing up, have a root cron job that rsync the full system to the other server. Because you don't have to have root access on the receiving end, I think that would work. –  DaboRoss Jun 18 '13 at 7:03
    
@DaboRoss that's what I want, the problem is to preserve ownerships and permissions. Even if some files can be sent as non-root and have their ownership changed, a subsequent update would fail because those files would no longer be owned on the receiving end by the SSH user. But thanks :) –  DanielSmedegaardBuus Jun 18 '13 at 7:42

1 Answer 1

up vote 1 down vote accepted

Have you considered using tar to do the incremental deltas, and rsyncing the resulting tarballs with normal user permissions? sudo tar locally would preserve the ownership and permissions within the tarball, but neither machine would need to grant elevated permissions for the other.

It would eat more disk space, but that might be a cost you can afford in this case.

share|improve this answer
    
That's very interesting, I had no idea tar could do incremental backups like that. It's still not optimal for large files like DBs (since it would send the entire file again once it changes), but it might very well work for other, more "normal", files like /etc, www, etc. Thanks :) –  DanielSmedegaardBuus Jun 18 '13 at 7:40
    
I was hoping for an even easier way, but there probably isn't, and your way is a very good alternative, so I'm accepting it as the correct answer. Thank you for the help :) –  DanielSmedegaardBuus Jun 19 '13 at 9:07

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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