Converting a Physical Disk To A
Virtual Disk In Proxmox
Description:
In this video Harvey shows you how to convert a physical hard disk to a Proxmox virtual disk quickly and easily. Why do this you may ask? This allows you to take full advantages of Proxmox features a few examples could be the snapshots, backups and template features. If you enjoyed the video please leave a like and consider subscribing to help us out. It is also Harvey’s Birthday week so please do consider donating! Thank you.
Links :
Discord Server: https://discord.gg/cWkxvtKaGx
Donations Page: https://hsve.org/donations-page
Commands :
Notice : Before replicating these commands watch the video first! We are not responsible for damage due to user error
The first following command runs a check on what disks are detected by the system and then lists the unique identifier for the disk for us to use later in this process.
find /dev/disk/by-id/ -type l|xargs -I{} ls -l {}|grep -v -E '[0-9]$' |sort -k11|cut -d' ' -f9,10,11,12
This second command we use to set the virtual machine up with the physical disk. This allows us to start the migration from Physical To Virtual (P2V) Replace the [VMID] parameter with the VMID of your virtual machine along with the ID of your disk which we extracted with the previous command.
qm set [VMID] -sata1 /dev/disk/by-id/[ID GOES HERE]
Later on in the video after we’ve converted the physical drive to a VHDX format we need to the convert it into the Proxmox format using the command below. Replace the perameters with the names respectively. Such as the [RAWVHDNAMEHERE] pareameter needs to be replaced with the correct file name. The same with [VMID] Replace this with the VMID of your VM
qemu-img convert -O qcow2 [RAWVHDNAMEHERE].VHDX vm-[VMID]-disk3.qcow2
qm rescan