I'm running Ubuntu Desktop 20.10 for my RPi 4 and have configured Plex to run on the intranet. I've got an externally powered 16Tb external hard drive with all the proper permissions to operate. The usage for this will be a media server in my vehicle (kids can watch media on long trips).
The entire system is somewhat automated. Power on the car and it supplies power to the RPi 4, router, and external hard drive. RPi 4 Boots Ubuntu, automatically logs in to username "pi", /dev/sda1 (Elements) mounts automatically, firefox opens to the plex server localhost. The system works as intended once.
What I'm running into:
The entire system is hard shutdown when the car turns off. Therefore, the External Hard Drive is never unmounted or ejected. The folder "/media/pi/Elements" becomes unreadable and locked in the directory. When the /dev/sda1 mounts on the next power up, the new directory of the folder becomes "/media/pi/Elements1". Plex then has the mapping of media in a different location and the system wont work.
In order to fix it, I have to ensure the External Hard Drive isn't plugged in, "cd" to the /media/pi directory, and run the "rm -R Elements" command and plug in the External Hard Drive again. I don't plan on having a dedicated screen, keyboard, and mouse in the car to reset this every time it happens unless I absolutely need to.
Is there a way to lock the /dev/sda1 to the "Elements" folder permanently or possibly remove the need to unmount/eject the drive so the external drive directory doesn't lock and corrupt?