Question about restore

Jerry McAllister jerrymc at msu.edu
Sun Feb 3 18:48:57 PST 2008


On Sat, Feb 02, 2008 at 08:28:37PM +0700, Fira wrote:

> Hi list,
> 
> I want to migrate one of my server (machine A) into another (machine B). My
> choice is using 'dump' and 'restore'. I've dumped all of my filesystem into
> third machine (machine C)  over ssh. All went fine.
> Then, I want to restore it into machine B. This machine is newly fresh, no
> freebsd inside. My plan is restore the dump file into it by using installer
> CD. I use the cd/dvd fixit mode. At this time, my confusion begun. To
> restore it,  I need to create the slice.  I  did 'fdisk' and 'disklabel'
> from sysinstall. But it failed. I followed tutorial from
> http://devpit.org/wiki/Dump_and_Restore_over_SSH [of course with some
> adjustment], but I still failed.
> 
> My question is, how is the right way to do the restore in a system that
> hasn't been installed with freebsd at all? From what I get in google, every
> restore example is done on a system that has been installed an OS.

I am not sure what didn't happen or if you left something out of your 
description, but I will take a shot here.

First, You also don't mention the FreeBSD version you are working with, 
but 'disklabel' has been replaced with 'bsdlabel' several versions ago.

Next, although you say you used fdisk to create slices and bsdlabel[disklabel]
(presumably to create partitions) you don't mention using newfs to create
filesystems on the partitions.  

Then, you do not mention creating any mount points for the new 
filesystems/partitions.

These can all be done using sysinstall on the install CD and that can
be a good way to do it.   You tend to forget fewer steps, because it
keeps track of them for you.   It is not a bad thing to just do a very basic
install of the version you want and with the partitions created to the
size you want.   Then restore the backups right over it.   

Or, maybe better than that, just create the slice/partitions/filesystems 
with sysinstall and then get out of it and boot again and go into 
the 'fixit' sell.  That will have enough to do everything.   If you use 
sysinstall this way, you will still manually need to create mount points
and mount the new filesystems.

So, here is the general procedure - presuming you are using the disk
only for FreeBSD.  Dual boot is similar, but you need to specify a couple
of things differently.

Boot the install disk and bring up either the fixit or sysinstall.

Use fdisk (or sysinstall) to create a single slice that is marked
as bootable.  Also write the standard FreeBSD MBR.

    fdisk -BI da0      (presuming your disk is da0 (SCSI)  
                         would be ad0 if IDE/STAT)

Use bsdlabel to create a boot sector on the disk and the partitions.

    bsdlabel -w -B da0s1   (Initializes the slice and writes boot sector)

    bsdlabel -e da0s1      (Brings up edit mode to edit the partition table)

Then use newfs to create filesystems on all partitions except swap.

    newfs /dev/da0s1a      (for partition a which will be mounted as /  (root)
                            partition 'b' will be swap
                            partition 'c' is special to describe the slice
                             and is unused for actual partitions
    newfs /dev/da0s1d      (for the 'd' partition - maybe /tmp)
    newfs /dev/da0s1e      (for 'e' partition - maybe /usr)
       etc  as needed       for all partitions

The above may be done by sysinstall.
The rest needs to be done from fixit or a running system - i'd recommend fixit

Now create mount points for each partition -- note that in the fixit disk
your main/root writable filesystem that the fixit is running from is
in memory and not on disk, so if you reboot before completing stuff, 
the mount points will disappear.

    mkdir /newroot         for partition a  which will become your root
    mkdir /newusr          for partition e, /usr in my example
      etc as needed

Mount the partitions
    mount /dev/da0s1a /newroot
    mount /dev/da0s1e /newusr
      etc  as needed

Now you are ready to do the restores.

Still from the fixit disk
    cd /newroot
    restore -rf      plus you add all your piping from the 
                     place you have the dump stored.
    cd /newusr
    restore -rf  pluss all the pipings.

You should now be able to reboot and run the new machine.

Now, if you are not using the latest FreeBSD, I would suggest that
you boot the latest (6.3) version and build the whole new system
with that and instead of just restore the dumps as is, make a nice
big extra partition/filesystem, restore each dump there and  then
pick and choose out of it what you want to add back in to the new
whole system.  That would mostly be just some configuration stuff
in the systems areas (root and /usr) and then your user storage, maybe
living in /home or whereever you had it.

////jerry



> 
> Thanks a lot guys!
> _______________________________________________
> freebsd-questions at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe at freebsd.org"


More information about the freebsd-questions mailing list