04 Accessing the host storage - sylirre/vmConsole Wiki

Overview

vmConsole provides access to the host storage over 9P file system (see relevant QEMU documentation). Once you have mounted the host storage inside the virtual machine, you will be able to access files like pictures, music, downloads, etc. Note that access is one way. Android OS or other applications cannot access file system inside vmConsole environment.

You must manually grant the storage permission to the vmConsole through Android system settings. Once done, application must be fully closed and opened again, otherwise QEMU will continue to run with old settings without storage access bridge.

Android 10 scoped storage limits

A scoped storage has been implemented in Android 10 and higher for privacy reasons. This was done to limit applications access to shared storage on low level and force them to use privacy-friendly APIs like Storage Access Framework. For applications that require access to all files, there has been implemented additional permission. Unfortunately, publishing the application with such permission leads to bureaucracy hassle with submission of declaration (explanation why is needed, steps to verify permission usage, etc) to Google specialists.

Play Store build of vmConsole has been opted-in for scoped storage and will not use more privileged permission (MANAGE_EXTERNAL_STORAGE). As result, vmConsole will not be able to read non-media files like TXT or PDF, but will be able create new files or read media (images, music, videos).

GitHub edition of vmConsole will not have this limit.

How to mount shared storage

Assuming that vmConsole is granted storage access permission, you can run these commands as root and have shared storage mounted:

mkdir -p /mnt/host
mount -t 9p -o trans=virtio,msize=262144 host_storage /mnt/host

To access the mount point as a non-root user, you will need to add it into a group with appropriate GID. Run ls -l /mnt/host to explore file ownership on shared storage.

It is recommended to have this entry in fstab:

host_storage    /media/host     9p      trans=virtio,msize=262144 0 0