
List VirtualBox VM’s shared folders
In my current job we work heavilly with kubernetes clusters, working on a minikube master. As part of out internal toolkit for managing these, I needed to get a full list of the machine’s shared folders. Unfortunately – it seems that VirtualBox does not support this in their CLI tools, so I had to improvise. At first – I thought about listing the current mounts in the machine, but found that if a shared folder has invalid path – it will not be listed.
Then, I came up with this extremely hacky, but working method. With VBoxManage – you can get info for the VM:
$ VBoxManage showvminfo {vm}
........
USB Device Filters:
<none>
Available remote USB devices:
<none>
Currently Attached USB Devices:
<none>
Bandwidth groups: <none>
Shared folders:
Name: '--redacted--', Host path: '--redacted--' (machine mapping), writable, auto-mount
Name: '--redacted--', Host path: '--redacted--' (machine mapping), writable, auto-mount
Name: '--redacted--', Host path: '--redacted--' (machine mapping), writable, auto-mount
Name: '--redacted--', Host path: '--redacted--' (machine mapping), writable, auto-mount
Name: '--redacted--', Host path: '--redacted--' (machine mapping), writable, auto-mount
Name: '--redacted--', Host path: '--redacted--' (machine mapping), writable, auto-mount
Name: '--redacted--', Host path: '--redacted--' (machine mapping), writable, auto-mount
Name: '--redacted--', Host path: '--redacted--' (machine mapping), writable, auto-mount
VRDE Connection: not active
Clients so far: 0
..........
So this was close enough. All I needed was some filtering, in this case – awk
, a sprinkle of grep
, a pinch of cut
, and voila:
$ VBoxManage showvminfo {vm} |awk '/Shared/,/VRDE/' |grep 'Name' |cut -d"'" -f2
--redacted--
--redacted--
--redacted--
--redacted--
--redacted--
--redacted--
--redacted--
--redacted--
Of course – in the future the they might change the order of information – then you’ll need to replace ‘VRDE’ with whatever comes after the shared folders.
hax, hax, hax
Similar blog posts

Elasticsearch cheat sheet
Search Count AND query OR query Query with date range Multiple Queries Or a query inside a query Sort by a date containing field Query with regex Point In Time...
Odroid Sensors
Not long ago I bought an Odroid ARM based mini PC, and among many issues, turned out that the system uses some rather strange scheme for controlling the fan speed....
“Kubernetes network isn’t reliable”
Recently, while trying to figure out an extrelemly annoying problem I was having with Kubernetes – I stumbled upon this marvel of a github issue. So if you ever need...