I have a container and wish to mount onto it a “virtual block device” i created on the host, so that it will look like I have an external drive on it.
So I do:
# on host, as root:
dd if=/dev/zero of=/opt/disk-01 bs=1M count=5000 # 5GB
mknod /dev/disk-01 b 7 200
losetup /dev/disk-01 /opt/disk-01
mkfs.xfs /dev/disk-01
chmod 666 /dev/disk-01
chmod 666 /dev/loop200
chmod 666 /opt/disk-01
incus config device add my-container disk-01 disk source=/dev/disk-01 path=/mnt/disk-01
# then, inside the container, as root:
ls -ald /mnt/disk-01
# output is: drwxr-xr-x 2 nobody nogroup 6 Jan 23 09:02 disk-01 # ie no one can write to it
chmod 777 /mnt/disk-01
# output is: chmod: changing permissions of '/mnt/disk-01/': Operation not permitted
So my problem now is that no one from the container can write to this mounted dir/device, and can’t find a way to make it writable.
How can I make /mnt/disk-01 writable by someone/anyone inside the container?
Thank you.