Clone and Compress LVM Volume to Disk Image

Monday, August 25th, 2025

Clone and Compress LVM Volume to Disk Image

If you need to backup an LVM volume, you can do so by first turning off the virtual machine that is using the volume, and then you can use the dd and gzip utilities to create a copy of the volume to an .img file and compress the image file.  This compressed image file can then be transferred remotely over SSH or HTTP (for fastest results) to another server where it can be restored.

Need More Storage Space for the Backup Image (Optional)?

If you don't have enough storage space on the root LVM volume the main system uses on the host server to handle saving the backup image file to, you can always create a new LVM and then mount it on the host LVM file system to save it there.

These steps are optional:

1.  Create new hard drive in your vm pool using virt-manager and name it temp_storage – you don't need to setup the OS or continue creating the virtual machine

2.  Format and mount this new LVM volume (update vms with your pool's actual name – on my server, it is named vms):

mkfs.ext4 /dev/mapper/vms-temp_storage
mount /dev/mapper/vms-temp_storage /mnt/store

Copy and Compress the LVM

Use the below commands to copy your LVM volume to an img file.  Update the names and the paths as needed.

dd if=/dev/vms/name_of_lvm of=/mnt/store/name_of_lvm.img bs=8M status=progress
gzip name_of_lvm.img -1

Uncompressing and Restoring the LVM

Just decompress the image file and then use the dd command to restore the image to the LVM volume created on the target or restore server.

gunzip name_of_lvm.img.gz
dd if=name_of_lvm.img of=/dev/vms/restore-lvm-name bs=8M status=progress

And you're done 🙂

Invalid resx File Windows XP Only

Wednesday, May 24th, 2017

Invalid resx File in C# .NET Solution on Windows XP Only

If a c# application you've developed that targets the .NET Framework version 4.0 crashes on Windows XP but does NOT crash on Windows Vista through Windows 10, it is most likely due to an embedded resource issue (in one of the .resx files in the solution).  Upon opening the solution of my problematic program in Visual Studio 2010 on Windows XP, I received an error similar to the following:

Invalid resx file. Command completed successfully. Could not load type...

I fixed the issue by deleting one of my icon (.ico) files from the solution that was 256 x 256 pixels and replaced it with the same icon with a size of 255 x 255 pixels.  While a 256 x 256 pixel icon file is perfectly valid in newer versions of Windows, the maximum size of an .ico file can only be 255 x 255 on Windows XP x86 SP3.  I still target XP machines since I have a Netbook with it that will always be running XP.