Hot backup and restore of virtual machines in Hyper-V Server 2019

Introduction

I was wondering how to back up my home mackerel virtual machine. You can easily do this by using the following method.

environment

Backup of the main unit

There seems to be no choice but to clone it regularly with Filezilla. I thought, but it seems that it can be done in the same way.

wbadmin ** With this method, you can only restore to the exact same hard disk that you backed up. It cannot be restored to another because the storage is corrupted. ** ** At least I have a backup. If you want to save to a remote network disk Save your logon credentials with cmdkey /add 192.168.1.xx / user: username / pass: password.

--"Practical Hyper-V 2016 backup procedure (backup to external HDD) --Koshizo's solo feeling system" https://www.hitoriit.com/entry/2018/08/04/111312

--"Easy Windows Server Backup Recovery Procedure (Windows Server 2016 OS Restore Procedure)" https://www.hitoriit.com/entry/2018/04/04/145424 --"Easy Windows Server backup recovery procedure (Windows Server 2012R2 OS restore procedure acquired in shared folder / NAS)" https://www.hitoriit.com/entry/2018/09/05/080200 --"Reliable Windows Server 2019 backup procedure (backup to external HDD)" https://www.hitoriit.com/entry/2019/02/26/080200 Let's do it later.

Other

Otherwise, I tried using EaseUS Todo Backup Server with Microsoft Hyper-V Server 2016.

Creating a virtual machine

Drop the iso

Download it like wget. [^ 3]

Invoke-WebRequest -Uri http://releases.ubuntu.com/18.04/ubuntu-18.04.3-live-server-amd64.iso -OutFile C:\dl\ubuntu-18.04.3-live-server-amd64.iso

Create

Create a network etc. as shown in the image below (not sure if it is essential) image.png

image.png

OS installation

Install it. I set / boot to ext4 and the others to xfs. Here, the username is hani and the password is passwd2020.

Also, install docker [^ 2] and put the nginx container.

sudo su
apt update
apt install curl
curl -fsSL https://get.docker.com/ | sh
docker create -P --name nginx bitnami/nginx:latest
docker start nginx 

installation of hyperv-daemon

For hot backup, the guest must have a daemon.

wget http://ftp.jp.debian.org/debian/pool/main/l/linux/hyperv-daemons_5.3.15-1_amd64.deb
dpkg -i hyperv-daemons_5.3.15-1_amd64.deb
reboot

Preparations are now complete. Leave it running.

backup

Find a virtual machine to back up

After logging in with Remote Desktop from Server Manager, view the VM list with cmd.exe. [^ 4]

wbadmin get virtualmachines
C:\Users\Administrator>wbadmin get virtualmachines
wbadmin 1.0 -Backup command line tool
(C) Copyright Microsoft Corporation. All rights reserved.

VM name: ubutest1
VM caption: Online\ubutest1
VM identifier: 01CC1042-D20F-4F6B-BA4A-4A821F010709

VM name: Host Component
VM caption: Host Component
VM identifier: Host Component

Find the backup destination storage

C:\Users\Administrator>wbadmin get disks
wbadmin 1.0 -Backup command line tool
(C) Copyright Microsoft Corporation. All rights reserved.

Disk name: SUNEAST SSD SE800 mSATA 128GB
Disc number: 0
Disk ID: {16bd9aaaafbb}
Total area: 119.24 GB
Area of use: 44.51 GB
volume:EFI system partition[(volume ラベルなし)],D:[]

Disk name: JMicron Tech SCSI Disk Device
Disc number: 1
Disk ID: {8cfa6aaaa00}
Total area: 111.79 GB
Area of use: 14.11 GB
volume: E:[boot],C:[os]

Disk name: EVTRAN E 26S SCSI Disk Device
Disc number: 2
Disk ID: {8cfaaaaaaa}
Total area: 118.00 GB
Area of use: 3.98 GB
volume: F:[volume]

backup!

Execute cmd.exe as follows (f: is the SSD to be backed up, ubutest1 is the virtual server to be backed up)

wbadmin start backup -backupTarget:f: -hyperv:ubutest1

image.png

image.png

You can back up like this.

restore

Plug the USB storage into your PC.

View backup list

Check the backup contents. (I was backing up twice.)

C:\Users\Administrator>wbadmin get versions
wbadmin 1.0 -Backup command line tool
(C) Copyright Microsoft Corporation. All rights reserved.

Backup time: 2019/12/31 20:59
Backup target: 1394/USB disk labeled volume(F:)
Version identifier: 12/31/2019-11:59
Recoverable:volume,File,application,Virtual machine
Snapshot ID: {ea92ce78-9d8c-4461-a292-d63cd2013e82}

Backup time: 2019/12/31 22:59
Backup target: 1394/USB disk labeled volume(F:)
Version identifier: 12/31/2019-13:59
Recoverable:volume,File,application,Virtual machine
Snapshot ID: {3c5521e7-eab2-4604-8417-ba86337b4fe1}

Check the details of the backup to be used.

wbadmin get items -version:"Version identifier"
 PS C:\Users\Administrator\Documents> wbadmin get items -version:12/31/2019-13:59
wbadmin 1.0 -Backup command line tool
(C) Copyright Microsoft Corporation. All rights reserved.

Volume ID= {8cfa60d6-0000-0000-0000-107d00000000}
volume'os'、C:Mount on
Volume size= 109.83 GB
Recoverable=Selected file

application= HyperV
VM name: ubutest1
VM caption: Online\ubutest1
VM identifier: 01CC1042-D20F-4F6B-BA4A-4A821F010709
Total size: 3.20 GB

 PS C:\Users\Administrator\Documents>

Turn off the server (for experimentation)

Turn off the server. Because it's a restore test.

(With powershell)

Stop-VM ubutest1 -Force
Remove-VM ubutest1

restore!

I will try to restore it.

PS C:\Users\Administrator> wbadmin start recovery -version:12/31/2019-13:59 -itemtype:hyperv -items:ubutest1
wbadmin 1.0 -Backup command line tool
(C) Copyright Microsoft Corporation. All rights reserved.

warning:A virtual machine trying to recover to another location is backed up from this host
If so, this operation causes the original virtual machine(If it still exists)
Will be deleted and overwritten.

You have selected to recover the application HyperV.
The following components will be recovered:

warning:Virtual machine does not start if network settings are different after recovery
It may be. Hyper after recovery is complete and before booting-V manager
Use to check the virtual machine's network settings.

VM name: ubutest1
VM caption: Online\ubutest1
VM identifier: 01CC1042-D20F-4F6B-BA4A-4A821F010709

Do you want to recover the application HyperV??
[Y]Yes[N]No y

Component to recover ubutest1(Online)Preparing...
Component ubutest1(Online)While recovering files(3%)I copied.
Component ubutest1(Online)While recovering files(17%)I copied.
Component ubutest1(Online)While recovering files(26%)I copied.
Component ubutest1(Online)While recovering files(37%)I copied.
Component ubutest1(Online)While recovering files(47%)I copied.
Component ubutest1(Online)While recovering files(57%)I copied.
Component ubutest1(Online)While recovering files(68%)I copied.
Component ubutest1(Online)While recovering files(78%)I copied.
Component ubutest1(Online)While recovering files(91%)I copied.
Component ubutest1(Online)While recovering files(100%)I copied.
Component ubutest1(Online)Is recovering.
Component ubutest1(Online)Has been restored normally.
The recovery operation is complete.
Log of successfully recovered files:
C:\Windows\Logs\WindowsServerBackup\ApplicationRestore-31-12-2019_14-09-18.log

Overview of recovery operation:
---------------

Component ubutest1(Online)Has been restored normally.
PS C:\Users\Administrator>

Erase backup

Other

Run this command to dismiss the "Enable user credential delegation?" Dialog. [^ 1]

image.png

This dialog probably has the wrong account.

! "Connecting to Hyper-V with Credentials in Hyper-V Manager" [image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/ 245977 / e0596498-6e35-8eb7-87d7-213257a09bb4.png)

If "This feature is not available in a portable workstation environment."

[192.168.~~~~]: PS C:\dl> wbadmin start backup -backupTarget:C:\bpdir -hyperv:ubutest1
wbadmin 1.0 -Backup command line tool
(C) Copyright Microsoft Corporation. All rights reserved.

error-This feature is not available in a portable workstation environment.

I wonder what this is, it may be because I put os in Usb in this environment. [^ 5]

The cause may be a misidentification of the Windows To Go environment. (Omitted) I think this can be avoided by deleting the following registry value or setting the data to 0 and restarting Windows. Key: HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Control Name: PortableOperatingSystem

Change the above registry on the remote desktop to shutdown / r.

regedit

I set it to 0. image.png

Backup fails

Backup to the same storage is not possible. [^ 6] It can only be saved in the * root * folder of another storage.

C:\Users\Administrator>wbadmin start backup -backupTarget:C: -hyperv:ubutest1
wbadmin 1.0 -Backup command line tool
(C) Copyright Microsoft Corporation. All rights reserved.

Getting volume information...
When performing a backup, the virtual machines included in the backup
It may be temporarily saved.
This will cause HyperV\ubutest1 is C:Will be backed up to.
Do you want to start the backup operation?
[Y]Yes[N]No y

C:The backup operation to is started.
Creating a shadow copy of the volume specified for backup...
Overview of backup operation:
-----------------------

Stopped before the backup operation was completed.
Stopped before the backup operation was completed.
Error details:Failed to snapshot the critical volume of the component.
Log of successfully backed up files:
C:\Windows\Logs\WindowsServerBackup\Backup-31-12-2019_11-39-57.log

Log of files that failed to back up:
C:\Windows\Logs\WindowsServerBackup\Backup_Error-31-12-2019_11-39-57.log

error-There was an error operating the shared restore point(0x8100010c)
There are no valid components or volumes to take a snapshot.


Failed to snapshot the critical volume of the component.

C:\Users\Administrator>

\Windows\Logs\WindowsServerBackup\Backup_Error-31-12-2019_11-39-57.log



Writer error
Writer Id: {66841CD4-6DED-4F4B-8F17-FD23F8DDC3DE}
Instance ID: {44EAD40E-A64B-49AE-A808-7BCDF3B91B45}
Writer name: Microsoft Hyper-V VSS Writer
Lighter condition: 0
Error result: 81000112
Application results: 0
Application message: (null)
component: 01CC1042-D20F-4F6B-BA4A-4A821F010709
Logical path: 
Component results: 8100010F
Component message:The component reports the path of the excluded volume.(0x8100010F)
*-----------------------------*
Application backup
Writer Id: {66841CD4-6DED-4F4B-8F17-FD23F8DDC3DE}
component: 01CC1042-D20F-4F6B-BA4A-4A821F010709
subtitles: Online\ubutest1
Logical path: 
error: 8078001D
Error message:Finished before the operation was completed.
*-----------------------------*

\Windows\Logs\WindowsServerBackup\Backup-31-12-2019_11-39-57.log


Application backup
*-----------------------------*

Launch the virtual machine and check

I got it. image.png

reference

I did it along this. https://yun-craft.com/software-crafts/hyper-v-server-2016-6#4

Relation

--"Practical Hyper-V 2016 Backup Procedure (Backup to External HDD)" https://www.hitoriit.com/entry/2018/08/04/111312 --"Note: Schedule a Windows Server backup from the command line" https://yamanxworld.blogspot.com/2016/10/windows-server.html

[^ 1]: "Connect to Hyper-V by specifying credentials in Hyper-V Manager" https://www.vwnet.jp/Windows/WS16TP2/HVMan/Credential.htm [^ 2]: "Installing Docker" http://docs.docker.jp/linux/step_one.html [^ 3]: "I want to download a file like wget with PowerShell" https://tech.guitarrapc.com/entry/2013/07/09/220710 [^ 4]: "Using Hyper-V and Windows PowerShell" https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/quick-start/try-hyper-v-powershell [^ 5]: "This function cannot be used in a portable workstation environment" and the backup function cannot be used. Https://answers.microsoft.com/en-us/windows/forum/windows_10-update-winpc/%e3%81%93%e3%81%ae%e6%a9%9f%e8%83%bd% e3% 81% af / 65800 e93-03de-42df-81d0-4990c44a1136

Recommended Posts

Hot backup and restore of virtual machines in Hyper-V Server 2019
Incremental backup of Linux (restore)
Screenshots of Megalodon in selenium and Chrome.
Separation of design and data in matplotlib
Summary of modules and classes in Python-TensorFlow2-
Project Euler # 1 "Multiples of 3 and 5" in Python
Create a Django project and application in a Python virtual environment and start the server