1

I've been using Clonezilla for weekly image backups, which is obviously a little bit of a hassle. I've been trying to switch to dd, so I can have cron run it for me.

This is what my backup script looks like:

#!/bin/bash
#dd whole drive
dd if=/dev/sda of=/media/temp/image/"image-$(date +"%Y-%m-%d").img"

I ended up with a 256gb img file, and decided to give it a test run. I booted from the Ubuntu 14.10 live USB stick, mounted the remote filesystem, and ran the following:

sudo -i
dd if=/media/temp/image/image-2015-04-04.img of=/dev/sda

Upon rebooting, the system hangs at the "Ubuntu" logo screen. I'm unable to switch to tty1, ctrl+alt+del, or anything. I then restored from my Clonezilla backup (which was made immediately before the dd backup), and it worked fine.

What am I doing wrong? Should I just ditch dd and take a different route?

Big Millz
  • 325
  • I think clonezilla is a more efficient way then dd. – mikewhatever Apr 05 '15 at 12:11
  • It's much more space efficient, but to my knowledge, I can't schedule it and run it while my OS is running. – Big Millz Apr 05 '15 at 12:14
  • 3
    Have you run the first script from a system running on /dev/sda? – UTF-8 Apr 05 '15 at 12:22
  • 1
    Well, there is the problem. You need to do it from a live CD/USB to avoid filesystem corruption. – mikewhatever Apr 05 '15 at 13:19
  • Thanks Mike, any suggestions for a way I can do a full, easy to restore, scheduled backup from within the OS? I have deja dup and a schedule aptik backup running. I'd like to have a safety net like Acronis in Windows provides (without a $1000 copy of Acronis for Linux) . – Big Millz Apr 05 '15 at 13:22
  • 1
    @DavidFoerster Happy to oblige. – mikewhatever Apr 06 '15 at 07:46
  • I have never felt copying the entire partition is a good back up strategy. It leads to large backups (256 Gb) and often there are problem restoring these images. IMO much better to back up /home, any system files you edited ( keep a copy of the original system file as well as the edit in /root in a mirrored system such as /root/etc/) any server data (samba shares, FTP, HTTP [/var/www/html], and a package list. These backups are much smaller and easier to restore. See also http://askubuntu.com/questions/2596/comparison-of-backup-tools and https://help.ubuntu.com/community/BackupYourSystem – Panther Apr 06 '15 at 13:22

1 Answers1

2

In order to avoid filesystem corruption, you need to run dd from a Live CD/USB. This ensures that the filesystem you copy does not change while dd copies it.

mikewhatever
  • 32,638