Richard Bucker

backing up my drive

Posted at — Apr 20, 2015

I have a system that I installed ubuntu 14.04 on and then stripped everything except the bare essentials from. I can clone the drive with simple dd commands but they can be a pain to manage. The source drive I’m working with is 60GB but I’ve only used about 5GB so the whole thing should fit on one of my new 8GB USB sticks. (I think I should have purchased the Kingston brand drives instead of those but that’s what I have for now.

Backup

dd if=/dev/sdX conv=sync,noerror bs=64K | gzip -c  > /path/to/backup.img.gz
 fdisk -l /dev/sdX > /path/to/list_fdisk.info
Restore
gunzip -c /path/to/backup.img.gz | dd of=/dev/sdX
Clone
dd if=/dev/sdX of=/dev/sdY bs=512 conv=noerror,sync
I should have captured more than just the partitions but that’s it for now. The refs below have some information on the MBR.

I have yet to test the restore but it should work in principle. It’s probably important that the drive sizes need to be exactly the same size.

Here are the refs (link) (link)