0x0007 - Gumstick your VPS (Virtual Private Server) with a raspberry pi zero - and give it a 256 GB drive on a small watt budget (Part 2)
Gumstick your VPS (Virtual Private Server) with a raspberry pi zero - and give it a 256 GB drive on a small watt budget (Part 2)
In part 1 we went over all the working parts of the gumstick side - there were quite a few:
- Establishing a reverse-proxy ssh link across the NAT tunnel
- Making it persistent so it automatically rebuilds it's tunnel on power-down's or reboots.
- If the steps worked correctly your reverse-proxy port will automatically show up inside your VPS - available for it to establish the sshfs mount back through it..
Now we are onto setting up the VPS side as per:
VPS (Virtual Private Server) (part b - 3 steps) $3 / month at: servercheap.net
b-1. Build a sshfs auto-mount back through the raspberry pi zero's reverse proxy.
b-2. Make it auto mounting on reboot and detection (persistence).
b-3. Test the mount if it is a gimmick or production useful.
Lets get started!
- We need to install sshfs, so first get that into your VPS.
sudo yum install sshfs -y
# or
sudo apt install sshfs -y
Let's double-check that the gumstick is doing it's part, port 8000 (what we picked) should be automatically opening, and when we check it is:
nmap localhost
We need to sshfs back through the reverse proxy, so it needs the port.
- sshfs needed to be installed on both sides. at your gumstick as well:
sudo apt install sshfs -y
After some trial we did get it to work as in:
sshfs -o default_permissions -p 8000 c@localhost:/home/c/ /home/c/remote/
This gave us the understanding of what this command is doing, namely:
- the /home/user/ directory was being mounted to the home/c/remote/ directory locally.
- Anything that now was copied into the remote directory automatically synced to the other side!
Lets go find this process kill it and try a more root level mount:
ps -aux | grep sshfs
b-2 Making it auto-mount.
- It would only be a matter of duplicating the /toolbox/go.sh as in part 1 and modifying for the sshfs command.
b-3 Is this a gimmick (or actually useful??)
VPS -> gumstick speeds (1.5 MB dropping to 25 KB and back)
gumstick -> VPS speeds (2.0 MB )
Some notes:
- It does not show up on lsblk
- One side automatically syncs to the other transparently.
- It bogs down a single-core VPS when large files are transferring.
- It will show up on a mount -l
- It does indicate the new hard drive size in a df -h!
- This is what we were looking for - the indication of the availability of the 200G+!
Understanding what is happening here:
- When we did test downloads to the VPS it was automatically syncing to the files true holding point on the gumstick (upsync).
Final Test: It worked!!
- A 500 MB file was downloaded to a random spot on the gumstick.
- It was then moved to the /remote linked directory.
- It showed up instantly on the VPS - showing us the directory we were looking at was only being kept on the gumstick but was remote viewable from the VPS!
- One looks to have about a 2MB/s slow server, but you can have Terabytes of information sitting through this. I would be a matter of testing this with larger faster nodes for faster service.