archiving and restoring disk images...

Dan Nelson dnelson at allantgroup.com
Tue Dec 9 14:26:36 PST 2003


In the last episode (Dec 09), lists at battleface.com said:
> I dumped a disk image of my root partition like this:
> 
> dd if=/dev/da0s1a | gzip -9 -c > where.ever.gz
> 
> Does this include the boot sector? In other words, if I need to
> restore this disk image I can do the reverse and the boot sector and
> root partition will be back to that state. How should I go about
> this, if what I'm saying is valid? Can I do this in single user mode
> or should I boot from CD and go from there? I haven't needed to do
> this yet, but I want to know how. If dumping the root partition like
> this is not a good means of backing up, please say so. What would you
> recommend? I tar most everything else.

The first BSD partition includes the disklabel partition and the boot
blocks for that slice, but will not contain the MBR or fdisk partition
table.  Something like "dd if=/dev/da0 of=mbr count=1" would do that.

To restore the disklabel partition you'll need to dd your where.ever
dump to /dev/da0s1, since on a new disk there won't be an 'a' partition
to write to.  After the dd is done, the 'a' partition should appear.

I usually either use dump or tar to back up my root partition, and use
sysinstall or a bootable CD image to fdisk and disklabel new media
before restoring.  That way I can change the partition sizes if my new
disk is larger/smaller than the original.

-- 
	Dan Nelson
	dnelson at allantgroup.com


More information about the freebsd-questions mailing list