PhotoPrism, Part Two

PhotoPrism, Part Two
Photo by Laura Fuhrman / Unsplash

Well when I take a look today the indexing has either stopped or crashed overnight. When I try to log into the webpage it is not accepting my password. Interesting.
Steps performed from PHOTOPRISM-01

  • sudo docker-compose ps

This shows the database is down with Exit 139. I'm guessing this to be a space issue.

  • sudo docker-compose down
  • sudo docker-compose up

This fails due to no space left on the device.

  • sudo docker system prune --all --force --volumes

This frees up 1.843GB of space. That should be plenty of space to get PhotoPrism started. I wonder if it can just use the space on my fileserver's network share? I alter the volumes in the docker-compose.yml file. Let's try it.

  • sudo docker-compose up -d

Looks like I nuked everything with the prune command. Everything is redownloading for the first time, but errors out due to there not being enough space. So I clear out 3.3GB from ./storage/cache

  • sudo docker-compose up -d

The interface loads and I can log in now. It looks like there is metadata still listed for pictures that are now missing from PhotoPrism. I begin a complete scan. So far it does not seem to be upset by the fact that the original mount point has changed and is now pointed at my network mount.

As I'm reading through some more of their documentation I am really impressed with this software they've made. It is very slick from everything I have seen so far. It's a shame there can't be additional users, that's the only feature I would love to see added. I can share folders with other people so that could be a potential compromise. I may have to reorganize some of my folders of pictures but that wouldn't be a big deal.

I come back to check on the complete scan's progress. It's errored out again. What is causing the local disk space to fill up so quickly? It turns out this is due to thumbnail creation. I can afford to have the virtual disk be bigger. I initially set it to 30GB but I could bump it to 100GB to test things out. I used this site to help resize the virtual disk in Ubuntu.

Increase Virtual Disk Size in Ubuntu

  • Make sure you have a viable backup of the VM.
  • Shut down if a virtual machine.
  • sudo shutdown
  • Remove all snapshots/checkpoints.
  • Resize the virtual hard disk.

Steps performed on HV-03 via Windows Admin Center

  • Navigate to Virtual Machines
  • Select PHOTOPRISM-01
  • Click on Settings
  • Navigate to Disks
  • Select Hard Drive and click Edit
  • Change Action to Resize
  • Enter 100 for New Size and hit Edit
  • Click Save disk settins
  • Create a snapshot of the virtual machine just in case of errors.
  • Boot Virtual Machine.

Steps performed on PHOTOPRISM-01

  • cfdisk
  • Select the partition you wish to extend using up and down keys.
  • Select from the menu Resize using the left and right keys.
  • Press Enter.
  • Set the New Size and hit Enter.
  • Use the left and right keys to select Write.
  • Press Enter.
  • Use the left and right keys to select Quit.
  • Press Enter.
  • sudo reboot
  • Verify the name of the physical disk
  • fdisk -l /dev/sda
  • Initialize if a new volume
  • pvcreate /dev/sda3
  • Display the physical volume
  • pvdisplay
  • Resize the physical volume
  • pvresize /dev/sda3
  • Verify the name of the volume group
  • vgdisplay
   --- Volume group ---
   VG Name               linuxetc1-vg (***** this is vg i'm extending*****)
   System ID             
   Format                lvm2
   Metadata Areas        1
   Metadata Sequence No  3
   VG Access             read/write
   VG Status             resizable
   MAX LV                0
   Cur LV                2
   Open LV               2
   Max PV                0
   Cur PV                1
   Act PV                1
   VG Size               7.52 GiB
   PE Size               4.00 MiB
   Total PE              1925
   Alloc PE / Size       1925 / 7.52 GiB
   Free  PE / Size       0 / 0
  • Extend the volume group
  • vgextend linuxetcl-vg /dev/sda3
  • Verify the name of the logical volume
  • lvdisplay
  --- Logical volume ---
  LV Path                /dev/ubuntu-vg/ubuntu-lv
  LV Name                ubuntu-lv
  VG Name                ubuntu-vg
  LV UUID                NemQBd-Gshb-eh5V-salH-wQ03-0u2m-V3OSsl
  LV Write Access        read/write
  LV Creation host, time ubuntu-server, 2022-10-03 14:06:38 -0400
  LV Status              available
  # open                 1
  LV Size                <26.95 GiB
  Current LE             6898
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:0
  • Extend the logical volume
    1. lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv to extend by percentage
    2. lvextend -L+10GB /dev/ubuntu-vg/ubuntu-lv to extend by a specific amount
    3. lvextend -L15G /dev/ubuntu-vg/ubuntu-lv to extend to a specific amount
      I end up extending by percentage.
  • Verify the filesystem name
  • df -h
 Filesystem                      Size  Used Avail Use% Mounted on
 udev                            477M     0  477M   0% /dev
 tmpfs                           100M  4.6M   95M   5% /run
 /dev/mapper/linuxetc1--vg-root  6.3G  2.5G  3.5G  42% /            (***** this line*****)
 tmpfs                           497M     0  497M   0% /dev/shm
 tmpfs                           5.0M     0  5.0M   0% /run/lock
 tmpfs                           497M     0  497M   0% /sys/fs/cgroup
 /dev/sda1                       472M  105M  343M  24% /boot
 tmpfs                           100M     0  100M   0% /run/user/1000
  • Resize the filesystem
  • resize2fs /dev/mapper/linuxetc1--vg-root
  • Verify your work
  • df -h
 Filesystem                      Size  Used Avail Use% Mounted on
 udev                            477M     0  477M   0% /dev
 tmpfs                           100M  4.6M   95M   5% /run
 /dev/mapper/linuxetc1--vg-root   19G  2.5G   15G  15% /         (***** this line*****)
 tmpfs                           497M     0  497M   0% /dev/shm
 tmpfs                           5.0M     0  5.0M   0% /run/lock
 tmpfs                           497M     0  497M   0% /sys/fs/cgroup
 /dev/sda1                       472M  105M  343M  24% /boot
 tmpfs                           100M     0  100M   0% /run/user/1000
  • Remove the snapshot

Back to PhotoPrism

I restart the scan. We'll see how far it gets now. I don't see any other reason why it will not complete at this point. When I check on it later it has scanned about 4000 pictures and created 3.3GB in thumbnails. This should be more than adequate space for all my photos at this time. While this keeps going I look back through my notes and notice I installed UFW and Fail2Ban but never actually set them up. Let's tackle that quickly.

Steps performed on PHOTOPRISM-01

  • sudo ufw allow 22
  • sudo ufw allow 80
  • sudo ufw allow 2342
  • sudo ufw enable
  • sudo nano /etc/fail2ban.jail.local
[DEFAULT]
bantime = 100m
findtime = 10m
maxretry = 5
ignoreip = 10.10.10.XXX

[sshd]
enabled = true
port = ssh
logpath = %(sshd_log)s
backend = %(sshd_backend)s
  • sudo systemctl enable fail2ban
  • sudo systemctl start fail2ban