Turn It Up
Expanding Docker Volume Storage
Going down a recent 🐰🕳️—you may have read about last time—I found myself knee-deep in VM-land with DNS configurations, proxies, servers, volumes, Docker... you know... the works.
In Too Deep
The bottom line is that I have heretofore been way too inexperienced in devops land to really know down from up.
So when it comes to setting up servers, spinning up some OS that I hardly understand, and getting services running... well it often feels like spelunking without a barely-working flashlight.
But in my quest to take a little more control of my data, I tend to get caught up in some entanglements.
I'm not sure if it really has to be all that complicated either. I certainly seek it out as much as I hate to admit it.
So, that's how I sort of ended up trying to host all my photos on Hetzner, using PhotoPrism as my interface.
Many of Hetzner's cheaper plans come with 80GB of disk space, which is pretty hefty!
I eventually got PhotoPrism running, as I mentioned before, and it all was going swimmingly.
But as I was transferring GBs of data into the Hetzner server, I realized that I would eventually run out (I have over 100GB of photos locally).
Now what?
More Space
The simple solution would be to open up an S3-style bucket on Hetzner with what seems like limitless space and just use that as my backup.
But what kind of rabbit hole would that be if it were that easy?
What I realized is that currently, PhotoPrism doesn't have out of the box support for S3-style storage (yet?).
No problem.
I can also easily order and configure an additional "volume" on Hetzner to increase the disk size on my server.
It will even mount the drive for me and everything.
Containers
What I quickly realized, however, is that my previously running containers that handle everything PhotoPrism related would not be able to see (and therefore use) the newly mounted drive.
But how could I make it so that the containers have access to that drive?
What's a serial (metaphorical) spelunker to do?
Well, I could ask Jeff, which usually get's me headed in the right direction.
This is what he gave me:
"the beauty of docker is you can rsync your old to your new volume"
But what even is an rsync anyway?
Up and Down
This is the part of the blog post where you recognize that this could have been a quick TIL (Today I Learned).
Well, just think of this as TIL: Narrative Edition.
Once I ordered the volume, I found myself with a mounted drive on my VPS instance with nothing on it.
Here's my initial question to Jeff:
Do I just need to redeploy docker after adding a volume on the photoprism yaml config and it would work, or would I need to do some sort of moving around of data before doing that?
I'm happy to report that my instinct was mostly correct.
Here were the steps I took to resolve this.
I used ssh
to connect to my VPS and located the yaml
file that PhotoPrism uses to spin up a few Docker containers it needs to run. I had edited this file previously, so I knew where to find it.
Within this file, I was able to find which volume was being used by PhotoPrism to store my photos.
Next, I ran docker-compose down
I then used this thing called rsync
to copy the contents of the previous volume to my newly mounted, bigger volume I ordered from Hetzner.
I went back to the yaml
file and changed the location of the old volume to the location of the new volume.
Then it was time to run docker-compose up
and hope...
Thankfully, it seemed to work just fine. At this point, I removed the old volume and verified that everything was still working.
🎊 Huzzah!!! 🎊
Today I Learned: Narrative Edition
When I first set up this blog, I created a whole section in the backend to allow for TIL type posts....
But who am I kidding.
What's a journey down a rabbit hole without some narrative structure?
Thanks for coming along!