Skip to content

Mounting USB disks as file storage

dividebysandwich edited this page May 5, 2024 · 2 revisions

It is recommended to mount one or more USB or similar flash disks on /shareboxx/files so as to not use the main SD card for file storage. This path will also be used as temp directory for uploads.

You can format USB disks as ext4, exfat, or anything you like. To make them be mounted automatically, edit /etc/fstab and add the following line:

/dev/sda1 /shareboxx/files auto rw 0 0

If you use fat, exfat or similar non-linux file systems, you have to use the following or else uploads will fail with a permission error:

/dev/sda1 /shareboxx/files auto rw,dmask=1000,fmask=1000,nosuid,nodev,nofail 0 0

replace /dev/sda1 with whatever your USB disk shows up as. You can find out which device it is by running journalctl -f and then plugging in the disk. If you are not well-versed with Linux, just format the USB disk under Windows and use the instructions above for exfat file systems.

NOTE: If you want to use multiple USB disks for storage, note that you may experience overlapping mounts. If you mount one disk on /shareboxx/files, and the other disk on /shareboxx/files/Movies, then depending on the sequence of mounting parts of the files may be hidden by the overlapping mount. What you can do however is to use the Raspi's boot SD card for /shareboxx/files, and then within that mount one disk as /shareboxx/files/Movies, and another as /shareboxx/files/TV Shows.

NOTE: Shareboxx uses /shareboxx/files as the temp directory for uploads. If you mount an external disk as /shareboxx/files, everything will work just fine. However, if you mount a disk on, say, /shareboxx/files/Movies, then you will not be able to upload anything under /shareboxx/files/Movies. The reason is that the uploader attempts to rename the temporary file when the upload is done. This only works if the target directory is on the same device.

NOTE: USB sticks are only recommended for small, portable setups. For more permanent installations, consider mounting storage from a NAS via NFS.