clone-dump-restore

Polytropon freebsd at edvax.de
Wed Oct 14 22:07:42 UTC 2009


On Wed, 14 Oct 2009 17:21:57 -0400, PJ <af.gourmet at videotron.ca> wrote:
> It has taken me some time to prepare for a cloning of an existing 7.2 sytem.
> Now that I have everything running smoothly with all the proggies &
> configurations the way I want them, I tried (notice - tried) to clone
> the system.
> Here's the setup:
> FBSD 7.2 on ad4 and same on ad12.

I do assume that the system on ad6 is your source system, and
ad12 should then be the same by the means of cloning? In later
lines, you're dumping to a da device (not ad). Do you already
have two FreeBSD source systems set up?



> First, running on ad4, I tried to dump & restore each partition directly:
> ad12s1a to da0s1a (usb sata disk).  No go.

It would be good to see the command that you issued to do so,
including the currend working directory.



> I had set it up originally
> with livefs, minimal; then redid it all with fdisk, bsdlabel and nwfs;

There's no need to do the slicing and partitioning twice.



> then
> dump -0af - /dev/ad12s1a | restore -rf - /dev/da0s1a

The command does not look okay. Keep in mind that
	a) ad0s1a is mounted,
	b) you need to be in the mounted / of da0 and
	c) ad1s2a is mounted ro.

You can forget about c) if you're dumping | restoring from a live
file CD or DVD. In this case, ad12s1a isn't mounted, which is
good.

You should end up with a setting like this:

	# mount /dev/da0s1a /mnt
	# cd /mnt
	# dump -0 -f - /dev/ad12s1a | restore -r -f -

See the difference? The restore command does NOT require a device
name, because the point where to restore is the current working
directory, as indicated by the previous cd command.



> --- got error messages about not being a tape device. Great.

Looks like incorrect command... see above.



> Next, I tried with another usb/sata disk on da0... dumped to files (dump
> went w/out problems) ... mounted da0 partitions 1 x 1 to /mnt, cd'd to
> /mnt and did
> restore -rf file.
> Only the ad12s1f(usr) restore gave long list of "unable to create file> or link > or something like that".

Again, the complete command (including pwd) would have been
helpful, so I can only guess.

I assume you dumped /usr into a file on a usb disk (da). In order
to restore this file to a partition you created on another disk,
let's say ad6 (ATTENTION, EXAMPLE!), the command to do so would
be:

	# mount /dev/da0 /mnt
	# mkdir /mnt2
	# mount /dev/ad6s1e /mnt2
	# cd /mnt2
	# restore -r -f /mnt/usr.dump

Keep in mind that (in difference to my previous example) /mnt now
refers to the /usr partition, not to /.

This of course assumes that you've already sliced and partitioned
ad6. It includes formatting (newfs), obviously.



> When I then installed the restored disk to another computer (identical
> except for CPU (3gb instead of 2.4gb), booted from the restored disk and
> saw that it was trying to boot from ad12s1a which doesn't exist on the
> new machine. uh...oh...

The boot loader tries to boot the first ATA disk. This has been
discussed in the questions@ list few days ago.



> Somehow I think I may not have understood something.

I'm sure about this. Re-read the examples above and you'll notice
easily how the dump and especially the restore command have to be
invoked for proper operations.



> Perhaps I should install the disk directly in the dump/restore machine
> and try again.

This is possible, but as long as you're using an USB transfer disk
which gets its content as data files (.dump files) from the ATA
disk (source disk), and which are then restored to another ATA
disk (target disk), there shouldn't be a problem.

Because I'm a lazy guy, I mostly use a live file system (FreeBSD
live fs is completely okay, but FreeSBIE is good, too) in order to
run the sysinstall program which I use to slice, partition and format
the target disk as intended. I then use a USB stick or a USB disk
to make the dump files available (previous example) and restore them
to the target disk. Note that things like the boot loader are now
independent of my dumps as they get written by sysinstall.



> Oh, yes, another sign from the gods... when restoring to a partition
> just newfsed there is a warning that .snap is already installed... now
> what on earth or moon is that?

The .snap directory is used for file system snapshot. As far as
I remember, newfs creates this directory, or maybe it's fsck at
its first run? Don't mind, it's not important (until you need it
for data recovery).


> I will try again... and try to document more clearly... :-(

Yes, please.



Good luck!




-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...


More information about the freebsd-questions mailing list