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?

7
  • I think clonezilla is a more efficient way then dd. Apr 5, 2015 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 5, 2015 at 12:14
  • 3
    Have you run the first script from a system running on /dev/sda?
    – UTF-8
    Apr 5, 2015 at 12:22
  • 1
    Well, there is the problem. You need to do it from a live CD/USB to avoid filesystem corruption. Apr 5, 2015 at 13:19
  • 1
    @DavidFoerster Happy to oblige. Apr 6, 2015 at 7:46

1 Answer 1

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .