Run image backup in hyper-v

I’m using server 2.5.1 beta on Windows and client 2.5.1 beta on Debian, the client successfully creates a VHD/VHDZ file and sends it to the server. My question is can I add this VHD file to boot up the Debian client in Hyper-V?

Another thing is that the VHD file is about the same size as the actual disk, it includes unallocated space. VHDZ doesn’t include unallocated space but that can’t be run in Hyper-V. Is there a way to make an image that doesn’t take up unallocated space and is able to run in Hyper-V?

I did a search on the forums but the only thing I found was this:

And this was in December 2016 so a lot could have changed since then, any help is appreciated very much!

Did you install partclone?

Running it directly is next-to impossible on Windows. It is a volume image, not a disk image. On Linux you’d have to do something like . Idk if there is something in Windows like the Linux DM.
The Hyper-V client backs up disk images, so that would be working…

If you are okay with a copy, maybe "C:\Program Files\UrBackupServer\assemble_disk_image.bat" works? That one also decompresses the vhdz…

Just installed partclone on the client, and when I select VHD instead of Compressed VHD it does a popup saying “Format for backup window wrong”.

I looked at the Backup Window under Client tab and it has the value “1-7/0-24”. Not sure what that means but when I change it to “1-7/0-24” it works.

Now the uncompressed VHD image is about the same size as the used space on the client, perfect, one problem solved.

I am not sure what assemble_disk_image.bat does, i assume it takes multiple VHD files onto one, But I only have one VHD in the backup. This is what my backup looks like:

It also transforms a volume vhd into a disk vhd (write the mbr).

I tried both using the batch file and manually typing in the command, both gives me this error:

2020-03-19 15:03:42: ERROR: No output file selected

This was the command I tried to run manually:

urbackup_srv.exe --cmdline --no-server --plugin fsimageplugin.dll --assemble "C:\urbackup\debian\200319-1435_Image_C\Image_C_200319-1435.vhd" --output_fn "C:\urbackup\debian\200319-1435_Image_C\output.vhd"

EDIT: nevermind, I got it working, just needed to press cancel after i selected it once.

EDIT2: Looks like it jumped from 3GB to about 7-8GB, which is the full space including unused space, just gonna transfer the file to see if it boots but there is no way to reduce it after assemble_disk_image.bat?

EDIT3: the VHD does not boot, blank screen with a blinking cursor top left, if I hold down shift while it is booting it displays “GRUB” along with the blinking cursor.

EDIT4: Just tried booting the rescue disk and selected the same backup image that i used before assemble_disk_image.bat, the image was written to the disk and when i try to boot it, I get the same blinking cursor. This suggests that something is wrong with the backup itself, before we even do assemble_disk_image.bat how could that be?

I followed the commands in this post:

It comes up with a bunch of errors while booting, but eventually it boots up. Is there a way to automatically do this instead of a live cd?

If you think the image is damaged… that could of course be, it is pretty new. See the testing section at Server 2.5.1 WIP/Client 2.5.1 WIP to confirm. Then I’d need the exact, complete software involved to be able to (hopefully) reproduce the problem.

W.r.t. to grub stage 1.5, it should already be fixed, I just need to test+release a new version.

I think the only problem with the image is grub, everything else does work, the startup is just a bit slower than normal. Here is the boot.log

Its the uuid causing problems, not a fatal error and the rest does work.

If the grub problem gets fixed in a newer release, my only problem now is that assemble_disk_image.bat makes it full size including unused space. The problem is that I’m planning to backup a 4TB Linux server, and allocating 4TB on the Windows server is just too much space. I just need a way to remove that space and be able to start it in hyper-v at the same time without using 4TB of actual space, any idea how?

But thank you very much for the help so far!

Two problems:

  • VHD has a 2TB limit, you’d need to backup to btrfs/ZFS/XFS/ReFS raw files (some of those file systems don’t have compression capability)
  • assemble_disk_image currently only understands used space for NTFS and for everything else it would use partclone, but I cannot find a Windows version of partclone.

I can convert the vhd to vhdx no problem on the windows server, as long as it doesn’t contain unused space, I can’t have 4TB available just temporarily.

I saw under the Administration Manual that it can assemble disks under Linux also, would it be possible to:

  1. Create full image backup
  2. Assemble during or right after the full image backup on the Linux client without sending to server yet
  3. Use Partclone on the Linux client to remove unused space
  4. Send bootable VHD file to server

This would of couse slow down the whole process and slow down the client, but if I setup the client to only backup during the night when its not used, it wouldn’t be an issue. Is this possible?

I managed to make it work like this:

  1. Install dattobd driver like normally
  2. use this command: dd if=/dev/datto0 of=/backups/sda1-bkp conv=sparse bs=1M this copies all data including unused space, but the conv=sparse makes it only be 5.2GB instead of the full 16GB. I assume this scales well when I try it with a larger disk.
  3. e2fsck -f sda1-bkp && resize2fs -M sda1-bkp This will actually reduce the size down to 4.6GB and ‘apparent size’ will be 7.6GB. The disk I am testing this on reports 5.4GB used with df -h so this is pretty good.
  4. I can use one of these to either create a vhd or vhdx:
    qemu-img convert sda1-bkp -O vhdx -o subformat=dynamic dest.vhdx
    qemu-img convert sda1-bkp -O vpc -o subformat=dynamic dest.vhd
  5. Now I can transfer the vhd/vhdx to a windows server and boot it in hyper-v, the only problem now is that grub is somehow broken and I have to live CD boot first, mount the disk and enter that grub-install command from before. However this also happened with the urbackup assemble_disk_image.bat, do you know how to fix it?