This isn't really a blog post, it's just a set of errors I faced while building my homelab and steps I took to fix them. This is mostly for my reference if I need it in the future, but maybe it'll help someone else too. This will be a continuously updating list.
For now, my server is just a Headless Raspberry Pi 4B running Ubuntu Server 21.04 hooked up to 3TB of external HDD and all applications are being run as Docker containers.
Issue #1 : Accessing exFAT drives on Ubuntu
If you plan to use the hard disk for only a linux server, you're better off formatting it as EXT4 and using it. However, I needed the drive for my Mac and occasionally Windows too so I needed it to be exFAT. The issue with that is Ubuntu does not support exFAT out of the box, so it won't auto-mount to read or write.
To add support to Ubuntu to read exFAT install -
sudo apt-get install exfat-fuse exfat-utils
P.S - If you were like me and didn't know about the lack of exFAT support, what eventually helped me realise was reading the kernel buffer logs when you plugin the hard disk. To do this, unplug your hard disk and run -
This clears the Kernel ring buffer so when you plug it in you can see only the messages related to the DMA controller. After clearing the messages, plugin the hard disk again and run dmesg.
These messages told me it was unable to read the exFAT format.
Issue #2 : Running Docker volumes off an exFAT drive
Once I had my exFAT drive plugged in and mounted, I realised even after you install support for it, you can't change permissions after mounting using chown or chmod; a lesson I learnt after hours of tinkering with it as root and as different users.
By default, when the drive is mounted, it has permissions for owner (root) to rwx but group has only rx permissions and the rest have only r.
This led to an issue where docker containers with a volume attached pointed at a folder on the external hard drive were unable to write anything, even when running it with UID and GID of 000 (root ID)
Now my solution might not be the best out there, but it worked for me and I'm worried that any further tinkering will get it to stop working so for now this is what I have. By default, instruct the OS to mount the drive with 777 permissions. To do this -
- Run sudo blkid to get the UUID of your hard drive. For me, it was an eight character string of the format ABCD-EFGH.
- Unmount the drive using umount
- We need to edit the /etc/fstab file which has instructions to automate the mounting drives on boot. For good measure, take a backup of the file using
cp /etc/fstab /etc/fstab.bak
- At the end of the /etc/fstab file, add the following
UUID=<Your Hard Disk UUID> /mount-location exfat defaults,umask=000 0 0
5. Now reload the daemon with sudo systemctl daemon-reload and then mount using sudo mount -a
This worked for me to mount my exFAT partition with 777 permissions and I was able to read/write to folders on the drive from docker containers.
Docker Plex Permissions
I faced a couple of errors with Plex. The first was that it was unable to write to a config folder on the hard disk despite all the permissions. This was an easy fix, in the docker-compose file from where I was running it, I set the PUID and GUID to 000 after making sure the HDD was mounted with 777 permissions.
Secondly, when I ran the Plex server in Bridge Networking mode, it acted as a web app to view content and manage other servers but didn't act as a server on its own. To fix this, I had to re-run the container in Host Networking mode.