How to restore data atomically on a remote server?

view story

http://unix.stackexchange.com – I want to be able to backup and restore my home directory of a remote account. The command I use are: Backup ssh [email protected] "tar jcf - ." > backup.tar.bz2 Restore cat backup.tar.bz2 | ssh [email protected] "tar jxf - ." I'd like to be sure that all the files are restored or none, even if the server gets rebooted in the middle of a restore. Any way to achieve what I want? I'd like to maintain the commands shown above as a base, but other ideas are appreciated as well. (HowTos)