There's a phrase the Army uses: "One is none, two is one, three is better." You've put a lot of work into writing the content for your Ghost blog, but if you only have your content stored on this one server, a simple storage failure could wipe out years of work. Remember: One is none. Protect your time investment by backing up a second copy of your Ghost content to your unRAID server. This same process can also be used to mount any other unRAID share on an Ubuntu server, not just for Ghost content. I even use it to backup my RPi NGINX reverse proxy server.
In this post we'll discuss how to mount a directory on your Ghost server that will allow you to store your backup Ghost content on your unRAID server. I'll then show you how to backup Ghost's content directly to this unRAID share. Even if you're not using Ghost and are instead running any other server on Ubuntu, this same method still applies and will allow you to mount and backup to an unRAID share.
Permanently Mount an unRAID SMB ("Windows") Share on Your Ghost Ubuntu Server:
The first thing we'll need is a place to backup up our Ghost content to. To do so, we'll need to create a share on our unRAID server. To then be able to access this share/directory on our Ghost server locally, we'll need to then permanently mount our unRAID share on the Ghost server itself (I'm running Ghost on an Ubuntu server). In doing so, our unRAID share will be treated like just another directory on our Ghost server; the same as if we had mounted a USB drive.
For the purposes of this tutorial, I will assume you know how to create a share on unRAID and have already created the share/directory on your unRAID server. In my case, my backup share and the directory structure I have created appears like so:
As you can see, "backup" is my unRAID share and, since I have multiple servers, I have created a separate directory for my Ghost server called "ghostServer" on the unRAID server.
1. Begin by creating the backup directory on our Ghost server:
sudo mkdir /mnt/backup/
2. Install CIFS on the Ghost (Ubuntu) server:
sudo apt-get install cifs-utils
3. Map your Ghost server's backup directory to your unRAID share:
Copy the following line into notepad:
//servername/sharename /<local backup directory mount path from step 1 here> cifs guest,uid=1000,iocharset=utf8 0 0
In my case, my unRAID server sits at the IP address 10.0.30.5. As you saw before, the share is called "backup" and I created a special directory for the Ghost server called "ghostServer". Therefore, in my case, the //servername/sharename piece appears as //10.0.30.5/backup/ghostServer/. I created the /mnt/backup directory in step 1 above, so the /<local backup directory mount path from step 1 here> piece appears as /mnt/backup/:
//10.0.30.5/backup/ghostServer/ /mnt/backup/ cifs guest,uid=1000,iocharset=utf8 0 0
4. Add the above entry you created to fstab:
Edit your fstab file with the following command:
sudo nano /etc/fstab
And copy the line you modified above to the last line in the fstab file.
5. Remount your fstab entries:
sudo mount -a
Alternatively, you can just reboot your server.
At this point, if you navigate to your backup directory, the /mnt/backup directory is mounted and you should see your directory structure. In my case, to help further organize my content, since I may wish to one day fully backup my ghostServer, I had created a further subdirectory called "ghostContent" in unRAID. I can now see this directory mounted locally from my Ghost server.
Backup Your Ghost Server Content
Now that we've mounted our unRAID backup share locally, we are now able to backup our Ghost content to our unRAID server.
1. First, download your Ghost content JSON file in Ghost admin so that you have a local copy of your content:
2. Backup your Ghost content to your unRAID directory:
sudo rsync -a --progress /var/www/ghost/content/ /mnt/backup/ghostContent/
That's it. You now have your Ghost blog's content directory backed up to unRAID. I hope you've found it helpful. Just remember, this same process can also be used to mount any other unRAID share on an Ubuntu server!