karlherrick.com

DD Backups over SSH

Saturday, 13 September 2008

To perform backups of a local workstation’s hard disk over a network, perform the following procedures (adjusted to your particular situation of course):

  1. Download and boot from a live Linux distro
  2. Become “root” within a shell
  3. Run “fdisk -l” (“mac-fdisk -l” I know works on SystemRescueCD 0.2.0 (PPC) for PPC/Macs (what about Intel Macs?)) and note the internal hard disk partition to backup (ex: ‘/dev/hda’)

The rest assumes that (in short, you will probably have to substitute some numbers or devices and you have ssh access somewhere):

  1. You have network access
  2. You have access to an SSH server
  3. Your network is configured with private addresses and you are not assigning one that conflicts with another local IP address
  4. Your netmask is the same as the one supplied in the following commands

Give an IP address to the workstation you have just booted the live Linux disc on, set the netmask, and bring the network interface up:

ifconfig eth0 192.168.1.50 netmask 255.255.255.0 up

Set the default gateway (if you need to reach outside of the LAN that is… normally this is your router’s IP address):

route add default gw 192.168.1.1

Set a DNS server (if you are in the habit of not strictly using IP addresses):

echo "nameserver 192.168.1.1" > /etc/resolv.conf

Execute the backup command:

dd if=/dev/hda | ssh username@backupserver.fqdn "dd of=/directory_of_backups_on_ssh_server/backupfile.iso"

Obviously, most of the previous is getting the network up… try running “dhclient” if the live Linux disc has it installed, and your network has DHCP setup. 😉

UPDATE (2010-02-09): I just thought I would mention, that Clonezilla Live is a fantastic piece of software that makes this all a little more automated. Their site says, “For [supported] file systems, only used blocks in partition are saved and restored. For unsupported file system, sector-to-sector copy is done by dd in Clonezilla.” Essentially, this translates into much smaller image sizes for the majority of files systems that people work with. See a basic how-to at http://www.howtoforge.com/back-up-restore-hard-drives-and-partitions-with-clonezilla-live.


Home

About

Portfolio

Web Apps Web Enabled Applications Corporate Sites Personal Sites
Preferences Dark Theme Light Theme Notifications
Social GitHub LinkedIn RSS Feed Icon