[libvirt-users] Insert/eject USB

Leroy Tennison leroy.tennison at verizon.net
Sat Mar 4 07:14:39 UTC 2017


Is it possible to insert and eject a USB image in kvm/qemu/libvirt or 
are the only dynamically changeable devices cdroms and floppies?  I've 
searched the web and I'm either not looking for the right terms or it's 
obscure.  I should mention that I'm not talking about a connecting a 
physical host USB drive to a guest image, I want to be able to use a 
qcow image as the source.

The context is that I want to be able to revert a VM image back to a 
prior state (internal snapshot) when testing but be able to retain some 
data without having to go to the effort of transferring it across the 
network.  I've excluded cdroms as an option because they are read-only 
(correct me if I'm wrong on this) and require some effort to (re)build.  
Floppy drives appear to be limited to 1.44M which makes sense but is 
very limiting. Network mounts (NFS, Samba, etc.) require a server 
supporting the selected style of filesystem sharing over the network.  
I'm not sure I want to find out what happens to filesystem passthrough 
when a revert is done (unless someone knows and it's beneficial).

I tried creating a partition associated with the VM but not 
auto-mounted, even if I unmounted the partition before reverting its 
state was rolled back.  I possibly could get exotic here by setting the 
immutable attribute after unmounting the partition but, again, I'm 
hoping for something a little simpler and more straightforward.  If 
there's a workable option I haven't considered I'm open to that.

Thanks for any input.




More information about the libvirt-users mailing list