Accessing backing storage file from both Host machine and emulating machine when using USB Gadget - usb

I have an embedded machine that is running g_file_storage. I would like to be able to access the backing store in read only mode from the machine while g_file_storage is running and a host machine is dropping files into this backing store.
Any idea how one can achieve that? I know that it is not advisable, but would like to try it anyway, and I simply need read access. Won't need to modify the backing store while it is connected

Was able to achieve this by creating a script that listens to specific events in dmesg that signals that a user has dropped a file on the USB. When that is done we unmount the drive, mount it as a drive on the machine , grab the file dropped by the user then remount the drive as a mass storage device

Related

Accessing ext4.vhdx via another machine?

Is there anyway to mount or access the ext4.vhdx on another machine? I understand that accessing the linux environment files while WSL is running will likely corrupt them; but I want to be able to access this hard disk image when WSL is inactive?

How to access the windows subsystem for linux 2 filesystem from another computer?

I know that I can access the wsl2 filesystem by just opening \\wsl$ on the local computer. Can I somehow expose this to another computer in the same network? The goal is to just have a network drive on a remote computer where I drop files to copy them directly to wsl2.
EDIT: While it is not exactly what I wanted, I just noticed I can run a FTP server inside wsl2 and just transfer files in and out that way. I am still leaving the question open though as there might be a simpler solution to this.
You can find your home folder of wsl on c drive (its in AppData) and use ordinary windows folder sharing.
You can mount your network storage directly into WSL like in a particular Linux.
Example for Ubuntu and SMB: https://askubuntu.com/a/1050499

Where does the Host store the documents used in a Virtual Machine?

Is there a folder in the Host where the files used in the Guest are stored? Specifically, I refer to documents, text files et similia.
I found several posts about file sharing between the two OSs, but they do not answer this question. Actually, on the Host I found only the VM configuration files.
I mean, it is a VM, ok, but they have to physically stay somewhere on the Host HD! What if I want to access them without starting the WM?
My usual config:
W10 - Host;
Lubuntu - Guest.
It really depends on what kind of virtual disk you use VDI, VMDK, VHD, or HDD.
VDI is an issue. The only way i've found so far is to use a USB drive to copy things off and on, or create a network share.
If you're using VMDK, Vmware has a tool I believe is called VMware disk mount as a part of their VDDK, and you should be able to use it to mount VMDK disks as hard drives. https://developercenter.vmware.com/web/dp/sdk/55/vddk
Windows VHD is the easiest one to work with. You can use "Computer Management" on your windows PC to mount the VHD as an external drive using this tutorial. http://notebooks.com/2011/02/25/how-to-browse-and-copy-files-from-a-vhd-system-image-backup/
I'm really not sure about HDD.

How to effectively use a VirtualBox VM on multiple computers?

My IDE is Eclipse, running in Ubuntu 12.10 inside a VirtualBox VM. I currently work in two locations - one office has a Windows 7 PC, the other has a Mac. It seemed most efficient to move my VM onto a high-speed USB flash drive, then carry it between offices. It hasn't worked out.
I used the PC to copy the VM to the flash drive, and tested it there. It worked. I took it to the other office, plugged it into the Mac, started VirtualBox and tried to boot the VM. It said 'can't find drive at E:...' It expected a Windows drive location. So, I tried removing the disk from the VM and re-mounting it on the Mac. That resulted in a 'UUID already in use' error.
Is this transport method possible? I don't want to have to run sethduuid every time I change offices.
The VirtualBox configuration files contain paths for the virtual hard disks, so copying them to another host is problematic. The simplest solution would be to create two similar configurations, one on each host and just copying the disk file to the external flash drive. Configure the paths to the disk file on each host independently so they fit your platform.
The drawback is, that you have to maintain two configurations. But they shouldn't change that often anyway.
The UUID error happens, if try to add another disk image to the virtual media manager with a UUID that match an already existing disk image. This might be because you copied a disk image in the past without replacing the UUID. Check your disk files for duplicate UUIDs.

How do I get notified in my qt application about USB drive plugged in to the system

I am writing an application in Qt 4.6/4.7 on Ubuntu 10.04 where in I need to copy some files from the USB drive the moment it is connected to the system. The application while it is running, should be able to detect that a pen drive is inserted and without the user intervention, should look into the usb drive for specific file and copy it to the local drive. This should happen every time a new pen drive is inserted. is there any simple method which i can use? Pls suggest.
Thanks in advance
Mahesh
Consider the hotplug mechanism. With the hotplug the kernel sends events when hardware changes its state. Usually listening to the events implies the use of the /sbin/hotplug script, but a netlink socket is also provided. So you can listen to the socket, filter required events and handle them.
Here is a doc you can find a detailed explanation and a C code example.
You should use udev service and define a trigger which will launch your app depending on attributes of plugged device.