نمایش نتایج: از شماره 1 تا 4 از مجموع 4

موضوع: Cloning Hyper-V Virtual Machines the Right Way

  
  1. #1
    نام حقيقي: 1234

    مدیر بازنشسته
    تاریخ عضویت
    Jul 2009
    محل سکونت
    5678
    نوشته
    5,634
    سپاسگزاری شده
    2513
    سپاسگزاری کرده
    272

    Cloning Hyper-V Virtual Machines the Right Way

    کد:
    http://www.virtualizationadmin.com/articles-tutorials/general-virtualization-articles/cloning-hyper-v-virtual-machines-right-way-part1.html

    PART-1



    Introduction

    Although it is relatively easy to make a clone of a virtual machine, the cloning process is less than intuitive. This article series shows you how to avoid disaster by creating a virtual machine clone in the proper way.
    You have probably heard that server virtualization products such as Hyper-V make it easy to clone virtual server images or to move virtual servers to new hardware. However, if you ever actually tried to build a server image and then clone it, you might have been surprised by how non intuitive the process actually was.
    The first time that I ever had to create a virtual machine clone, I was a little taken back. All I kept hearing about was how easy the process was. Because of that, I really expected the Hyper-V Manager to have a Clone Virtual Machine button. As you have probably already guessed though, such a button simply does not exist.
    Since that time, I have tried a lot of different methods to cloning virtual machines. Some of them have worked, and some of them have not. Since there are so many techniques that you could potentially use, I wanted to take the opportunity and explain which cloning techniques actually work, and why.
    The Challenge of Cloning Virtual Machines

    Before I get started, I think that a little explanation of the challenges involved in cloning virtual machines is in order. The problem with cloning a virtual machine is that you can not have two identical computers on the same network. You can have machines that are almost identical, but they can not be 100% identical. The reason for this is that certain machine attributes are used as a means for identifying the machine on the network. Therefore, if you have two machines that are completely identical, then networking ceases to function. In case you are wondering, some of the things that have to be unique for each computer include:

    • The Windows Security Identifiers (SIDs)
    • The Media Access Control (MAC) address
    • The Internet Protocol (IP) address
    • The NetBIOS and Fully Qualified Domain (FQDN) names

    Given that some system attributes are required to be unique, simply copying virtual hard drive files and building another virtual machine around them will not work. Out of curiosity, I actually tried to shut down a virtual machine, copy its files to another location, and create another virtual machine using those files. When I booted the new virtual machine I received the Blue Screen of Death.
    As you have probably already figured out, successfully duplicating a virtual machine requires stripping any attributes that are required to be unique from the clone. There are at least two good ways of accomplishing this.
    The SYSPREP Utility

    The first of these methods involves using the SYSPREP utility. The SYSPREP utility is actually ideally suited to the task of cloning virtual machines, because it was specifically designed to prepare Windows for duplication.
    Before I Begin

    Before I show you how to use the SYSPREP utility, I need to point two things out. First, if you are familiar with my work, then you know that I like to keep things as simple as I can. Nobody needs to read a needlessly complex article when they are just trying to get a job done. Having said that, there are all kinds of cool things that you can do with the SYSPREP utility. Even so, I am going to be sticking to the basics, because that is all that is required for accomplishing our goal.
    The second thing that I need to point out is that SYSPREP has been around for a long time, and has evolved a bit from one version of Windows to another. The technique that I am about to show you was designed for use with Windows Server 2008. There is a Windows Server 2003 version of SYSPREP, and it can be used to clone a virtual machine that is running Windows Server 2003 (I have actually done it). Keep in mind that the SYSPREP specific steps are going to be different than what I am about to show you though.
    If you need the Windows Server 2003 version of SYSPREP, it is included on the Windows Server 2003 installation CD as a part of the Support Tools. The Support Tools are not installed by default, but you can find them in the CD’s \Support folder.
    Preparing for SYSPREP

    Before we actually begin using SYSPREP, there are some rather important things that you need to know. First, even if you do not remember anything else that I have said in this article, there is one extremely important thing that you need to keep in mind. Do not run SYSPREP on a production server under any circumstances!
    OK, I know that statement is probably a little confusing. After all, our goal is to clone some virtual machines, right? Well, the reason why it is so important not to run SYSPREP on a production server is because SYSPREP will destroy Windows. Well, not completely, but trust me… You do not want to run SYSPREP on a production server.
    When you run SYSPREP, it prepares the server for duplication. That means stripping the server’s SIDs, and the other types of attributes that I mentioned earlier (the MAC address is an exception, but I will address that later in the series). With these attributes gone, the server is no longer able to function as it previously did.
    Of course this raises the question of what good an image is if it is based on a non functional server. The way that Windows gets around this issue is by prompting you to answer a few questions the next time that you boot the server (or any clones of the server).
    What happens is that Windows preserves most of your deployment settings. Since it is missing a few things though, the first time that you boot your original virtual machine or one of the clones that was made from it, Windows runs something that I like to think of as a miniature Setup Wizard. This wizard asks you a few basic questions, and then Windows is rebuilt.
    Although the Setup Wizard behaves as though you are installing a completely fresh copy of Windows, most of the modifications that you have made to the virtual machine prior to running SYSPREP will be preserved. For example, any folders that you have created on the hard drive will still exist. Applications will still be installed, and so will patches.
    Since the SYSPREP process does scrub some attributes from the machine that is being duplicated, it is possible to cause some problems if you are not careful. In the next part of this series, I will talk about some of the things that you can do to prepare a virtual machine for duplication in an effort to avoid such problems.
    Conclusion

    In this article, I have introduced you to the SYSPREP tool, and I have begun discussing some of the things that you need to do in order to prepare a server for duplication. In the next part of this series, we will talk about a little bit more prep work that needs to be done, and we will create a virtual machine image




    موضوعات مشابه:

  2. #2
    نام حقيقي: 1234

    مدیر بازنشسته
    تاریخ عضویت
    Jul 2009
    محل سکونت
    5678
    نوشته
    5,634
    سپاسگزاری شده
    2513
    سپاسگزاری کرده
    272
    کد:
    http://www.virtualizationadmin.com/articles-tutorials/general-virtualization-articles/cloning-hyper-v-virtual-machines-right-way-part2.html
    PART-2


    Introduction

    In my previous article in this series, I explained that cloning a virtual machine is not quite as intuitive as you might have been lead to believe. Part of the reason for this is that in order for the cloning process to be successful, you need to use Sysprep to strip certain attributes from the host that is being cloned. In this article, I want to continue the discussion by showing you one method that you can use for cloning virtual machines.
    Running Sysprep

    As I mentioned in my previous article, in Windows Server 2003, Sysprep was included in the Windows Support Tools, and it therefore had to be installed manually before you could use it. In Windows Server 2008 though, Sysprep is installed by default. You can access Sysprep by going to C:\Windows\System32\Sysprep and running Sysprep.exe. When you do, you will see a screen that is similar to the one that is shown in Figure A.

    Figure A: This is what the SYSPREP interface looks like
    As you can see in the figure, the Sysprep interface is pretty simple, but even so it is very important to pick the correct options. Otherwise you could find yourself having to go through the configuration and preparation process all over again.
    The System Cleanup Action drop down list contains two options; Enter System Out of Box Experience (OOBE) and Enter System Audit Mode. You must choose the Enter System Out of Box Experience (OOBE) option. Next, you must select the Generalize check box. Otherwise, the system will not be stripped of its uniquely identifying attributes. Finally, you must set the Shutdown Options to Shutdown. It is important that you select Shutdown and not Restart. If you use the Restart option, then the recently generalized system will reboot and enter into Windows mini-setup mode, effectively undoing your prep work.
    Cloning the Image

    Now that you have generalized the system image, it is time to begin the cloning process. The first time that I tried to clone a virtual machine, I thought that once Sysprep had shut down the virtual machine I would be able to simply copy the virtual hard drive file to another location, and then build a new virtual machine around the copy of the virtual hard drive file. I was able to make a variation of this technique work for a virtual server that was running Windows Server 2003, but I could not make it work for Windows Server 2008. Every time I tried to boot the cloned virtual machine I received the blue screen of death. Fortunately, there are other methods for cloning virtual machines.
    The first method that I want to show you involves using System Center Virtual Machine Manager. In case you are not familiar with System Center Virtual Machine Manager, it is a utility for managing Hyper-V servers. This is not a free utility though, so if you do not own a copy of System Center Virtual Machine Manager, do not panic. I am going to show you another cloning method that you can do without this utility.
    To begin the cloning process, open the Virtual Machine Manager console and select the Virtual Machines node from the pane on the lower left side of the console screen. This will cause the console to list all of the virtual machines that are installed on the currently selected Hyper-V server. Now, locate the server that you just ran Sysprep on. Right click on the listing for that server, and choose the Clone command from the resulting shortcut menu, as shown in Figure B.

    Figure B: Right click on the virtual machine that you want to clone and choose the Clone command from the shortcut menu
    The console will now launch the New Virtual Machine wizard. The wizard’s first screen will ask you for a name and description for the new virtual machine. Keep in mind that if you are going to be setting the new virtual machine up on the same host server that is running the server that you just cloned, then you will have to use a different name. You can see an example of this in Figure C.

    Figure C: Enter a name for the new virtual machine that you are creating
    When you have finished entering a name and a description for the virtual machine, click Next. You will now be taken to the Configure Hardware screen that is shown in Figure D. As you can see in the figure, this screen is similar to the Settings screen found in the Hyper-V Manager. You can manually allocate hardware resources to the new virtual machine, or you can allocate hardware resources by making use of a hardware profile.

    Figure D: You must allocate some hardware resources to your new virtual server
    Click Next, and you will be taken to the New Virtual Machine Wizard’s Select Destination screen. As you can see in Figure E. As you can see in the figure, you must choose whether to place the new virtual machine on a host or to store the virtual machine in a library. The choice is yours, but most of the time if you are going through the trouble of cloning virtual servers you are going to end up placing the cloned machine in the library.
    What happens next really depends on the option that you select on this screen. If you choose to place the server into a library then you will be prompted to enter the name of a library server and a path. If you choose to host the virtual machine then you will be required to specify a host, a path, and specify how the virtual machine will connect to the network.

    Figure E: You must choose whether to place the new virtual machine on a host or to store the virtual machine in a library
    Booting a Cloned Image

    Now that the cloning process is complete, it is time to boot our cloned virtual machine. When you initially power up the virtual machine, you will be taken to the Windows Server Setup screen, as shown in Figure F. Do not panic! Windows needs to run a miniature version of Setup so that it can regenerate the attributes that we stripped earlier.

    Figure F: Windows launches a mini version of Setup
    Select your region and your language just as you would for any other Windows installation, and click Next. At this point, Setup will display the Windows license agreement, as shown in Figure G. Go ahead and accept the license agreement, and click Next.

    Figure G: Accept the license agreement and click Next
    The final step in the process is to enter a new name for the new virtual server, as shown in Figure H. After doing so, just click the Start button and Windows should boot. You should now have a fully functional cloned machine. It is possible that there may be some other minor configuration work that you will have to do though. For example, if you use static IP addresses on your servers then you would need to assign an IP address to the new virtual server before you would be able to use it to access the network.

    Figure H: Enter a name for the virtual server and click Start
    Conclusion

    In this article, I have shown you how you can use Sysprep to prepare a virtual server to be cloned, and then I showed you how to use the System Center Virtual Machine Manager to perform the cloning process. In Part 3 I will show you an additional cloning technique that you can use if you do not happen to own a copy of System Center Virtual Machine Manager




  3. #3
    نام حقيقي: 1234

    مدیر بازنشسته
    تاریخ عضویت
    Jul 2009
    محل سکونت
    5678
    نوشته
    5,634
    سپاسگزاری شده
    2513
    سپاسگزاری کرده
    272
    کد:
    http://www.virtualizationadmin.com/articles-tutorials/general-virtualization-articles/cloning-hyper-v-virtual-machines-right-way-part3.html

    PART-3



    Introduction

    Although Microsoft’s System Center Virtual Machine Manager automates the process of cloning a virtual machine, you can perform the cloning process manually without the aid of additional software. This article starts with the explanation of the manual cloning process.
    In my previous article in this series, I showed you how you could use SYSPREP to prepare a virtual machine for cloning. Once we prepared the system image, we used System Center Virtual Machine Manager to perform the actual cloning process. Although this technique works really well, I realize that not everyone owns a copy of System Center Virtual Machine Manager. That being the case, I want to show you a cloning method that you can perform using only native Windows tools.
    Before I Begin

    Before I get started, I want to point out that regardless of which cloning method you are going to be using, you are going to have to prepare your model machine for the cloning process by using SYSPREP. Even though I am going to be using a completely different cloning process in this article, Windows still expects every server on the network to be uniquely identifiable. Therefore, you will still have to run SYSPREP ahead of time so that you can strip the model machine of uniquely identifying information prior to cloning it.
    One more thing that I want to point out before I get started is that the technique that I am about to show you is actually geared towards moving virtual machines from one Hyper-V server to another. By slightly altering the technique, we can use it as a method to clone virtual machines.
    Since the technique to migrate a virtual machine is so similar to the technique for cloning a virtual machine, I am going to show you how to do both. The most important thing to keep in mind is that if you are only migrating a virtual machine to a new host server, then you should not run SYSPREP on that machine. If you are going to be cloning a virtual server though, then running SYSPREP prior to the cloning process is required.
    As always, remember that you never run SYSPREP against a production server, because doing so will essentially destroy that server. You should only run SYSPREP against virtual machines that you have specifically created to act as models for clones.
    The Process

    The process that I will be showing you involves using Hyper-V’s Import and Export functions. While there is nothing inherently difficult about performing an export or an import, you need to have a basic understanding of what is going on behind the scenes. That being the case, I want to talk about virtual machine portability.
    Virtual Machine Portability

    As I have already mentioned, Hyper-V allows you to move virtual machines from one host server to another by using the Import and Export functions, and this process can easily be adapted to create virtual machine clones. You may be wondering why this process is even necessary though, and why you can’t just make a copy of the virtual hard drive file (the .VHD file) and build a new virtual machine around it.
    I think that I may have mentioned earlier in this series that I was building a new virtual server out of a copy of a virtual hard drive from a virtual machine that had been running Windows Server 2003, but that I was not able to make that particular technique work for Windows Server 2008. The technique that I am going to be showing you is preferable to just copying the virtual hard drive file because it works regardless of which operating system is running on the virtual machine.
    Of course this leads me to a second question. What makes the Import/Export process so different from a copy of a virtual hard drive file? In order to answer this question, think back to the last time that you set up a virtual machine on Hyper-V. The setup process involved a lot more than just installing an operating system. You had to tell Hyper-V how much memory and how many virtual processors to allocate to your new virtual machine. You also had to tell Hyper-V how the virtual machine was going to connect to the network, and where the virtual hard drive files should be stored.
    All of this configuration information becomes a part of the virtual machine, but it is not stored on the virtual hard drive file. Remember that Hyper-V is depending on the configuration information to tell it which virtual hard drive file to boot the virtual machine from. This wouldn’t be possible if the configuration information was embedded in the virtual hard drive file.
    Earlier I mentioned that the Import and Export functions exist as a way of facilitating virtual machine portability. In order for a virtual machine to truly be portable, the virtual hard drive files need to be packaged with the other configuration information that Hyper-V is going to need. Only then does the virtual machine become truly portable.
    So now that I have explained the concept of packaging a virtual machine to make it portable, I need to talk about the anatomy of an exported virtual machine. As you will recall, cloning a virtual machine requires you to adapt the import and export process, and part of that adaptation involves making some modifications to the exported virtual machine. Understanding the components that make up an exported virtual machine is therefore the key to the cloning process.
    The Basic Structure

    When you perform an export of a virtual machine, Hyper-V will ask you to provide it with an export path. When the export process completes, Hyper-V will create a folder within the path that you have specified. This folder will bear the name of the virtual machine that was exported. That is how you can identify a virtual machine once it has been exported.
    Even after the export process has completed, the original virtual machine remains on the host server. Microsoft does this as a safety precaution. The idea is that if something goes wrong with the export process, you have not lost your original virtual machine. This does mean however, that we are going to have to do some cleanup work after the migration or cloning process completes.
    The folder that Hyper-V creates contains three sub folders; Snapshots, Virtual Hard Disks, and Virtual Machines. The folder also contains a file named CONFIG.XML. The CONFIG.XML and each of the folders that I have listed are involved in the cloning process. I will show you why in Part 4.
    Conclusion

    In this article, I have explained that the easiest method to clone virtual machines in a Hyper-V environment using Microsoft’s System Center Virtual Machine Manager. Even so, you can complete the cloning process manually without the aid of any additional software. The process involves using SYSPREP to prepare a virtual server, and then exporting it in a special way. In the next article in this series, I will finish explaining the anatomy of an exported virtual machine, and then I will show you what you have to do to make a clone off of the exported virtual machine




  4. #4
    نام حقيقي: 1234

    مدیر بازنشسته
    تاریخ عضویت
    Jul 2009
    محل سکونت
    5678
    نوشته
    5,634
    سپاسگزاری شده
    2513
    سپاسگزاری کرده
    272
    کد:
    http://www.virtualizationadmin.com/articles-tutorials/general-virtualization-articles/cloning-hyper-v-virtual-machines-right-way-part4.html
    PART-4


    Introduction

    In my previous article, I explained that Hyper-V’s export function could be used as a mechanism for cloning virtual machines if you do not have System Center Virtual Machine Manager. In this article, I want to conclude the series by showing you how the export process works.
    Examining an Exported Virtual Machine

    Before I show you how to export a virtual machine, I want to take some time and talk about what you can expect when the export process completes. When you export a virtual machine, Windows will ask you to specify an export path. Once the export process begins, Hyper-V creates a folder bearing the name of the virtual machine, and places the folder beneath the path that you specify. All of the various components that make up the exported virtual machine will reside within this sub folder.
    The sub folder that’s named after the virtual machine contains three additional sub folders; Virtual Machines, Virtual Hard Disks, and Snapshots. The Virtual Machines folder contains an .EXP file whose full name is based on the virtual machine’s GUID. This file is the key to the cloning process, so I will be talking more about it later on.
    The Virtual Hard Disks folder contains a copy of all of the virtual machine’s virtual hard disk files. Finally, the Snapshots folder contains all of the differencing disks and an .EXP file for each of the snap shots that exist for the virtual machine. If you are going to be using the virtual machine as a template for creating clones, then you should refrain from creating any snapshots. Although you can clone a virtual machine that contains snapshots, snapshots kill a virtual machine’s performance because of the way that the differencing disks are used. Having snapshots also causes the export process to take longer than it otherwise would.
    In addition to the folders that I have just described, the export process also creates a file called config.xml. This file is used to store the virtual machine’s configuration. There isn’t anything special that you will have to do with this file as a part of the cloning process.
    Exporting a Virtual Machine

    Performing a virtual machine export is simple. As with any other cloning operation, you will want to configure the virtual machine that you want to clone (do not try to clone a production virtual server), and then run SYSPREP. Now, you can begin the actual export process. To do so, just open the Hyper-V Manager and select the virtual machine that you want to export. Next, click the Export link that is located in the console’s lower, right pane. When you do, Windows will open the Export Virtual Machine dialog box, shown in Figure A.

    Figure A: Enter the path that you want to use for your exported virtual machine
    At this point, you must enter a path to use as the export destination for your virtual machine. You will notice that the dialog box contains an option that you can select if you only want to export the virtual machine’s configuration. If your goal is to create a clone of the virtual machine, then you should not select this check box.
    After you have entered your export path, the export process will begin. The export operation’s progress can be seen within the Hyper-V manager, as shown in Figure B. It is worth noting that depending on the size of the virtual machine that you are exporting and your hardware’s capabilities, the export process can take several hours to complete.

    Figure B: The Hyper-V Manager shows the progress of the export
    The Cloning Process

    Now that we have exported our virtual machine, we can clone it. The first thing that you need to know about the cloning process is that Hyper-V is designed so that an exported virtual machine can only be imported once. The assumption is that you will be using the export / import process to move a virtual machine from one host server to another. The limitation of only being able to import a virtual machine once exists as a safety mechanism to avoid accidental virtual machine duplication.
    In some ways this logic is flawed though. First, the export process does not remove the original copy of the virtual machine from its host server. Therefore, even if you did only import the exported virtual machine once, you could still end up with a duplicate machine on your network, unless you deleted the exported machine from its host server first.
    The other reason why the logic is flawed is because we have already run SYSPREP on our virtual machine prior to exporting it. This means that we can make as many copies of the virtual machine as we want without having to worry about any of the issues that arise from having duplicate machines on the network.
    The trick to being able to use your exported virtual machine as a master for the cloning process is to make a copy of the .EXP file within the Virtual Machines folder. When you import a virtual machine, it deletes the .EXP file as a way of ensuring that the virtual machine can not be imported again. Therefore, if you want to use the exported virtual machine for multiple imports, just restore a copy of the .EXP file, and you can import the virtual machine again.
    Actually, there is a little bit more to the procedure than that. Before you begin the import process, you must move your exported virtual machine files to the location in which they will be used. Wherever the exported files are located when you begin the import process will be the file’s permanent location for the life of the imported virtual machine. Therefore, if you are going to use your exported virtual machine files as a template for creating clone machines, don’t use the original files. Instead, make a copy of the files, and place that copy in physical location where you want the virtual machine’s files to permanently reside.
    Once you are satisfied with the file locations, click the Import Virtual Machine link found in the Hyper-V Manager’s Actions pane. Upon doing so, you will see the Import Virtual Machine dialog box, shown in Figure C. As you can see, you must simply enter the path to the copy of your exported virtual machine files that you want to import. Be sure that you do not select the Reuse Old Virtual Machine IDs check box. Otherwise, Hyper-V will try to use the same GUID for your new virtual machine as what the original copy used.

    Figure C: Enter the path to the copy of your virtual machine that you want to import, and click the Import button
    Conclusion

    One of the greatest benefits to working with virtual machines is that they can be duplicated so easily. Regardless of which duplication method you choose to use though, it is important that you remember to use SYSPREP before you begin the duplication process. Otherwise, the duplication process may fail, or you may end up with a major network conflict due to having virtual machines that are completely identical




کلمات کلیدی در جستجوها:

have duplicate all files so the same virtual machine can be imported again on by default

best way to clone hyper-v vm

hyper v do you have to delete the original vm after exporting it

hyper-v clone

duplicate all files so the same virtual machine can be imported again

sysprep 2008 hyper v original machine

Duplicate all files vmm import image

clone vm in hyper-v video tutorial

steps import hyper-v copy files duplicate all files so the same

مبینت

cloning in hyper-v

hyper-v clone Duplicate all files so the same virtual machine can be imported again

config.xml export Hyper-V Virtual Machine

hyper-v virtual mashine clone import export sid

simple clonnig hyper-v

run sysprep for export a virtual machine with windows 2008

برچسب برای این موضوع

مجوز های ارسال و ویرایش

  • شما نمی توانید موضوع جدید ارسال کنید
  • شما نمی توانید به پست ها پاسخ دهید
  • شما نمی توانید فایل پیوست ضمیمه کنید
  • شما نمی توانید پست های خود را ویرایش کنید
  •