A program for backing up VMware virtual machines. Backup with Vizioncore esxRanger

Imagine the situation: an accountant’s computer is faulty (otherwise it cannot be otherwise with an accountant’s computer!). It (on this computer) has a bunch of programs installed that can take three days or even more to restore. But an accountant needs to work without interruptions, and it’s better for him not to touch anything for another three years, to wait for a total collapse. What to do? An old system backup will not work - programs are updated and added quarterly and therefore old image systems made on a freshly installed system will not work.

It would be a good idea to leave everything old and at the same time make everything new. Just in such a situation, you can make a virtual copy of a computer that is still working and check its performance. (for example, on the administrator's computer). Then demolish everything on the accountant’s computer, install a fresh system and run a virtual machine on this fresh system until the work smoothly flows to the host machine. At the same time, you can leave the guest file (this is essentially a working accounting backup!) in the archive - after all, it’s just a file, albeit 20 gigs in size, but who cares about that now.

So the idea is clear. Its implementation is also not difficult. To do this, we will use two free programs: Oracle VirtualBox And Paragon Go Virtual.

Step 1: create a virtual copy of a working computer

To create virtual copy we use computers Paragon program Go Virtual. This program is available for download from http://www.paragon-software.com/home/go-virtual/ for free. You only need to provide your name and email - a letter will be sent to this email with serial number. After installing the program, you will need to restart your computer.

The program interface is extremely simple - only two buttons on the main window. Select "P2V" (physical to virtual). You will need to select the type of future virtual machine - we choose Oracle VirtualBox.

The copying process will take some time, you can drink some tea. At the end, the program will create at least two files: drive C and a settings file with the OVF extension. If you create a copy of your computer with multiple drives, there will be more files. The created disk images will be in VMDK (VMWare) format. But VirtualBox works great with them.

Step 2: import the created copy into Virtual Box

For the purity of the experiment, let’s copy the resulting files to another computer (let’s call it the admin’s computer). If the administrator’s computer does not yet have VirtualBox (!!! ahtung!!!), install it immediately.

In the main window of the VirtualBox program, select the “file” menu - “Import configuration” and select the file with the OVF extension created by Paragon Go Virtual in step 1. VirtualBox itself will understand what to do next.

Note: Before performing this operation, look at VirtualBox settings, where it will put disk and settings files virtual machines- the files will be quite large in size, and by default, the path will be on the system drive, which is not always convenient.

During the virtual machine creation process, VirtualBox will copy the files hard drives, created by Paragon Go Virtual. Once VirtualBox has finished the import process, the files created by Go Virtual can be deleted (check that the virtual machine starts first!).

Step 3: Finish

Most likely, you do all this at work, so be careful when starting a virtual machine - because if network adapter VirtualBox is in bridge mode; your copy of a real working computer on the network can cause conflicts. I usually do this: before starting the virtual machine, I completely disable the network in the settings of this machine in the console of the main VirtualBox window. From sin. I connect VBoxGuestAdditions.iso as a CD and after loading the virtual machine I install add-ons (for mouse integration, adjusting the screen size, etc.). Please note that you need to give Windows some time to update the hardware list and install new display drivers, etc. The guest virtual machine will need to be rebooted.

All. You have created a really working copy of the computer and you can do whatever you want on it.

Please note that this method can be considered an advanced option for creating backups. For example, we can consider that we create backup copy not data, but already configured and ready-to-use applications.

Reducing the disk space of a virtual machine in VMDK format (VMWare)

As a rule, it is installed on a constantly used computer. more programs than is necessary for storage in a virtual machine. Well, really, why do you need Gimp, ICQ, Skype, ImageViewer or a media player as well as “My Documents” and “My Music”? Down with everything unnecessary. The disk of the virtual machine will most likely be at least 10 GB, and then there will be rubbish.

Okay, you started the virtual machine, deleted unnecessary programs, but the file vdisk.vmdk (for example) has not reduced its size. It's good if you didn't increase it. You deleted 3 GB of junk, but the size did not become smaller?

The disk file is created in VMware format. VMware company together with products VMware Server And VMware Workstation supplies console utility for working with virtual disks vmware-vdiskmanager. This utility is a powerful conversion tool virtual disks. You can find the vdiskmanager utility in the folder where VMware Server or VMware Workstation products are installed. Those. just install the trial version of WMware Workstation and find the file in its folder vmware-vdiskmanager.

Using this utility in our case is simple: vmware-vdiskmanager.exe -k<путь до вашего файла vdisk.vmdk> .

In my case, this allowed me to reduce the size from 22 GB to 14 GB!

If you don’t want to install VMware, you can try downloading the archive with this utility from here (856 kb, MD5: CF48CF9B69EA712E7B7B8C94EFA7AB49). The archive contains the utility itself and two libraries necessary for its operation. By at least, with the "-k" switch. I hope this is enough and won't require installation. full distribution VMware.

Reinstalling the operating system or changing computer device does not mean the end of working with installed guest OSes in the program. True, an exception may be the case when the files on the hard drives of virtual machines are located on system disk computer, and the system itself cannot be restored after a critical failure. To continue working with existing guest OSes while maintaining their state, but on a reinstalled Windows or on another computer, the VirtualBox program has a tool for exporting the configuration of existing virtual machines for importing it later. Another option to continue working with existing guest OSes is to add new virtual machines based on existing files on their hard drives. We will consider all these processes below.

1. Universal virtual machine export file format

The configuration of an existing VirtualBox virtual machine is exported to the file " .ova" The ".ova" (Open Virtual Appliance) file is universal file storage of virtual machine data that can be used in various programs for virtualization of operating systems. This , . The virtual machine exported to this file can then be imported as VirtualBox program, and VMware Workstation or Microsoft Hyper-V within the guest systems supported by these programs.

Let's take a closer look at the process of exporting and importing the configuration of the VirtualBox virtual machine in the main Windows system.

2. Export a virtual machine

In the VirtualBox window, select a specific virtual machine to export, click the menu “ File" and select " Export configurations».

In the next window, click " Next».

Exporting a configuration is only possible when the virtual machine is powered off, and if it is paused, VirtualBox will prompt you to reset the saved state to continue the process.

Next, the export options window will appear. We leave the preset format, but change the export file folder “.ova”, which is located on the system drive by default, to a folder, for example, as in our case, specially created on the non-system drive D.

In the next window, click " Export».

We are waiting for the export process to complete.

The exported virtual machine in the “.ova” file will be located in the specified folder, from where it can be moved to another computer, removable media, cloud service. Or you can leave it, as in our case, in place - on a non-system drive, where this file will be stored during the reinstallation of Windows.

3. Import a virtual machine

After installing VirtualBox on new Windows or on another computer open the program and in the menu “ File» select « Importing configurations».

In the next window, specify the path to the “.ova” file with the exported virtual machine. Click " Next».

At the very end of the window, the path will be indicated where the “.vdi” hard disk file will be placed after import. By default, this is the system drive, and in order not to clutter it and prevent the loss of the “.vdi” file in the event of a system failure, you can change the path by specifying the storage folder on a non-system drive. Click " Import».

We are waiting for the import process to complete.

After which we will see the imported virtual machine in the list VirtualBox machines. All that remains now is to start the car.

The guest OS will start in exactly the state it was in at the time the virtual machine was exported.

4. Adding a new machine from an existing VirtualBox hard disk file

An alternative to exporting and importing a virtual machine is adding new car from existing file hard VirtualBox disk « .vdi" This method is in no way inferior to the procedure for exporting and importing a virtual machine. Moreover, if the ".vdi" file is located on a non-system drive, when reinstalling Windows on physical computer You don’t even have to waste time exporting the configuration. We can simply transfer the “.vdi” file stored on the system disk to a non-system disk. By and large, the process of exporting and importing a virtual machine benefits only by saving the space taken up by the “.ova” file. For example, in our case, we exported a virtual machine with the Windows XP guest OS installed, and the weight of the “.ova” file at the output was 4,11 GB While the size of the hard disk “.vdi” file of the same system is 10 GB.

This space-saving benefit may be relevant if you transfer a virtual machine to another computer using cloud storage or removable media with limited size. In our case, when we are talking about reinstalling Windows, the method of adding a new machine from an existing VirtualBox hard disk file is quite suitable.

Launch VirtualBox and click " Create».

Set the indicator RAM. Click " Next».

In the hard drive selection window, select the option “ Use an existing hard drive", using the browse button, specify the path to store the ".vdi" file. Click " Create».

The virtual machine will appear in the VirtualBox list, we can launch it.

The guest OS will start exactly in the state in which it was saved in last time working with her.

Adding a new virtual machine from an existing “.vdi” file is also a way to move the guest OS hard disk file to a non-system drive of the computer if it was originally created on the system drive, and over time the space it occupied began to reduce system performance. To do this, you need to remove the virtual machine from the list in the main VirtualBox window. On the selected machine we call context menu and select " Delete».

Then in the window that appears, click “ Remove from list».

After this, you can search for the hard disk “.vdi” file on the system drive (usually the default path C:\Users\Username\VirtualBox VMs), move it to a non-system disk and add the virtual machine again.

Did this article help you?

Windows Server 2008 Hyper-V does not have an option to create a clone of an existing virtual machine. However, this does not mean that it is impossible or that it is difficult to do. In fact, there is such a possibility and it is quite simple to use.

There are two ways to clone a virtual machine in Hyper-V.

1. Use the export/import function of virtual machines
2. Copy virtual hard drive and create a new virtual machine with this disk.

1. Use the export/import function in Hyper-V

This method is the easiest and most affordable way to clone a virtual machine.

Exporting a virtual machine

While in Hyper-V Manager, click right click to the desired virtual machine and select Export. Specify where the virtual machine will be imported. It is important to know that when you import the virtual machine back, the location of the virtual machine and its virtual disk will point to this location.

During export, you can choose what to export: the entire virtual machine or just the virtual machine configuration.

Importing a virtual machine

To import a virtual machine, click “Import Virtual Machine” from the Action menu. Specify the directory with the exported virtual machine and click Import.

It is important to indicate exactly the directory of the exported machine, and not one of its subdirectories.

Once the virtual machine is imported, you can change its settings, such as IP address, hostname, etc.

2. Copy the VHD and create a new virtual machine

Just copy VHD file original virtual machine and then create a new virtual machine, but as hard drive specify the copied file. In the menu, when you reach the “Connect Virtual” window Hard Disk”, select the “Use an existing virtual Hard Disk” option and specify its location.

Guard

Chinese doesn't always mean bad. Chinese front loaders are sold here at factory prices.

Do you need a fence for your dacha, cottage, or home? Contact "Profzabor" - production of custom-made fences from any materials.

Practical acquaintance with VMware converter - a product that allows you to make an exact copy of a real machine for subsequent virtualization.

Many have already appreciated the capabilities of programs like VMware or Virtual PC. First of all, of course, they are useful to developers, who can easily test their creations under different operating systems, in different software environments, or even on a clean, freshly installed system. But virtual machines can also be useful for mere mortals.

How do you like the opportunity to run an ancient program that refuses to be friendly with the new operating system? Or unique program, existing only for one system, and - well, of course - not the one you have. Yes, and just look at the new one out of curiosity Linux distribution or some extreme alternative OS, not wanting to take on unnecessary obligations for cutting the disk into partitions, fiddling with the bootloader, and resolving conflicts with your hardware. For example, in my search for interesting software, I would have messed up the system more than once if I had decided to try out candidates without the help of a virtual machine.

If we take VMware, then creating a new machine is a simple and fast process. However, you get what you get - a completely empty “disk” on which you still have to install operating system. What if you need a specific configuration? If you already have a work computer set up and want to experiment with it? Or restore from backup old configuration and meditate on the topic “why did everything get covered up”?

With VMware converter it's just as easy, although a little longer. This product allows you to make an exact copy of a real machine for subsequent virtualization. However, the converter can also use:

  • virtual machines both VMware and Microsoft Virtual PC (only if Windows is used as a guest system);
  • Symantec Backup Exec System Recovery images;
  • images Norton Ghost(starting from version 9).

Having installed and launched VMware converter (beta 3.0 Starter Edition), you will see a window with a list of tasks that is still empty. The task philosophy is rather reserved for more powerful version Enterprize, if you suddenly want to virtualize all 157 machines of your local network, but in any case you will have to create a task. Let's take the conversion real computer, on which the converter is launched, as the most general case. Please note right away that you will need space somewhere for a virtual disk of at least the same size as the occupied space on the system disk of the test machine. More is better.

So, to create a task, click on the Import Machine button. A “wizard” will launch, which will gradually shake out from you all the information necessary for the work. You select Physical computer, then This local machine, and then select the disks from which you need to take images and subsequently connect them to the virtual machine. If you don't have any special requirements, just select the system drive.

The next steps require you to specify the settings of the machine and its disk (they are similar to the settings of VMware Workstation) and click the "Finish" button. Your task will appear in the main program window. Make yourself some coffee or convince your dog that it’s time for her to go for a walk, and start the task. I personally managed to leisurely walk to the store and back, but I don’t have the most powerful computer.

When the work is finished, open the created configuration file in VMware Player and, voila! Exact copy your system with all settings and applications spins in its own window. Just like a nesting doll.

Perhaps I’ll start with the fact that if you want backups on VMWare, then get ready to pay. Free VMWare is free as long as we are not talking about migrations, backups and the like. At this point you can start an endless holivar, but without my participation. My stories will only be about Hyper-V on Windows Server 2012R2. Although some of the article can be applied to VMWare, there are likely to be pitfalls.

We can back up to Hyper-V for free, or rather, with those using Windows, for which we have already paid by purchasing Windows licenses Server. For the convenience of working with our backups (besides, we also paid for this), we will use WDS and deduplication (maybe group policies).

1. Backup from inside virtual machines

1.1. Backup of today

As far as we know, any Windows knows how to make backups. Moreover, any Windows backup settings through the interface ultimately come down to background use wbadmin utilities. What exactly can wbadmin do? And she can make both a backup image with a system partition and a backup separate folders. In this part of the article, we are only interested in the backup image (of the system partition). The rest is specific data of virtual machines and needs to be backed up separately. Hence the conclusion: Do not store virtual machines on the system partition (and on regular computers too) none valuable information and databases, individual applications. MS SQL Server/ MS Exchange / “1C Application Server” and others we install only on not system partitions or on separate disks.

So, what is needed for the backup to work? And you only need one command:

Wbadmin.exe start backup -backupTarget:\\Backup Server\FolderForInternal Backup -allCritical -quiet
In fact, this command requires special rights, but more on them later. Now it is important to understand one thing. This command makes more than just a backup. She makes an incremental backup. Moreover, for server and desktop (client) Windows backups different ones are formed. And the difference is that for server operating systems we will get snapshots of each backup, but for desktop OSes, only the last snapshot will always remain. You may ask, what kind of incremental backup is this? But it remains “incremental”, because we do not backup the entire image, but only the part that has changed since the last backup (which means less traffic and a faster backup).

Those who have encountered a similar situation will notice that the backup will always be “incremental” (full). Since backup occurs in our case on network drive. That is, for the server room Windows snapshots only the last ones remain.

Later, I discovered that there is no difference in the work of wbadmin on the server and client OS. The only difference is in the interface. wbadmin performs incremental backups (except for the first backup) if the hard drive is specified in the -backupTarget key (the command uses the default key -vssCopy). Or produces full backup, if you add the -vssFull key.

1.2. Backup with the history of previous images

On at the moment, we made backup images of virtual machines. But this is only a backup of pictures for us today. Tomorrow it will be completely different... But what will happen if you make backups? Yes, and truly incremental. That's what we'll do.

Wbadmin.exe start backup -backupTarget:e: -allCritical -include:d: -quiet #where drive D is backups for today, and drive E is backups with history
But this was not enough for me and I did this:

(echo select vdisk file="\\Backup Server2\FolderFor Backup2\BackupNameForThisServer2.vhdx" echo attach vdisk) | diskpart
The script connects virtual disk from the network. After the backup, a similar script disconnects the disk. The OS remembers that the drive has the letter E defined. But God forbid you slip in someone else’s drive with the same letter E, the backup will work in full (not incrementally and to someone else’s drive). Keep this in mind and use a letter towards the end of the alphabet (X, Y, Z)…

Let me note right away that if today’s backup is carried out in parallel with a backup with history, we will end up with a backup that cannot be restored.

To get a backup of previous days, you can use the interface (GUI) of the server on which backups with history are made. Moreover, all runs of the wbadmin command in Windows console knows and remembers. The recovery service will give you the opportunity to choose required archive in backups with history.

2. Backup vhdx files of virtual machines

It is done easily and naturally:

Wbadmin start backup -backupTarget:$BackupPath -hyperv:$VMList -Quiet
But with some peculiarities. This command must be executed in PowerShell and first obtain the list of virtual machines into a variable. For detailed example contact Google.

Backup of virtual machines in Windows Server 2012 R2 is done using snapshots Hyper-V. I also note that virtual machines are suspended if they Linux kernel or missing Hyper-V drivers. I personally refused to backup virtual machines in this way. The reason is that on Windows Server 2012 (not R2) it was necessary to stop virtual machines before backup. And even now on Windows Server 2012 R2, Linux pauses do not suit me, when there is the first good backup method. (there is a remark in the comments to this article). After the next update in Windows Server 2012 R2, backup of any virtual machines occurs without interruption. Linux OS can also be backed up “from within” using Dump (CentOS, Ubuntu), but this is a separate topic with puppets and other software in my case.

3. Restore backup and WDS

And now, in my opinion, the most useful part this article is about backups.

WDS stands for Windows Deployment Services Windows deployments) and part Windows functionality Server 2012R2. This service used to be called RIS, but I have not encountered it. In general, the essence of WDS is simple. Registered in DHCP (automatically for DHCP Windows Server) in the form of separate parameters and then downloaded to the computer over the network (this setting Computer BIOS for downloading over the network) via TFTP WDS downloader. Next, the WDS loader allows you to select from the Windows “bootloader” images available on it. There are different bootloaders - these are installer bootloader images, PE, and RE images. The installer loader also requires images of Windows themselves in WDS, but this is the case if you need to install Windows over a network. We are interested in RE images that allow you to recover a machine from a backup.

I won’t explain in detail how and what works in WDS. But here are the important notes:

  1. If you have the RE bootloader loading on Hyper-V virtual machine over the network, but the keyboard does not work in it. Congratulations, your RE image is for WinXP or older and does not know about the existence of Hyper-V drivers.
  2. If your system starts restoring a backup, but stops. Delete all partitions on the hard drive (on which the backup is restored) and try again. Just don’t forget that the backup may be broken and after deleting all the partitions on your hard drive, you may not have anything left of the old information.
  3. If the backup is from UEFI boot, and you want to restore to a computer without UEFI, then it’s not worth wasting your time. Most likely you won't be able to deploy the backup.
  4. Backup with UEFI boot and GPT partitions can be restored to machines with a different processor / motherboard, but with MBR partitions format and loading a regular BIOS on another machine is unlikely to be deployed. Well, I definitely didn’t succeed.
  5. If you try to deploy a backup to a disk with a smaller capacity, then this will not work. Even if the disk in the backup was almost empty. In this case, restoring to a virtual machine with dynamic disk. Next, reduce this disk and create a new backup. But this is only possible with UEFI bootloader in the backup (why, read the previous paragraph).
  6. Before restoring the backup, you should disable it extra disks so as not to overwrite information on them.

4. Features of deduplication

You can deduplicate running virtual machines. You can deduplicate today's backups and you can deduplicate historical backups. All this gives a big positive plus to the volume of hard drives (for both HDD and SSD). But don't forget about some things:
  1. If deduplication works on disks larger than 1 TB, the deduplication optimizer will use a lot of memory.
  2. If deduplication works with compressed data, but with more than 10 TB of compressed data, then the duration of the deduplication optimizer will be too long. This can happen if you simply copy data daily to a deduplicated disk in different folders.
  3. It is possible and even necessary to store backups on HDD, but you should not store working virtual machines on HDD in quantities greater than 5-10. This applies to deduplication only in that the deduplication of such working virtual machines will reduce HDD performance to zero.

5. Group policies

Here you can implement the installation of a backup script using GPO for a long time and in different ways. But I would like to draw attention to important points:
  1. Make backups only on behalf of an individual account user.
  2. Do not store scripts with passwords in group policies.
  3. Run a script with special rights to read all system information.
Well, actually conclusion: Backup using wbadmin tools is possible, quite feasible and, most importantly, viable. But only if you have time and a lot of patience for all sorts of little things. For example, the article does not say anything about how to monitor successfully created backups. I managed to do monitoring on Zabbix, but I could write a couple more articles about this... I hope the article will be useful to you and save a lot of invaluable time.