Remove passthrough disk from VM

Nik2016

Member
Oct 25, 2016
19
0
6
44
Hi, I have a failing disk that needs to be replaced. It is attached to my NAS VM where I passthrough'd all the disks. There is no mention in the following article how to undo a disk passthrough:-

https://pve.proxmox.com/wiki/Physical_disk_to_kvm

Outside of unmounting the disk in the NAS VM, what else should I do to safetly remove the disk from the VM? I assume as it's not a virtual disk all the data would be intact and could be reattached to another VM. I can see in the proxmox GUI for VM's you get the option to detach any attached device, just uncertain if that is what I should do with a passthrough disk. Thanks for any help!
 
Detaching a disk will remove it from the VM config, thus not connecting it after a reboot of the VM (this is 'undoing' the passthrough). You can then exchange it with a new one. The data on the disk will remain untouched.

If you don't mind a bit of downtime for your disk replacement, you can shut down the VM, clone all data 1:1 from your failing drive to a new one, attach the new one and simply adapt the path for your passthrough in /etc/pve/qemu-server/<vmid>.conf to point to your new disk before restarting the VM. This way, the guest shouldn't even see any change to it's data.
 
Hello, I've a similar problem: I was running successfully FreeNAS in a VM, with LSI-3008 passthrough, everything ok.

Now I want to get rid off the FreeNAS and have the Proxmox do the ZFS/CIFS stuff - but removing the passhtrough of LSI-3008 and stopping the VM did not reveal the 8 SATA disks to the host o_O! I'm in the process of googling around how to refresh the PCI or re-reveal the disks, but I can't find anything.

To be clear: I don't see the disks in the lsblk listing => it's not a partitioning problem, the disks themselves are not visible to the host Debian.

I didn't try to reset the host so far, I would like to do it without rebooting it
 
I solved it running:

Code:
fdisk /dev/sdX

Then using w to write changes (but there are no changes).
After re-writting the partition table it re-sync the disks.

After that you can see the partitions on /dev

Probably there is a better solution!
 
I know the reply is old...

Was wondering the same thing, found 2 solutions

In VE 6.1-7 and probably newer
you can go to the "Hardware" tab under the vm
click on the drive you want to remove and click "Remove"

or from the Node Shell

qm set "VM_ID" -delete "Device_ID"

example

qm set 101 -delete scsi2


Not sure if the shell command is the proper way to unmount a hard drive but it works.
It is in the documentation for unmounting USB devices...
 

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!