[libvirt-users] Insert/eject USB

Martin Kletzander mkletzan at redhat.com
Wed Mar 8 09:43:31 UTC 2017

On Sat, Mar 04, 2017 at 01:14:39AM -0600, Leroy Tennison wrote:
>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'm probably misunderstanding what you want precisely.  What I
understood at first was that you just want to get some data back from a
VM before restoring it to a previous state.  And I wondered what's the
effort there since you can just use scp, rsync or just netcat =)

Reading the mail third time I think I got it, but I need you to confirm
so that I'm sure I did understand it right.  You probably want to have a
filesystem attached all the time, do stuff on the machine, have stuff
saved on that filesystem and then revert it without the aforementioned
filesystem being touched in any way.  And probably doing this multiple
times, that's why copying it every time is time-consuming in a long run.

>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.

How are you "reverting back" the state?  If you have a snapshot for the
machine you can specify which disks are supposed to be part of that
snapshot so that you can revert everything except one disk that you use
for some results, for example.  Would that be an option for you?

>Thanks for any input.
>libvirt-users mailing list
>libvirt-users at redhat.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvirt-users/attachments/20170308/1983ae55/attachment.sig>

More information about the libvirt-users mailing list