Backup Partition Using dd on Linux

Tags: April 8, 2014 10:46 AM

If you want backup entire partition the dd is a very handy tool. It let you create a snapshot of the partition and quickly restore it if you need to. No need to worry about timestamps, ownership, permissions, links, etc.

Backup a Partition (Snapshot)

Make sure the partition is offline or you'll end up with inconsistent result. If it is root partition then you may want to boot via rescue disk and making the backup. Below is an example I'm taking snapshot of my 4GB USB pendrive, the location of the USB pendrive is on /dev/sdc1.
dd if=/dev/sdc1 of=/backup/pendrive.dd bs=512K
7704+1 records in
7704+1 records out
4039392256 bytes (4.0 GB) copied, 209.237 s, 19.3 MB/s

Browsing the Snapshot on the Fly

The great things about backing up a whole partition is you can mount it as regular device, so you can see the content without having to recreate the partition. Let's mount our previous backup.
mount -o rw,nosuid,nodev,uid=1000,gid=1000,shortname=mixed,dmask=0077,utf8=1,showexec,flush,uhelper=udisks /backup/pendrive.dd /mnt
Now you can browse the content of backup inside /mnt directory. The mount option I take from examining the result of mount command when I plugged in my pendrive.

Share on Facebook Twitter

0 comments:

Post a Comment