For SMART access I believe you’d need to both add unix-block device entries to your container for every device in /dev/ that you want to access and then possibly still make the container privileged on top of that as SMART likely relies on privileged IOCTLs to do the job.
Overall, if you can instead do this from the host, I think it’d be preferable.
I’d like to revive this idea, using a privileged container on Incus.
Reason for it is there are OCI container images out there with smart tooling, database and a webpage ready to go. I’d like to just ‘start’ one of those and build upon those efforts.
I had a go at running the scrutiny OCI image with this config
FWIW - I’ve been able to workaround running smartctl inside the privileged incus container.
The ‘scrutiny’ application that I want to use has a simple ‘collect metrics’ binary that I can invoke form the Host OS and point it back towards the container.
(this binary uses smartctl under the hood)
sudo /var/lib/incus/storage-pools/zfsp1/containers/scrutiny/rootfs/opt/scrutiny/bin/scrutiny-collector-metrics run --api-endpoint "http://10.98.112.139:8080"
(where 10.98.112.139 is the ipv4 address of the container)
I’d still be nice to understand how to make smartctl work inside a container. I think working this out could unlock some ideas with other OCI application containers.