Automatic mounting of sdcard on boot

i am using torizon with sdcard being used to store data. i am using docker-compose file placed in /var/sota/storage/docker-compose/docker-compose.yml to automatically start the containers. i am using bind mount /media/card to pass the folder to docker container. To automatically mount the sd card i have added it to the fstab

/dev/mmcblk1p1       /media/card          auto       defaults,sync,auto,nofail,uid=1000,gid=1000  0  0

i wanted to know if this the recommended way to achieve mounting the sd card automatically or is there a better way ? i want the system to still be able to boot incase the sdcard is not present. therefore i have added the nofail option.

Greetings @nkj,

Your method here should be okay. I believe by default Torizon already auto-mounts most USB/SD drives. But if you need special handling/properties for your media drives then specifying this in fstab is probably the most straightforward way.

Just somethings to mention in case you’re not aware yet. If the SD card is going to be removed and re-inserted while the container is running, you’ll need to consider bind-propagation: Use bind mounts | Docker Documentation

Basically this will make it so that the USB mount-point will still be recognized by the container if it’s removed and reinserted after container start-time.

Best Regards,
Jeremias