[SOLVED] VM only boots from USB key, but not from identical lvm-thin logical volume connected with virt-io or sata

Andreas S.

Member
Sep 30, 2020
8
3
8
48
Hi Proxmoxians,

I have created a Linux VM based on HiveOS (which is based on Ubuntu 16.04). The installer image is meant to written to a USB key, which I have done. I passed the USB key to the VM and it's booting and working fine.

Of course I don't want to use the USB key forever now. Hence, I created (first with virt-io scsi, second with SATA) a thin-lvm volume to copy over the content of the USB key. \[The documentation describes exactly to this\]([https://hiveos.farm/guides-hdd\_move/](https://hiveos.farm/guides-hdd_move/)), which I have done for my Proxmox host: `dd if=/dev/sdd bs=4M of=/dev/mapper/pve-vm--100--disk--0 count=2560` (The USB key's partition is 7G, the target volume 10G, the count is one below the last try which ended with target full error).

This are the relevant disks:
```
# EFI partition
Disk /dev/mapper/pve-vm--100--disk--1: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 65536 bytes / 65536 bytes

GPT PMBR size mismatch (14745599 != 61439999) will be corrected by write.

# the USB key
Disk /dev/sdd: 29.3 GiB, 31457280000 bytes, 61440000 sectors
Disk model: USB Stick 32 GB
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 75EC96FF-FEA6-4E82-8270-2359AA33BF56

Device Start End Sectors Size Type
/dev/sdd1 2048 43007 40960 20M Microsoft basic data
/dev/sdd2 43008 45055 2048 1M BIOS boot
/dev/sdd3 45056 126975 81920 40M EFI System
/dev/sdd4 126976 14745566 14618591 7G Linux filesystem

# the targe thin-lvm volume, which I want to boot from
Disk /dev/mapper/pve-vm--100--disk--0: 10 GiB, 10737418240 bytes, 20971520 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 65536 bytes / 65536 bytes
```

And the PVE qemu config `/etc/pve/qemu-server/100.conf`:
```
agent: 1
balloon: 512
bios: ovmf
boot: order=sata0
cores: 2
efidisk0: local-lvm:vm-100-disk-1,size=4M
hostpci0: 09:00,pcie=1
machine: q35
memory: 2048
name: orca-hiveos
net0: e1000=BE:1D:14:1B:25:C9,bridge=vmbr0,firewall=1
numa: 0
ostype: l26
sata0: local-lvm:vm-100-disk-0,discard=on,size=10G
scsihw: virtio-scsi-pci
smbios1: uuid=802e3aa8-0905-47e6-b3f5-7e723194c42d
sockets: 1
vga: qxl
vmgenid: 697d4e00-fa69-47cf-a3e7-9b4a1cd9a70e
```

When I boot, then I reach the Grub boot menu. Then I get a blank screen with a cursor, where it stops. It's running Proxmox 6.4, which is a clean install from two days ago.

I am running out of ideas. Any idea what I could try?
 
I got an pointer from somebody else. Just to document what had been the reason and how it finally worked:

Inspecting the partition tables from within the VM turned out: the thin-lvm clone had been missing some partitions. Really don't understand why though. ¯\_(ツ)_/¯

I opened fdisk for the USB key, wrote out the partition table with O.

Then I opened thin-lvm partition with fdisk and also wrote out the partition table with O.

Copied over the partition lines from the USB key file into the other one. Opened the thin-lvm partition again with fdisk and loaded the partition table file with I. Wrote it to the partition with w. Now I had the same partitions on the thin-lvm partition.

Finally copying over every single partition with dd. I found grub had been configured with the OS partition's UUID. This had been copied as well. Hence, nothing more to do than to reboot. :)

Now it works. :)
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!