Add an existing drive to VM

proxmoxThere are probably a number of scenarios when you might want to do this. Perhaps an obvious one is when you rebuild a Proxmox node, and want to recreate VMs using existing hard drives. This article describes the procedure.


SSH access

We will start by accessing the node using SSH.

 

Where is the virtual hard drive?

Now we need to locate the virtual hard drive.

Assuming you have a VM with an ID of 101, the hard drive needs to be in the following location:

/your_path_to/images/201

 

Depending on which virtual disk format you chose the name of the virtual drive will be something like this:

vm-101-disk-0.qcow2

 

Create a new VM

Assuming that you know what was on this virtual hard drive, you can now create an appropriate VM (e.g. A Windows hard drive, won't work on a Linux VM).

When creating the new VM (with an ID of 101) you can simply create a new empty hard drive of say 1GB, because we are going to delete this after creating the VM.

 

VM Configuration File

Now we can edit the VM configuration file, so that Proxmox will see your old hard drive.

vi /etc/pve/qemu-server/101.conf

Add or edit the following line to match your virtual drive identified above.

unused0: local:101/vm-101-disk-0.qcow2

 

Add the drive

Finally you can log on to the Proxmox system and double click the hard drive that is now labeled as 'unused disk', and click Add.

 

Remove the 1GB drive

At this stage you can also select the 1GB hard drive created earlier and click Detach. This won't delete the file on the server, so you will need to use SSH once more to remove the temporary 1GB hard drive.

 

Thanks for visiting.