Mounted USB drive doesn't work after savevm/startvm

Discussions about using Linux guests in VirtualBox.
Post Reply
ambarish
Posts: 8
Joined: 31. Mar 2013, 00:52

Mounted USB drive doesn't work after savevm/startvm

Post by ambarish »

VirtualBox version: 4.2.18 r88780
Host: Win7x64 SP1
Guest: Fedora 19 (Linux 3.11.1-200)

I have a USB external hard-disk passed through to the guest, with an ext4 filesystem mounted inside the guest. After I do a savevm/startvm, the hard-disk no longer seems to be readable inside the guest; any access results in filesystem-errors. A unmount/mount fixes the filesystem.

1. Is this behaviour expected, that when I save/restore a VM, passthrough USB devices may not "work"?
2. If this is expected, one work-around I was thinking of was to unmount the drive inside the guest upon savevm. Is there any sort of signalling/event mechanism between VirtualBox and a Linux guest? I'm a VirtualBox newbie; I don't know if I'm making any sense here.
frank
Oracle Corporation
Posts: 3362
Joined: 7. Jun 2007, 09:11
Primary OS: Debian Sid
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Linux, Windows
Location: Dresden, Germany
Contact:

Re: Mounted USB drive doesn't work after savevm/startvm

Post by frank »

Yes, this is expected behavior. When you save the VM state, all USB devices are detached from this VM by force. After you started the VM from this saved state, all USB devices will be re-attached to the VM. The same would happen if you suspend your host computer, detach the hard disk, start the host computer and re-attach the hard disk. VirtualBox does not save the list of attached USB devices as part of the saved VM state. Therefore all USB devices are always detached before saving the state and re-attached after starting the VM from the saved state.
ambarish
Posts: 8
Joined: 31. Mar 2013, 00:52

Re: Mounted USB drive doesn't work after savevm/startvm

Post by ambarish »

Thanks! Is there then an eventing/signalling mechanism that the guest receives prior to a savevm, which it can respond to and unmount the drives automatically? I'm a developer and am happy to write a bit of code if required.
Post Reply