View live file system of Multipass VM using LXD driver externally

,

I am using Multipass on a Raspberry Pi with LXD driver to launch virtual machines (VMs). Given my setup, I need to view the live changes / updates that happen in the virtual machine on the host, i.e, externally from the virtual machine. The current way I can do this is by unmount and mount the VM image file (.img file) from time to time which is not ideal.
Is there a way of doing a real time follow up on the changes with the .img file?

What is it you are looking to monitor inside the VM?

For now I want to monitor the /var/log and home directories but i don’t want to use multipass shell since it uses SSH and a log is generated.

If you’re running the lxd-agent inside the VM then you could do lxc exec <instance> -- <cmd> <args>

1 Like

Or to copy a file lxc file pull <instance>/path/in/vm /path/on/host

That’s it. Thanks.

Is there a way when running for example lxc exec <instance> -- tail -f /var/log/auth.log the process not being showed inside the instance when doing ps or something similar? I know about hidepid but I only would like to hide any lxc exec process inside the instance.

Sadly no. ps and similar tools read through /proc and /proc shows all the processes inside of that PID namespace.

Part of attaching to a container is attaching to its PID namespace and so a result of it is your process being visible inside it.