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 🙂

Recreating a Lost or Removed EFI Windows Boot Partition (Repair Windows Boot)

Wednesday, January 29th, 2020

Recreating a Lost or Removed EFI Windows Boot Partition

In case you remove an SSD with a Windows Boot Partition that boots an installation of Windows, you'll need to recreate the boot system to be able to successfully boot again.  To recreate the boot EFI partition on another drive or partition, perform the following:

1) Create or use an existing Windows installation disc or flash drive (you can use Rufus USB to format a flash drive with a Windows ISO)
2) Boot PC using your Windows installation media (a CD, DVD, flash drive, etc containing Windows installation files)
3) Press SHIFT + F10 on the first screen to bring up Command Prompt
4) Run the following commands and click Enter each time at Command Prompt:

diskpart
list disk
select disk N (N refers to the disk which contains the deleted the EFI System partition)
list partition
create partition efi size=200
format quick fs=fat32
list partition
list volume (find the volume letter which belongs to the installed Windows OS)
exit (exit diskpart)
bcdboot M:\windows (M refers to the volume letter of installed Windows OS)

Add any additional Windows installations by repeating the bcdboot command followed by the installation path for any other Windows installations you want added to the menu.  For example, I added my Windows 7 partition using the below command:

bcdboot P:\windows

You should now be able to boot Windows again without needing the old boot partition or drive.

Instructions were modified from this post.