Is it possible to make a copy of all files on a disk i.e. clone and backup the entire operating system including all directories and files via ssh? I have root access and I want to be able to restore the system in case I make a configuration mistake.

I would like to make a local copy of the installation and first try the changes in a sandboxed virtualized copy of the system which is a custom Linux.

  • 1
    What VMWare tool are you using, and is it free/premium?
    – DankyNanky
    Commented Jul 15, 2017 at 8:38

1 Answer 1


Take a look at the ddrescue and partimage programs. Both

  • run at the command line and thus can be used via SSH
  • are available in the repositories of most Linux distributions
  • are FOSS
  • are also available on the SystemRescueCd (a Live CD) – not important for your case here, but good to know for other cases

partimage can even store the backup files on a different machine via network directly, if that's needed.

That was for full-backup (never hurts to have). If you also want to be able to easily pick specific files. rsync is your friend. Again, this is available with all distributions. And "pepped up" with the proper helpers, it serves well for your purpose:

  • rsync-push-backup can be setup for the directories you care about, and then runs daily "snapshots" – only backing up what has changed. For everything else, the "hourly snapshots" have hard-links – so you can easily pick your file-to-restore with a simple file manager or scp command, while not expending too much disk space.
  • etckeeper uses a similar approach for your configuration files (in /etc). Instead of hourly snapshots, it only makes a backup whenever a file has been changed. But as the name suggests, this one is specific to your /etc directory. I mention it nevertheless as you named "configuration mistake" as something you wanted to protect against :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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