At some point, you may want to use LMDS with external storage to keep downloads away from the SD card or allow access to an existing media library.
In case you intend to utilize an external USB drive or network share with LMDS, make sure to mount it and have it available in Linux before deploying any container. If you have any existing containers running, that's okay but you must move current /download and /media folders from the SD card to the USB drive before creating symbolic links to them later.
sudo su fdisk -l
Your USB drive will be listed somewhere in this long list of available storage devices.
Try to look for manufacturer name or identify the drive by its capacity.
My USB drive happened to be
/dev/sda and it has NTFS partition created initially in Windows called
Disk /dev/sda: 37.3 GiB, 40007761920 bytes, 78140160 sectors Disk model: MHT2040AH Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0x5c87c2b7 Device Boot Start End Sectors Size Id Type /dev/sda1 2048 78137343 78135296 37.3G 7 HPFS/NTFS/exFAT
sudo apt-get install ntfs-3g
sudo mkdir /mnt/hdd
mount -t ntfs /dev/sda1 /mnt/hdd/
sudo umount /boot sudo mount /dev/mmcblk0p1 /boot sudo apt install --reinstall raspberrypi-bootloader raspberrypi-kernel sudo reboot
fstabfile so your USB drive is always mounted when your system boots.
Identifying the UUID of your USB drive is necessary for it to be mounted automatically. Replace the identifier with the one you saw earlier while executing
sudo fdisk -l, which could be
/dev/sda1 as well.
sudo blkid /dev/sda1
/dev/sda1: LABEL="ExternakDisk" UUID="F23C6A253C69E4D7" TYPE="ntfs" PARTUUID="5c87c2b7-01"
sudo nano /etc/fstab
UUID="YOUR-UUID-HERE" "mount point" ntfs-3g auto,rw,noatime 0 2
UUID="F23C6A253C69E4D7" /mnt/hdd/ ntfs-3g auto,rw,noatime 0 2
fstab, if you see no errors after below command, you should see what you had on your USB drive under
sudo mount -a
sudo ls -l /mnt/hdd/
sudo touch /mnt/hdd/test.txt
sudo reboot sudo ls -l /mnt/hdd/ sudo df -h
pi@raspberrypi:~ $ df -h Filesystem Size Used Avail Use% Mounted on /dev/root 30G 2.0G 26G 8% / devtmpfs 430M 0 430M 0% /dev tmpfs 463M 0 463M 0% /dev/shm tmpfs 463M 6.3M 457M 2% /run tmpfs 5.0M 4.0K 5.0M 1% /run/lock tmpfs 463M 0 463M 0% /sys/fs/cgroup /dev/mmcblk0p1 253M 54M 199M 22% /boot /dev/sda1 38G 2.0G 36G 6% /mnt/hdd tmpfs 93M 0 93M 0% /run/user/1000
/mnt/hddso anyone can access it (you can be more specific with permissions if you like)
sudo chmod 775 -R /mnt/hdd
docker stop $(docker ps -aq)
After you deploy some of the containers, you might have couple of folders under LMDS directory, but we are only interested in two of them for now:
Each container that downloads anything will be doing so into
~/LMDS/downloads/ directory - we want this directory to be pointing into external HDD so we do not waste SD card for it.
"media" folder should have some or all of the subfolders below:
As these folders will contain all "media files" relevant container should be able to access them also, this structure might be quite big, again we do not want this to be stored on the SD card.
We will create a symbolic links (something like shortcut in Windows) between i.e. downloads folder under
~/LMDS/downloads and downloads folder in
sudo mkdir /mnt/hdd/downloads
/mnt/hdd/and then create symlink - easy.
sudo ln -s /mnt/hdd/downloads /home/pi/LMDS/downloads
~/LMDS/media/tvshows ~/LMDS/media/movies ~/LMDS/media/music
docker start $(docker ps -aq)
With your support anything is possible