[BBLISA] dump instead of dd for imaging?

Eddy Harvey bblisa2 at nedharvey.com
Wed Dec 20 00:01:10 EST 2006


I think the main thing about using dump is that dump is smart enough to
recognize which bytes belong to a file, and consequently, you don't have to
read every byte on the disk (as is the case with dd.)

So the output of dump, filtered through gzip, will be a lot smaller (in
general) compared to a dd image.  Also, when you restore a dd image, it has
to go onto the same size hard drive as the original, and dd has to write the
whole disk again.

So dump is smarter and faster and more flexible, but there are a few
problems to overcome.

First, a little info about the overall dump process.
	It's recommended to shutdown or mount read-only before beginning the
dump.
	Although most people use dump as a "live" backup, it's officially
not ideal.
	Typical command:  dump -0af - /dev/blah | gzip -c > somefile.dump.gz
	Ok, once you have a dump image, the restore method is...
	mkfs with all the options /dev/blah   (details below)
	mount /dev/blah /mnt
	cd /mnt
	gunzip -c /somepath/somefile.dump.gz | restore -rf -

Now, caveats based on my own personal experience:
1- Since the dump/restore programs on the bootable CD are in fact slightly
different from the ones included with your OS, there are in fact library
compatibility problems.  I've performed dump, mkfs, restore using linux
rescue CD's that came with the OS (redhat enterprise or fedora, I can't
remember now) only to discover that something went wrong.  It's sort of
vague in my memory now.  Maybe the ext3lib wasn't the same version, and
later mount complained about the fs that was mkfs'ed by the wrong version of
mkfs, or something like that.  But I concluded to always use the same OS to
perform dump/restore.  (I know this is confusing.  A little more coming
below...)
2- In the fstab, you normally see partitions mounted by label, so when you
use mkfs, you have to remember to add the label.  So the mkfs command is
probably ... mkfs -t ext3 -L / /dev/sda4 (or something like that.) Otherwise
you'll have to mount & edit the fstab after restore and before boot.

Now, a little info about the overall dd process.
	Shutdown.  Boot from CD.
	dd if=/dev/hda (or whatever) | gzip -c > somefile.dd.gz
	Later, to restore, you simply gunzip -c somefile | dd of=/dev/hda
(or whatever)

The weakness of using dd is that you have to use an identically sized hard
drive when you restore.  Also, every byte of the disk will be read during
backup, while every byte will be written during restore.  This makes the
backups easy, but large & slow & inflexible for size.

Also, dd will install the boot loader in the MBR for you automatically,
while you have to show some intelligence to do this with a dump/restore
solution.

So, the procedure I've come up with, is like this:
	Before you install your OS, install the minimal version of your OS.
	That is, create a 2G partition on the drive, and install the OS into
that.  Minimal.
	This ensures always the correct versions of libraries, and
compatibility.  
	Then, boot from the install CD again, and install the real OS that
you will use, into new partitions.
	When you want to backup your OS, shutdown and boot the minimal OS.  
	Use the minimal OS to perform dump.  It has all the correct lib
versions.
	When you want to restore your OS, begin by creating a minimal 2G
installation.
	This ensures compatible libraries and ext3 versions.  It also
installs the bootloader for you.
	Use the minimal OS to perform mkfs, mount, and restore.
This method produces the smallest possible backup filesize, and is
restorable into any size new hard disk.





-----Original Message-----
From: bblisa-bounces at bblisa.org [mailto:bblisa-bounces at bblisa.org] On Behalf
Of Scott Ehrlich
Sent: Monday, December 18, 2006 7:03 PM
To: bblisa at bblisa.org
Subject: [BBLISA] dump instead of dd for imaging?

I'm working on ways to produce an image of a Linux machine with the Grub
boot loader, and place the image on an SMB network share.

I've successfully done so with dd, but another admin highly recommends using

dump, to verify mbr preservation.   I've never used dump for this.

What would be the recommended command line to use dump?

My dd command is:

dd if=/dev/hda | gzip -c | split -b 2000m - /mnt/smb_share/backup.img.gz

courtesy of http://wiki.linuxquestions.org/wiki/Dd

I've successfully created the image with the above, then successfully
restore
via:

cat /mnt/smb_share/backup.img.gz.* | gzip -dc | dd of=/dev/hda

I do this booting from a CentOS 4.4 Live CD.

What would be the equivalent for dump?

Thanks.

Scott

_______________________________________________
bblisa mailing list
bblisa at bblisa.org
http://www.bblisa.org/mailman/listinfo/bblisa




More information about the bblisa mailing list