Migrate primary disk (duplicate)

Gary W. Swearingen garys at opusnet.com
Mon Aug 1 22:20:17 GMT 2005

"Alexandre D." <alexandre.delay at free.fr> writes:

> Here is the complete process I follow:
>    sysctl kern.geom.debugflags=16
>    dd if=/dev/zero of=/dev/${disk} bs=1k count=1

Shouldn't be needed, but if you're concerned, write enough sectors
to zero the start of {disk} and the start of {disk}s1 -- something
like 63+16; bs=100k maybe.

>    fdisk -BI ${disk}

Again, -B and -I don't sound like a good combo.

>    disklabel -B -w -r ${disk}s1 auto

You said you were running 5.4.  AFAIK, there's no "-w", "-r", and no
"auto".  Other than that it looks fine. :) (But knowing the way some
developers think, they might have been removed from the manpage only.

>    disklabel -R ${disk}s1 generique.disklabel
>    newfs /dev/${disk}s1a
>    newfs /dev/${disk}s1d
>    mount /dev/${disk}s1a ./mnt
>    cd ./mnt
>    dump 0uafL - / | restore xf -

Looks like you're dumping to a file named "./mnt/L".  Does ./mnt
really have anything else in it after that restore?

> -----generique.disklabel file-------
>   a: 41943040        0    4.2BSD
>   b:  2097152   *      swap 
>   d: * *    4.2BSD 

Could be.  Have it print out the resulting disklabel and see if looks

> If I do the same with /stand/sysinstall in stead of 
>    dd if=/dev/zero of=/dev/${disk} bs=1k count=1
>    fdisk -BI ${disk}
>    disklabel -B -w -r ${disk}s1 auto

> It works well.

Could it be because it uses "boot0cfg" and you use "fdisk"?
(You haven't said whether you're telling sysinstall to install a
standard MBR or a FreeBSD MBR or none.)

If you're curious, you can dump the two main boot sectors
a readable file and compare the sysinstall version with the
fdisk version and /boot/mbr and /boot/boot0.

      dd if=/dev/ad0   count=1 | hd >/tmp/ad0
      dd if=/dev/ad0s1 count=1 | hd >/tmp/ad0s1

More information about the freebsd-questions mailing list