Hello,
I am messing around with the idea of mounting a ZVOL inside an app container so that I can format it with the xfs filesystem for use with rustfs. I created custom app and used the device: specification to mount the zvol that I created in TrueNAS within the container. I attached to the container via the shell and was able to format the zvol with ext4 successfully. When I tried to format it as an xfs filesytem I wasn’t successful because xfs wanted to change the block size to 4096 but could not.
There was no way I could find in the UI to change the default block size for the ZVOL so that xfs would just work like ext4 did.
BTW, after I formatted the ZVOL as a ext4 filesystem I then was able to use it as a volume in a subsequent app and mount it. It worked as expected as an ext4 filesystem.
This would be an interesting capability to have for the apps whereas apps like rustfs which prefers an xfs filesytem layer would see the ZVOL as a block device formated with the xfs filesystem.
Thanks for reading and I would be interested if anyone has attempted something similar? I’d rather not have to use iscsi as the app is natively running on TrueNAS and the ability to simply mount the formated ZVOL into the app container would be really cool. Thanks again.
Oh yeah. Here’s my simple custom app that allowed me to format the zvol as ext4. I shelled in and did it manually, but you could add another RUN line to do the formatting of the /dev/test-vol device.
name: test-app
networks:
admin-net: {}
services:
linux-container:
build:
context: .
dockerfile_inline: |
FROM docker.io/ubuntu:latest
RUN apt update
RUN apt install -y xfsprogs
entrypoint: sleep infinity
networks:
- admin-net
devices:
- /dev/zvol/data/test-vol:/dev/test-vol
You could then later mount the volume in another app with the volume: declaration as follows (this is for ext4):
volumes:
test-app-vol:
driver_opts:
device: /dev/zvol/data/test-vol
type: ext4
-D