Moving Freebsd to a new Server

2007-06-07 Thread Ian Lord
Hi,

 

We were in a rush to install a freebsd server without proper hardware on
hand, so we used Microsoft Virtual Server and install Freebsd on it.

 

I would like to move the freebsd installation to a real server and was
wondering how to do so.

 

I searched around and the solution seems to be to dump the hard drive
content and restore it on the new server.

 

Does anyone knows a good walkthrough of the entire process, I didn't find
anything in the handbook beside moving freebsd to a new harddrive which I
cannot do from the same machine.

 

Basically, I need a way to dump the hd to file, transfer the file over
whatever media (dvd, network, etc) and restore on the new machine. 

 

I'm not even sure if I need to install freebsd on the new machine or not
since I guess I cannot overwrite the partition on which freebsd is running
:-)

 

Any help/reference would be appreciated

 

Thanks in advance

 

 

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Moving Freebsd to a new Server

2007-06-07 Thread Mikel King

Ian,

	There's an article on geomirror on www.daemonnews.org that I use as  
a guide on working with dump. I do exactly the same sort of thing  
moving my FreeBSD machines between instance and physical on VMWare.  
I've done it in both directions many times using a USB drive as the  
medium.


	I have a move coming up soon, so I shall try to document it for the  
future. Let me know how this works for you.


Cheers,
Mikel King
CIO, Tech Alliance, INC
Senior Editor, Daemon News
39 West Fourteenth Street
Second Floor
New York, NY 10011
http://www.techally.com
http://www.daemonnews.org
t: 212.727.2100x132
+--+
How do you spell cooperation? Pessimists use
each other, but optimists help each other.
Collaboration feeds your spirit, while
competition only stokes your ego. You'll
find the best way to get along.
+--+


On Jun 7, 2007, at 3:38 AM, Ian Lord wrote:


Hi,



We were in a rush to install a freebsd server without proper  
hardware on

hand, so we used Microsoft Virtual Server and install Freebsd on it.



I would like to move the freebsd installation to a real server and was
wondering how to do so.



I searched around and the solution seems to be to dump the hard drive
content and restore it on the new server.



Does anyone knows a good walkthrough of the entire process, I  
didn't find
anything in the handbook beside moving freebsd to a new harddrive  
which I

cannot do from the same machine.



Basically, I need a way to dump the hd to file, transfer the file over
whatever media (dvd, network, etc) and restore on the new machine.



I'm not even sure if I need to install freebsd on the new machine  
or not
since I guess I cannot overwrite the partition on which freebsd is  
running

:-)



Any help/reference would be appreciated



Thanks in advance





___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions- 
[EMAIL PROTECTED]


___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Moving Freebsd to a new Server

2007-06-07 Thread Warren Block

On Thu, 7 Jun 2007, Ian Lord wrote:


Basically, I need a way to dump the hd to file, transfer the file over
whatever media (dvd, network, etc) and restore on the new machine.


Personally, I do a minimal install of FreeBSD on the target machine 
first.  That lets you set the partitions the way you want and gives you 
a complete set of tools.


As always, back up the source machine before starting.

Dump the /, /var, and /usr filesystems from the source machine into 
files, and any others with contents you need.  For example:


dump -0af /tmp/slash.dump /

Of course, the output should be on a different filesystem than the one 
being dumped, and ideally a separate disk to avoid head thrashing (/tmp 
shown below, but most people don't have enough space in /tmp to do it. 
You can use NFS or ssh or other methods to use remote files.)


On later versions of FreeBSD, you should give dump the -L option to use 
a snapshot of the filesystem.


Giving dump more memory with -C can also help, although it runs multiple 
instances, so too much will cause swapping.


Ultimately, for a typical FreeBSD 6.2 machine:

dump -C8 -L -0af /tmp/slash.dump /
dump -C8 -L -0af /tmp/var.dump /var
dump -C8 -L -0af /tmp/usr.dump /usr

Get those files onto the target machine, again in an unused filesystem 
or separate disk, and restore:


cd /usr
restore -ruf /tmp/usr.dump
cd /var
restore -ruf /tmp/var.dump
cd /
restore -ruf /tmp/slash.dump

Now is a good time to fix anything that will be different in /etc/fstab, 
like references to ad0 that should be ad2.


Reboot and fix anything else that needs to be changed.

-Warren Block * Rapid City, South Dakota USA
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Moving Freebsd to a new Server

2007-06-07 Thread Jerry McAllister
On Thu, Jun 07, 2007 at 03:38:01AM -0400, Ian Lord wrote:

 Hi,
 
 We were in a rush to install a freebsd server without proper hardware on
 hand, so we used Microsoft Virtual Server and install Freebsd on it.
 
 I would like to move the freebsd installation to a real server and was
 wondering how to do so.
 
 I searched around and the solution seems to be to dump the hard drive
 content and restore it on the new server.

Yes, I have written this essential thing with slight variations several
times in the questions list.   You might want to search in the archives.

 Does anyone knows a good walkthrough of the entire process, I didn't find
 anything in the handbook beside moving freebsd to a new harddrive which I
 cannot do from the same machine.
 
 Basically, I need a way to dump the hd to file, transfer the file over
 whatever media (dvd, network, etc) and restore on the new machine. 
 
 I'm not even sure if I need to install freebsd on the new machine or not
 since I guess I cannot overwrite the partition on which freebsd is running
 :-)

Hmmm.  I am not sure what you are implying here.   
Do you mean that the new server already has (the latest) FreeBSD installed
on it?   If so, and your data and such are conveniently organized, then
you can just make sure the needed ports are [freshly] installed and then
merely transfer over the data you need.   That would be best.

But, if you really need to move everything from the old system over
to the new server systemr, then yes dump/restore is the best.

First, build the Disk structure on the new server.  You can do that
by using the install CD to do a minimal install or just use the 
fixit and run fdisk, bsdlabel and newfs from it to create the slice,
partitions and file systems respectively.   Neither is more difficult,
but using the installer does some of the keeping track for you while
you are doing things whereas doing the fdisk,bsdlabel,newfs gives you
a little more direct control.

Under either path, you must get the disk prepared and write the FreeBSD MBR
make a slice for FreeBSD, make it bootable and make at least one partition
for root (preferably divide things a little better, but...) and one
partition for swap (I suggest making root, swap, /tmp, /usr, /var /home).
In this case, you probably want to divide it according to the older
machine's pattern, using updated sizes based on the new disk.

Then, you want to transfer things.
For each filesystem on the old system  --- skip swap and /tmp
write the filesystem out using dump(8) to some media where there
is enough room and that can be reached by the new machine in some way.

dump 0aLf /directory_or_device_name_rootdump /
dump 0aLf /directory_or_device_name_usrdump /usr
dump 0aLf /directory_or_device_name_vardump /var
dump 0aLf /directory_or_device_name_homedump /home
etc
(NOTE, make those directory_or_device_name things something reasonable, 
 like the directory or device where you are writing the stuff)

Then boot the fixit on the install CD on the new server
and use it to restore those filesystems in place.   If there is
room, you can just copy the dump file to a big space on the new
server (such as to /newhome) using whatever is appropriate - ftp/scp
probably and restore from there.

You will need to create mount points and mount the new filesystems.
So, do something like this while in fixit.
mkdir /newroot
mount /dev/ad0s1a /newroot
mkdir /newusr
mount /dev/ad0s1e /newusr
mkdir /newvar
mount /dev/ad0s1f /newvar
mkdir /newhome
mount /dev/ad0s1g /newhome

(Here I am presuming the partition names e, f, g.   root has to be 'a')

If you really wrote these to something like a CD, then you will also
have to mount that.  Probably the /cdrom mountpoint will already exist
but if not, then make it.  Then mount it.
mount_cd9660 /dev/acd0 /cdrom


So, lets assume you have copied the dump[s] to /home on the new
machine.   You could do it directly from the CD if that is where it is.
  (You may need to do each filesystem one at a time to have enough
   room to do it, especially for /home if it is large)
Then do:

cd /newroot
restore rf /newhome/rootdump 
rm /newhome/rootdump
cd /newusr
restore rf /newhome/usrdump
rm /newhome/usrdump
cd /newvar 
restore rf /newhome/usrdump
rm /hewhome/vardump
cd /newhome
restore rf homedump
rm /newhome/homedump
  (if there is plenty of room, done worry that you are restoring to 
   the same directory /newhome, that you are reading from.  It will 
   work just right.   But the /newhome filesystem will have to be
   double the size of the homedump file
If you are reading directly from the CD, then it would look like
cd /newroot
restore rf /cdrom/rootdump  (providing you used my name conventions)

Then try rebooting and hopefully it will all be happy.

jerry

 
 Any help/reference would be appreciated
 
 Thanks in advance