I'm running several Docker Compose containers on my Ubuntu server and I use an external HDD mounted at `/mnt/media` for storage. Occasionally, this HDD gets disconnected, which causes all the container mounts to fail. When the drive reconnects, Docker continues to write to `/mnt/media`, filling up my internal storage and locking the system. After I notice this issue, I have to unmount the external HDD, clear the residual data from `/mnt/media`, remount the HDD, and reboot the system. What is the proper way to handle or prevent this situation? I'm not very experienced with Linux, so any advice would be appreciated!
1 Answer
To prevent these issues with your external HDD, consider avoiding using it for important Docker services. If you have to use it, ensure Docker is set up to fail safely. One suggestion is to add a dependency in your Docker service configuration that makes it stop if the external drive isn’t mounted properly. This way, it won’t fill your internal storage. Just a heads up, external HDDs might not be the most reliable for server use.

Thanks for your insight! I thought using a DAS would be a good solution, but maybe I should explore more reliable internal connections like SATA.