Linux – How to Backup or Restore a Disk Image from an FTP Server

  1. From the bash prompt, log into the FTP server with your username and password.
  2. Change into the preferred directory with the “cd” command.
  3. If doing a restore, issue the “dir” command to list the directory’s contents to find the correct filename of the disk image you want to restore.
  4. To backup a disk image onto the FTP server using “dd”, replace your disk’s path (/dev/sda) and issue the following command:
    put "|dd if=/dev/sda" backupImageName.dd

    To restore a disk image off of the FTP server, replace your disk’s path (/dev/sda) and issue the following command:

    get backupImageName.dd "|dd of=/dev/sda"

Obviously, if you are unfamiliar with using “dd”, then you should probably look at a few tutorials before attempting this. Especially in cases where you want to back up just a single partition instead of a whole disk including all of it’s partitions as the example above. Use at your own risk as you can easily smoke the wrong partition or cause your system to no longer boot.

If you’re daring enough to try this on the disk your operating system is currently running on, you would have to reboot for it to take effect and you’ll find that none of the operating system commands are accessible at that point. There are still ways to make this happen remotely and force a system reboot, but unless if everything is running in RAM beforehand and nothing is accessing the filesystem/disk, it’s probably not going to work right. I’ve toyed with trying to make this work numerous times without any success. It seems you’ll need to boot from another device or live CD to clone the disk.

Leave a Reply