📜 ⬆️ ⬇️

Option to migrate FreeBSD from a physical server to a VMware ESXi virtual environment using NFS

Task.
Transfer existing hardware server with FreeBSD 8.2 i386 architecture and ufs file system to VMware ESXEi 5.0.0 virtual environment


1. In a virtual machine, we create disks of the required size no less than those available using the FreeBSD installation iso image, then from the same iso we boot in Live mode. We register all necessary settings for network interfaces
ifconfig em1 10.0.0.100/24 route add 0 10.0.0.254 
after that we check the availability on the real server network, if all Ok we run nfs
  /etc/rc.d/rpcbind onestart /etc/rc.d/nfsclient onestart 

2. Prepare the hardware server for the transfer for this run the service nfs .
I recommend to start it in this sequence.
  /etc/rc.d/rpcbind onestart /etc/rc.d/nfsd onestart /etc/rc.d/mountd onestart 
When you run nfsd, it will ask for the / etc / exports file in this variant (the file system historically contained only 2 / and / var sections):
  / -maproot=root -network 10.0.0.0 -mask 255.255.0.0 /var -maproot=root -network 10.0.0.0 -mask 255.255.0.0 
If everything is done correctly, the mount command will show the “NFS exported” parameter for the section:
  # mount /dev/da0s1a on / (ufs, asynchronous, NFS exported, local) devfs on /dev (devfs, local, multilabel) /dev/da0s1d on /var (ufs, asynchronous, NFS exported, local) 

3 Go back to our virtual machine and create folders for mounting local drives:
/ var / mount / root, / var / mount / var
and mount the drives:
  mount /dev/da0s1a /var/mount/root mount /dev/da0s1d /var/mount/var 
After that, let's deal with the disks of the physical server and create folders:
/ var / nfs / root, / var / nfs / var
To which we mount the shared partitions of the physical server:
  mount_nfs 10.0.0.50:/ /var/nfs/root mount_nfs 10.0.0.50:/var /var/nfs/var 
Now the servers are ready for transfer.

4. Before transferring data to the physical server, all services must be stopped so that the transferred data is relevant. For transfer, we use the following set of commands that we will run in the virtual machine.
  cd /var/nfs/root && pax -p eme -X -rw . /var/mount/root cd /var/nfs/var && pax -p eme -X -rw . /var/mount/var 

That's all the server moved to a virtual machine. It is clear that the migration time depends on the size of the used space (in this case, both servers were connected with Gigabit interfaces and the migration of 450 Gigabytes took several hours).
')
5. The final and important step is to always unmount the local disks and only after that overload the virtual machine.

Now enjoy the work on the new "hardware".

Ps. I think the same option is suitable for XEN.

Source: https://habr.com/ru/post/150121/


All Articles