How to make a copy of a virtualbox virtual machine. Backing up your system with virtualization

The consistency of backup data is the sum of the validity, accuracy and integrity of the data in relation to files, application data, and the computer's operating system, or virtual machine... Data consistency is critical for any backup system, regardless of its size and company security policies. In this article, I'll show you how to make sure your backup is consistent and can be restored at any point in time without any data corruption.

Consistency levels of backup files

There are several levels of data consistency in backup files. The levels are determined according to the following criteria:

  • system type(whether the backup was made "live" or off the system)
  • file accounting(can interdependent files be clearly defined relative to each other)
  • application accounting(whether protection was used to prevent data loss at different levels, including the transaction level)

Let's look at all the types of consistency in order.

Inconsistent backup

The first and oldest type of backup is using inconsistent copies. It can be thought of as the operation of copying all computer data during its operation to a USB flash drive or network storage... If at least one file changes during the copy, the backup will become inconsistent. This means that the amount of backup data will differ from the current state of the system, and restoration data will happen inaccurate or incomplete. This type also does not involve saving a dump. random access memory and may have difficulty with read-only files.

Application Stateless Backup

Next type backups- so-called copies without regard to the state of applications. The main difference from inconsistent backups is that this backup was created at a specific time interval. Think of such a copy as a snapshot of everything content of hard disk - as if you took a photo.

However, restoring a system image from such a copy is roughly equivalent to turning on the computer after a power failure. Application data open at the time of the crash and active (at the time of the crash) I / O cannot be recovered. In some cases, when launching applications after recovery, you need to perform special operations to restore their performance. This is especially dangerous for database applications. For example, Microsoft Exchange the server may require the installation of a dedicated recovery group and separate log integration. Microsoft Applications SQL or Oracle will require restoring the state of the databases to within a specific transaction, since a failure in their operation disrupted the sequence of operations, and some transactions must be re-executed in order for them to be committed by the system.

File-consistent backup

File-level consistency means that the contents of all open files at the time the backup starts must be committed to the hard disk. However, even in this case, the system still has no idea about the ongoing transactions with the application databases.

Transactional Consistent Backup

Such a copy does not have the disadvantages described above, and all VM data at a specific point in time is backed up. The problem with creating such a copy is that file and application reconciliation operations must be performed when the desired VM is in operation and access to it must be continuous for clients.

For VMs running under Windows control Veeam helps you make your backups completely consistent using the service shadow copies(VSS). This service is developed by by Microsoft and is included in all editions operating systems Windows starting with Windows Server 2003. The shadow copy service coordinates the processes that prepare the system for freezing. It allows you to temporarily suspend hard disk I / O and thus helps your backup software.

« Backup application-aware image processing - Veeam technology that ensures successful full recovery VM and application data VM without data loss.

Veeam Backup & Replication does not install software agents on VMs. Instead, a service application is launched on the guest machine to coordinate the backup of the guest OS. After copying is complete, the application is automatically uninstalled. The mechanism is designed to prevent potential difficulties with preinstalling, troubleshooting, and updating software agents.

Veeam Backup & Replication initiates the start of the shadow copy service and sends a request to create consistent contents of the VM disk before taking a snapshot of the VM. The shadow copy service provider then coordinates the preparation of applications for backup. This ensures consistency of data at a precisely defined time interval. Thus, it is guaranteed that there are no pending and unconfirmed operations in the database or incomplete application files at the time of copying the contents of the VM.

How can I make sure the backup is consistent?

At the stage of configuring a backup or replication task, you need to make sure that the “enable application-aware processing” option is activated on the “guest processing” tab for the VMs that are selected in this task. Then you can start the task and check the status of its execution.

Application stateful backup is especially critical for SQL or Exchange server backups, as it allows you to control the growth of transaction logs and truncate them if necessary. Otherwise, control over the growth of logs occurs in manual mode.

The shadow copy service works great for modern machines running Windows, but in the case Linux environments you need to use a different method.

VMware quiescence

For example, for virtual machines running on VMware ESXi servers VMware provides a quiescence option. This feature allows you to pre-freeze the I / O of the guest OS when the server prepares to take a copy of the virtual machine. Detailed instructions you can read about working with this option in.

Veeam backup jobs can use the Application Stateful Backup and Freeze VMware options at the same time. In this case, Veeam Backup & Replication will use the first option by default, and in case of failure or inability to use it, it will switch to another.

You can check the ability to restore data from a backup using.

Useful Resources

  • Veeam Blog: (English)
  • Reference manual: "" (English)

GD Star Rating
a WordPress rating system

How to ensure consistency of backup data, 3.2 out of 5 based on 5 reviews

Using VM Groups

VM groups allow the user to create special groups virtual machines for collective management.

Create a group using the GUI

1) Drag one virtual machine on top of another virtual machine.

2) Select multiple virtual machines and select " Group"In the right-click menu, as shown below:

You can create nested groups.

Group operations allow you to do the usual actions for virtual machines for all members of the group at once.

Pictures

With snapshots, you can save a specific state of the virtual machine for later use. At any later time, you can revert to this state, even if you may have changed the VM significantly since then. Thus, a snapshot of a virtual machine is similar to a machine in a "saved" state, as described above, but there can be many, and these saved states are persistent.

You can see snapshots of the virtual machine by first selecting the machine in the VirtualBox Manager and then clicking on the " Pictures"In the right upper corner... Until you take a picture of the car, the list of pictures will be empty, except for the item “ Current state", Which represents the point" Now"In the life of a virtual machine.

Create, restore and delete snapshots

There are three operations associated with snapshots:

  1. You can to take a photo... This makes a copy of the current state of the machine, which you can return to at any time later.
  • If your virtual machine is in this moment launched, select " Take a snapshot ..."In the drop-down menu" A car»VM windows.
  • If your virtual machine is currently in the state " saved" or " off"(As shown next to the virtual machine in the main VirtualBox window), click the " Pictures"In the upper right corner of the main window, and then
    • or on the small camera icon (for " To take a photo"), Or
    • click right click mouse element " Current state"In the list and select" To take a photo».

In any case, a window will appear asking for the name of the snapshot. This name is for reference purposes only, to help you remember the state of the snapshot. For example, useful name will " Fresh installation from scratch, no guest add-ons th "or" Service pack only 3 ". You can also add longer text in the “ Description", if you want to.

Then your new snapshot will appear in the list snapshots... Below the new snapshot, you will see an item titled “ Current state", Indicating that the current state of your virtual machine is an option based on the snapshot you used earlier. If you take another snapshot later, you will see that they will be displayed sequentially, and each subsequent snapshot will be taken from the earlier one:

VirtualBox does not impose any limit on the number of snapshots you can take. The only practical limitation is disk space on your host: each snapshot saves the state of the virtual machine and thus takes up some disk space.

  1. You can restore snapshot by right-clicking on any snapshot you have taken in the snapshot list. When you restore a snapshot, you are like returning to the moment it was taken: the current state of the machine is lost, and the machine returns to the exact state it was in when the snapshot was taken.

Note: Snapshot recovery will affect virtual hard drives connected to your virtual machine. This also means that all files created since the snapshot was taken and all other changes to the files will be lost. To prevent data loss when using the snapshot function, you can add second hard disk in " end-to-end recording»Using the VBoxManage interface and use it to store your data. Since writable hard drives are not included in snapshots, they remain unchanged when the machine is returned.

To avoid losing the current state when restoring a snapshot, you can create a new snapshot before restoring.

By restoring an earlier shot and taking more shots, you can create something like an alternate reality and switch between these different stories virtual machine. This can lead to the creation of a snapshot tree of the virtual machine, as shown in the screenshot above.

  1. You can also delete the snapshot, which will not affect the state of the virtual machine, but only release the files on disk that VirtualBox used to store the snapshot data, thereby freeing up disk space. To delete a snapshot, right-click it in the snapshot tree and select “ Delete". Starting with VirtualBox 3.2, snapshots can be deleted even while the machine is running.

Note: While creating and restoring snapshots is quite fast operations, deleting a snapshot can take a significant amount of time, as it may be necessary to copy a large amount of data between multiple disk image files. Temporary disk files may also need a large number of disk space during the operation.

There are some situations that cannot be handled while the virtual machine is running, and you will receive a corresponding message that the deletion of this snapshot should be done when the virtual machine is turned off.

Think of a snapshot as the time you've saved. More formally, a snapshot consists of three things:

  1. He contains full copy virtual machine settings, including hardware configuration, so that when a snapshot is restored, the VM settings are also restored. (For example, if you have changed the configuration of your hard drive or system settings virtual machine, this change is undone when the snapshot is restored.)
  2. A copy of the settings is saved in the device configuration, text XML file and therefore takes up very little space.
  3. The full state of all is preserved virtual disks attached to the machine. Reverting to a snapshot means that all changes made to the computer's disks - file by file, bit by bit - will also be canceled. Files created from the moment of creation will disappear, files that were deleted will be restored, changes in files will be undone.

(Strictly speaking, this is only true for virtual hard disks in "normal" mode. As mentioned above, you can configure disks to behave differently with snapshots. Even more formally and technically correct, restoring a snapshot does not itself virtual disk... Instead, when a snapshot is taken, VirtualBox creates delta images that only contain changes since the snapshot was taken, and when the snapshot is restored, VirtualBox discards that delta image, thus reverting to a previous state. It is faster and uses less disk space.

The creation of the differential image as such does not initially take up much space on the host disk, since the differential image will initially be empty (and later dynamically grow with each write to disk). However, the longer you use the machine after taking a snapshot, the more the different image will grow in size.

Finally, if you took a snapshot while the machine was running, the device's memory state is also saved in the snapshot (just as memory can be saved when the VM window is closed). When you restore such a snapshot, execution resumes exactly at the moment the snapshot was taken.

The memory state file can be the same size as the virtual machine memory and therefore take up quite a lot of disk space.

Removing virtual machines

To delete a virtual machine that you no longer need, right-click it in the list of the VM manager, select " Delete».

A confirmation window appears, allowing you to choose whether to delete the machine only from the list of machines, or also delete the files associated with it.

Menu item " Delete

Cloning virtual machines

To experiment with virtual machine configuration, test different levels of guest OS, or simply back up a virtual machine, VirtualBox can create a complete or linked copy of an existing virtual machine.

The wizard will guide you through the cloning process:

This wizard can be invoked from the context menu of the VM manager list (select " Clone") For the selected virtual machine. First choose a new name for the clone. You can select the option to generate MAC addresses for all network cards, then each network card in the clone will receive a new MAC address. This is useful when both the original VM and the cloned VM must be running on the same network. If you leave it unchanged, everything network cards will have the same MAC address as the one in the source VM. Depending on how you invoke the master, you have different variants for cloning operation. First you need to decide if the clone should be linked to the original VM or a completely independent clone:

Full cloning: In this mode, all disk image dependencies are copied to new folder VM. The clone can completely work without the original virtual machine.

Related cloning: This mode creates new distinctive disk images where the parent disk images are images source disk... If you selected the current state of the original VM as the clone point, a new snapshot will be created implicitly.

After choosing the clone mode, you need to decide what exactly to clone. You can always create a clone of just the current state or all. When you select everything, the current state and in addition, all snapshots are cloned. If you started with a snapshot with additional children, you can also clone the current state and all children. This creates a clone starting with this snapshot and including all child snapshots.

The cloning operation itself can be lengthy depending on the size and number of attached disk images. Also, keep in mind that each photo contains different images drives that also need to be cloned.

Menu item " Clone»Turns off while the machine is running.

Import and export of virtual machines

VirtualBox can import and export virtual machines to standard format Open Virtualization Format (OVF).

OVF is a cross-platform standard supported by many virtualization products that allows you to create off-the-shelf virtual machines that can then be imported into a virtualizer such as VirtualBox. Importing and exporting to VirtualBox in OVF format is very simple and is carried out from the Manager window, as well as the interface command line... This allows you to package so-called virtual devices: disk images along with configuration settings that can be easily deployed. Thus, you can offer complete, ready-to-use software packages (operating systems with applications) that do not need to be configured or installed other than being imported into VirtualBox.

Note: The OVF standard is complex and its support in VirtualBox is continuous process... In particular, VirtualBox is not guaranteed to support all devices created by others. software for virtualization.

Devices in OVF format can be displayed in two versions:

  1. They can come in multiple files as one or more disk images, usually in the widely used VMDK format and text file from description to XML with extension .ovf... To be able to import them, the files must be in the same directory.
  2. Alternatively, the aforementioned files can be packed together into a single archive file, usually with the extension .ova... (Such archive files use a variant of the TAR archive format and can therefore be unpacked outside of VirtualBox with any utility that can unpack standard files TAR.)

To import device into one of the above formats, just double-click the OVF / OVA file. Or choose " File» → « Importing configurations»In the Manager window. In the file dialog that appears, navigate to the file with the extension .ovf or .ova.

If VirtualBox can process this file, a dialog box similar to the following will appear:

It represents the virtual machines described in the OVF file and allows you to change the virtual machine settings by double-clicking the description items. Once you click " Import», VirtualBox will copy the disk images and create local virtual machines with the settings described in the dialog box. Then they will appear in the list of virtual machines in the Manager.

Please note that since disk images tend to be large and the VMDK images that come with virtual devices are usually sent in a special compressed format that is not suitable for direct use by virtual machines, the images will first need to be unpacked and copied, which can take several minutes.

Conversely, for export virtual machines that you already have in VirtualBox, select " File» → « Export configurations". Another dialog will appear that allows you to merge multiple virtual machines into an OVF appliance. Then select the location where the target files are to be saved and the conversion process will begin. This may take some time.

Note: OVF cannot describe the snapshots that were taken for the virtual machine. As a result, when exporting a virtual machine with snapshots, only the current state of the machine will be exported, and the disk images in the export will have a flattened state identical to the current state of the virtual machine.

Global settings

The global settings dialog can be found in the menu “ File"By selecting the item" Settings….»It offers a set of settings that apply to all virtual machines the current user or, in the case of extensions, for the entire system:

  • General... Allows user to specify default folder / directory for VM files and VRDP authentication library.
  • Input... Allows the user to specify a Host key. It is used to switch the cursor out of focus of the virtual machine or host operating system windows, and is also used to start certain actions virtual machine.
  • Updates... Allows the user to specify various parameters automatic updates.
  • Language... Allows the user to specify the language of the graphical user interface.
  • Display... Allows the user to specify the screen resolution as well as its width and height.
  • Network... Allows the user to configure host-only networking information.
  • Plugins... Allows the user to view and control installed packages extensions.
  • Proxy... Allows the user to configure an HTTP proxy server.

To create VMware backups in Handy Backup two methods can be used: internal and external.

Internal method

A copy of Handy Backup is installed on a VMware virtual machine running Windows or Linux. Using Handy Backup on a virtual machine is no different in principle from using a similar solution on "physical" computers.

External method

Handy Backup runs on a VMware virtual machine server to back up images of specific copies of VMware as regular files... Handy Backup uses a special plug-in for backing up VMware machines and arrays, which works in "hot" mode (without stopping VMware machines).

How to save an image of a VMware virtual machine

Copying the VMware backup image is performed using a specialized tool. Stopping the copied VMware machine and restarting it for a cold copy can also be achieved using the VMware plugin settings.

  1. Open Handy Backup and create new task by pressing Ctrl + N or by selecting a menu item. Select a backup task.
  2. In Step 2, select the plugin " VMware Workstation ".

  1. Double click on the “New Configuration” line to select a configuration for accessing VMware.
  2. In the dialog that opens, make a choice between the modes " Hot"(backup without stopping the machine) and" Enable suspend"(with stopping the virtual machine to get its exact image).

  1. Then select in the dialog specific image machine to which this configuration will be applied.

  1. Click "OK" and continue creating the task as usual.

The above sequence of actions will stop and then restart VMware virtual machines without any additional intervention.

Operating system reinstallation or change computer device does not mean the end of work with the installed guest OS in the program. However, an exception may be the case when files hard drives virtual machines are on system disk computer, and the system itself cannot be restored after a critical failure. To continue working with the existing guest OS while maintaining their state, but already 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 in the future. Another option to continue working with existing guest operating systems is to add new virtual machines based on the existing files on their hard drives. We will consider all these processes below.

1. Universal file format for exporting virtual machines

The configuration of the existing VirtualBox virtual machine is exported to the file " .ova". The .ova file (Open Virtual Appliance) is universal file storage of virtual machine data that can be used in various programs for virtualization of operating systems. It , . The virtual machine exported to this file can then be imported by both VirtualBox and VMware Workstation or Microsoft Hyper-V within the framework of 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 on the main Windows system.

2. Exporting a virtual machine

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

In the next window, click " Next».

Configuration export is possible only when the virtual machine is off, and if it is suspended, VirtualBox will offer to reset the saved state to continue the process.

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

In the next window, click " Export».

We are waiting for the completion of the export process.

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, v cloud service... Or you can leave, as in our case, in place - on a non-system disk, where this file will be stored during Windows reinstallation.

3. Importing a virtual machine

After installing VirtualBox on new windows or on another computer, open the program and in the menu " File"Choose" Importing configurations».

In the next window, specify the path to the ".ova" file with the exported virtual machine. We press " Next».

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

We are waiting for the completion of the import process.

Then we will see the imported virtual machine in the list of VirtualBox machines. What is left now is to start the car.

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

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

Alternative to Export and Import Virtual Machine - Add new car from existing file hard disk VirtualBox " .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 disk, when reinstalling Windows on physical computer you don't even have to waste time exporting the configuration. The ".vdi" file stored on the system disk can simply be transferred to non-system disk... By by and large, the process of exporting and importing a virtual machine wins only by saving the space occupied by the ".ova" file. For example, in our case, a virtual machine was exported with a Windows XP guest OS installed, and the weight of the ".ova" file in the output was 4,11 GB. While the size of the hard disk file ".vdi" of the same system is 10 GB.

Such a space saving benefit may be relevant in the case of transferring a virtual machine to another computer using cloud storage or removable media with limited size... In our case, when it comes to reinstalling Windows, the method of adding a new machine from an existing VirtualBox hard disk file is quite suitable.

Launch VirtualBox and click “ Create».

We set the indicator of RAM. We press " Next».

In the hard disk selection window, select the parameter “ Use existing HDD ", Use the browse button to specify the storage path for the" .vdi "file. We press " Create».

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

The guest OS will start exactly in the state in which it was saved in last time work 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 disk on the computer, if it was originally created on the system disk, and over time, the space it occupied began to degrade 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 choose “ Delete».

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

After that, you can search for the hard disk file ".vdi" on the system disk (as a rule, by default, this is the path C: \ Users \ Username \ VirtualBox VMs), transfer it to a non-system disk and add the virtual machine again.

Did this article help you?