I’ve attached a 10M sized (virtual) disk through USB drive interface in UTM, in the host VM it appears as /dev/sda and I’ve partitioned using the host to have 1 4M partition, I then try to add the device to a privileged container (partprobing doesn’t work in unprivileged container) and run a few of commands:
root@c1:~# ls -a /dev/sd*
/dev/sda
root@c1:~# partx -vd /dev/sda
partition: none, disk: /dev/sda, lower: 0, upper: 0
/dev/sda: partition #1 removed
root@c1:~# partx -va /dev/sda
partition: none, disk: /dev/sda, lower: 0, upper: 0
/dev/sda: partition table type 'dos' detected
range recount: max partno=1, lower=0, upper=0
/dev/sda: partition #1 added
root@c1:~# ls /dev/sd*
/dev/sda
I can see the partitions in lsblk but cannot find a way to use them. Would it be possible to access the partitions easily instead of just the attached unix-block device?
My use case involves utilizing the Armbian build scripts to generate an SD card image for a development board. Additionally, this development board has its own dedicated build scripts.
Both sets of build scripts appear to rely on Unix block devices, and neither is able to automatically detect device partitions when executed within an Incus container.
However, both sets of scripts run successfully within a Docker container;
I’m curious—how exactly do Docker containers automatically detect these partitions?
Thank you for sharing, I’m not sure of the mechanisms, but I wrote a little hacky script for now to add or remove the a device and its partitions, it relies on the container having sfdisk with --json flag and jq installed (I picture it could be adjusted to work with more barebones utils but I didn’f have the time):