Burn a VM disk from raw image

oknet

Member
Oct 13, 2022
36
1
8
Outside VE I write my image file directly into disk to obtain a fresh working linux machine:
Code:
dd if=myfile.img of=/dev/sdx

Is it possible to do the same using a mounted usb storage as source and a Virtual Machine disk as target ?
Pratically speaking, to create a VM (not yet started) with disk cloned from image.

Thanks
 
I've mounted my USB disk on /mnt/disk
I've created a VM with a 46GB scsi0 disk seen as: local-zfs:vm-100-disk-0,iothread=1,size=46G
then I issued the command
dd if=/mnt/disk/myimage.img of=/dev/rpool/data/vm-100-disk-0 status=progress
It completes without issues but disk vm-100-disk-0 is not bootable or mountable neither.....

What's wrong ?
 
Code:
fdisk -l /dev/rpool/data/vm-100-disk-0

Disk /dev/rpool/data/vm-100-disk-0: 46 GiB, 49392123904 bytes, 96468992 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 8192 bytes
I/O size (minimum/optimal): 8192 bytes / 8192 bytes

nothing more.

Well.... it seems no partition or anything written/created.....

Perhaps of=/dev/rpool/data/vm-100-disk-0 is a wrong target or syntax ?
 
/dev/rpool/data/vm-100-disk-0 is a link to /dev/zd0, which is a block device:

ls -l /dev/zd0
brw-rw---- 1 root disk 230, 0 Nov 29 09:52 /dev/zd0
 
fdisk -l /mnt/disk/pbx/fpbx.img

GPT PMBR size mismatch (488397167 != 83154943) will be corrected by write.
Disk /mnt/disk/pbx/fpbx.img: 39.65 GiB, 42575331328 bytes, 83154944 sectors
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: dos
Disk identifier: 0x00000000

Device Boot Start End Sectors Size Id Type
/mnt/disk/pbx/fpbx.img1 1 83154943 83154943 39.7G ee GPT
 
That image with that error works works flawlessly with dd if= of= to produce a working physical disk
I'll correct it anyway...
 

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!