At some point you might want to use LMDS with external storage to keep all the downloads away from SD card or allow LMDS to access already exiting media library.
If you are planning to use an external USB drive or network share with LMDS, please have it mounted and available in Raspbian before deploying any container. If you already have containers running, this is ok but you will have to move existing /download and /media folders from the SD card and place them onto 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 drive by its capacity.
My USB drive happened to be /dev/sda
and it has NTFS partition created initially in Windows called /dev/sda1
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
hhd
directory inside /mnt/
directory.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
fstab
file so your USB drive is always mounted when your system boots.
In order for your USB drive to be mounted automatically, you need to identify its UUID.
Replace /dev/sda1
with your USB partition identifier which you saw earlier while executing sudo fdisk -l
- it might be also called /dev/sda1
as mine.
sudo blkid /dev/sda1
/dev/sda1: LABEL="ExternakDisk" UUID="F23C6A253C69E4D7" TYPE="ntfs" PARTUUID="5c87c2b7-01"
/etc/fstab
file.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 /mnt/hdd
sudo mount -a
sudo ls -l /mnt/hdd/
sudo touch /mnt/hdd/test.txt
sudo reboot
sudo ls -l /mnt/hdd/
sudo df -h
/dev/sda1
mounted to /mnt/hdd
[email protected]:~ $ 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/hdd
so 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 LMDS containers you might have couple of folders under LMDS directory but we will be 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 /mnt/hdd/downloads
/mnt/hdd/
sudo mkdir /mnt/hdd/downloads
/mnt/hdd/
and then create symlink - easy.sudo ln -s /mnt/hdd/downloads /home/pi/LMDS/downloads
~/LMDS/media/
~/LMDS/media/tvshows
~/LMDS/media/movies
~/LMDS/media/music
docker start $(docker ps -aq)
With your support anything is possible