Subject: Re: Cloning /dev/wd0
To: Herb Peyerl <hpeyerl@beer.org>
From: None <collver1@attbi.com>
List: netbsd-help
Date: 12/10/2002 07:13:31
On Tue, Dec 10, 2002 at 07:30:08AM -0700, Herb Peyerl wrote:
> frankly, unless the disks are identical in geometry and size, I probably
> wouldn't use 'dd' to mirror them.

Someone told me it is possible that one disk will have a bad sector and
cause dd to fail, giving another reason not to clone with dd.  What would
be the best way to duplicate a disk?  I imagine that it could be a simple
shell script (on i386) to:
	* use fdisk to read the partition table and write one
	* use installboot to make the new disk bootable
		(but how do you find the original boot configuration?)
	* use disklabel to read the disklabel, save to file
	* edit the disklabel file
	* use disklabel to write the new disklabel to the new disk
	* for each bsd filesystem in the disklabel
		* use dumpfs to read fs parameters
		* use newfs to create the fs on the new disk
		* use dump|restore to copy the filesystem