Section 6.4. cat Your Hard Drive


6.4. cat Your Hard Drive

I'll begin with the cat p-to-v process because it was the first p-to-v migration process shown to me (Ron McKelvey developed it and instructed me). More importantly, it works 100 percent of the time with any physical server running any operating system. This is the most difficult p-to-v method by far, but, again, it's worked perfectly every time I've seen someone proficient with Linux use it. If you're not a Linux guru and want to skip ahead to a more "friendly" method, such as the BartPE or other methodologies, that's fine. Just the same, I recommend that everyoneLinux expert or nolook through this methodology and understand its components.

The concept of this p-to-v process, or any p-to-v process, is really quite simple: you are making a copy of your hard drive and piping it eventually into a virtual server. With this method, you make a copy of your hard drive at the block level, and then pipe the standard output of the cat command into another file located on a swing server. From the swing server, you pipe it back into a target virtual server.

The cat command can be used to display the contents of a file. Linux views everything, including hard drives as files, so running cat against your hard drive generates an output of your hard drive's contents. I don't recommend you do this, but I have, and it's a fast and furious output. However, if you cat your hard drive and redirect the output to somewhere else, say another file, then you have a replica or image of your hard drive. That's what this and (really) all p-to-v methods docreate an image of your hard drive. So let's get to it.

Initially, this is a two-step process: cat the hard drive of your source server, pipe it to the swing server, and then from your target virtual server you pipe that copy from the swing server onto the virtual disk of your target vm. The process flow is illustrated in Figure 6.1

Figure 6-1. Source Server Image Flow


6.4.1. cat P-to-V Prerequisites

Some prerequisites to this method are as follows:

  • Have an NFS share mounted and accessible on the network or can use Windows Services for Unix (if you really want)

  • Have a Red Hat 9, disc 1

6.4.2. cat Process

The following is the basic method for catting your hard drive and creating a virtual machine from its standard output:

  1. Boot the server with the Red Hat disc, and then type linux rescue at the boot prompt.

  2. Choose No for network.

  3. At the prompt that next appears, enable networking by typing the following commands:

     ifconfig eth0 up ifconfig eth0 x.x.x.x 

    Try and ping the gateway, if you can't see it, try a different eth device, such as eth1 or eth2.

  4. Add a default route or just a route to the NFS server, such as:

    route add x.x.x.x gw y.y.y.y

    x.x.x.x = NFS server y.y.y.y = Gateway


    Note: The following are some other basic network commands:

  5. Mount the NFS share locally by entering the following:

      cd /tmp mkdir x mount -t nfs x.x.x.x:/share ./x cd x  

    Create a new folder on the NFS share for the machine you are migrating.

  6. Check which hard drive you want to virtualize: /dev/sda for the first drive and /dev/sdb for the second drive, and so on.

    fdisk -l /dev/sda Shows you the partition for sda. Do this again and write it to a file on the NFS share:
    fdisk -l /dev/sda > fda

  7. cat the sda hard drive (and the others) by typing the following:

     cat / dev/sda | ../split -b1024m - sda_ & 

    This means cat /dev/sda | (pipe) is to split and break into 1024MB chunks, using standard input (from a pipe) to create files named sda_**.

    Split breaks up the job. This is located in /usr/bin/split on many Linux distributions.

    The & means to background the job.

  8. Once this is done, do it for /dev/sdb (if there is one).

  9. Create a new virtual machine with one network adapter. You can also add another rater.

  10. Boot off the Red Hat 9 CD or ISO and type linux rescue. You may have to adjust the BIOS so that the virtual machine boots from the CD-ROM.

  11. You can enable networking in the virtual machine since you only have one network adapter, or you can do it manually following the method already outlined in this chapter.

  12. Mount the NFS share locally by entering the following:

     cd /tmp mkdir x mount -t nfs x.x.x.x:/share ./x cd x 

  13. Run fdisk -l /dev/sda and make sure your new virtual hard drive is large enough to hold your physical drive. cat the fda file you created before using the method outline.

  14. If all is well, put the image back into the virtual drive.

     cat sda_*>/dev/sda 

    This cats all the sda_ files in order and writes it back to the virtual hard drive.

  15. Once this has completed, type fdisk -l /dev/sda and make sure it looks correct.

  16. Boot the virtual machine.

Configuring & Implementing…
Hal and Kernel Modifications

If this is a Windows NT 4.0 multiprocessor source server or you are moving from a multiprocessor to a uniprocessor, you need to change out the Kernel and HAL. You can find the correct versions within the Windows service pack directory.

Use HAL HALAACPI.DLL and NTOSKRNL.EXE.


One caveat to this particular method is that since this is a block-level copy of your hard drive and not an image of its contents, if your physical hard drive is 36GB, your virtual hard drive will need to be 36GB as well. Even if you are only using, for example, 10GB of space on the physical hard drive the virtual hard drive needs all 36GB. Once you've virtualized your server by using a combination of vmkfstoolsx and disk repartitioning tools within the operating system of the virtual server itself, you can easily regain the space no longer needed by the virtual machine (see Figure 6.2).

Figure 6-2. Space Use on Hard Drives


Notice from Figure 6.2 that one of the immediate efficiencies of using virtualization is that you use all the space you need, such as 1012GB instead of wasting one-half to two-thirds of the hard drive.

Of course, this p-to-v method can be scripted. A generic version of these scripts is available on this book's Web site. In addition, an advanced version of this process that cuts in half the time it takes to p-to-v your server should also be available there. In using it, you basically pipe the output of the cat command directly into a target virtual machine bypassing the swing serve altogether. See Chapter 11 for more on vmkfstools.




Virtualization With VMware ESX Server
Configuring VMware ESX Server 2.5 (Vol 1)
ISBN: 1597490199
EAN: 2147483647
Year: 2005
Pages: 173

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net