Friday, October 30, 2009

Converting a Physical Server (or Virtual Server) to Oracle VM (or Xen)

I needed to move some physical Windows 2003 servers.  The site I wanted to move these servers to already had a substantial Oracle VM Server environment that I had built up.  Oracle VM is based off of Xen.  Using Oracle's P2V whitepaper led me to a converted virtual machine that would not boot.  After much searching I found a process that worked for me.  Pulling from different areas on the web the process I came up with is this.

Note:  This process works for Physical servers or Virtual servers (Example:  VMWare).

   1. On the server you wish to convert you need to do some prep work.  You'll need to make sure the server has ide device drivers available and the registry needs to be made aware.  Believe it or not Microsoft has a KB article that details what we need to do.  The section of this KB article we need is under the heading "More Information".  The article can be found here - http://support.microsoft.com/kb/314082
   2. In summary you need to extract the Atapi.sys, Intelide.sys, Pciide.sys, and Pciidex.sys files from the %SystemRoot%\Driver Cache\I386\Driver.cab file and copy the files to the %SystemRoot%\System32\Drivers folder and then copy the registry section to a file (Example: mergeide.reg) and merge the file in to the registry.
   3. Use the free VMWare converter tool to convert the Physical machine to a vmdk file.  If you are doing this on a server (HP or Dell for example) make sure you unselect any management partitions.
   4. Copy this vmdk file to your Oracle VM (or Xen) Server and run the following command:  # qemu-img convert (filename).vmdk (filename).img
   5. Then create a Windows 2003 guest VM (or which ever the OS is of the box you are converting) and make sure it is shutdown.
   6. Remove the img file for the guest you just created and replace it with the one you created in step 4.  Make sure you rename your new image file to the same name as the one you removed in the beginning of step 6.
   7. The guest VM should boot up.  Once your image is up, remove any VMWare tools or conversion programs and remove any Vendor specific management programs (example HP or Dell utilities).


Done.  This process worked for me.  Hope it will help you too.

Wednesday, October 7, 2009

Virtual File Systems: For Fun, Security, and Profit

Assumptions:  Your OS is Linux.
Do you need to bring up an FTP or NFS server on an existing system but want to keep things separated? Do you wanted to have a portable file system you can take with you? Do you want to "hide" things but are not worried about encryption? With Linux it is possible and easy. Here’s how.

Creating a virtual file system.

Assumptions: You have a large file system with plenty of free space. For this example, we’ll assume this file system is mounted on /home and there is well over 20GB of free space available.

Make a file in your home directory called portable.ext3 (you can call it whatever you want).
# touch /home/bob/portable.ext3

Now, let’s make this file a 16GB “empty” file. What you say? That’s right. We are going to take the file portable.ext3 and make is 16GB is size but completely empty. How?
# dd if=/dev/zero of=/home/bob/portable.ext3 bs=16G count=1
So we are creating a file with a 16GB block size at a count of 1. So… 1 block, 16GB in size.

We now have an “empty” 16GB file. Let’s format it.

Wait a minute. It is a file. You can’t format it.

Yes we can.
# mkfs.ext3 /home/bob/portable.ext3
You may get a warning, but it can be ignored.

So now we have a 16GB file that has been formatted as an ext3 filesystem.

What is left to do? Mount it.
Create an empty directory so you can mount the filesystem.
# mkdir -p /home/bob/mntdir (you can call the directory whatever you want).

Now let’s mount it.
# mount –o loop,rw /home/bob/portable.ext3 /home/bob/mntdir

Ta-Da. Do a “df -h” and you should see your “new” 16GB filesystem.

What can you do with it? You can share it out using NFS. Have it as your FTP root. Or (assuming you are going to unmount it first) copy it to a large enough flash drive and take it to a different linux system. If you are not going to move it between systems, and it will only live on one box, you may want to edit your /etc/fstab so that it will be mounted the next time the system reboots.