# Backup solution for dedicated root server + storage box at Hetzner



## MasterOne (Feb 5, 2022)

A dedicated root server at Hetzner running FreeBSD 13.0-RELEASE-p7 with 2 x 512GB NVMe configured as ZFS mirror and a storage box with 100GB offering access by scp / rsync / BorgBackup (but no ssh login).


```
# zfs list
NAME                 USED  AVAIL     REFER  MOUNTPOINT
zroot               54.1G   403G       96K  /zroot
zroot/ROOT          1.58G   403G       96K  none
zroot/ROOT/default  1.58G   403G     1.58G  /
zroot/tmp            128K   403G      128K  /tmp
zroot/usr           52.5G   403G       96K  /usr
zroot/usr/home      52.5G   403G     52.5G  /usr/home
zroot/usr/ports       96K   403G       96K  /usr/ports
zroot/usr/src         96K   403G       96K  /usr/src
zroot/var           1.96M   403G       96K  /var
zroot/var/audit       96K   403G       96K  /var/audit
zroot/var/crash       96K   403G       96K  /var/crash
zroot/var/log       1.46M   403G     1.46M  /var/log
zroot/var/mail       136K   403G      136K  /var/mail
zroot/var/tmp         96K   403G       96K  /var/tmp
```

So besides not having enough backup space available (at least after the zroot usage will exceed those 100GB at one point), no login at the storage box and of course no `zfs recv` there.

With the current use, I thought of simply creating a recursive snapshot of zroot, then create a compressed and encrypted archive from that snapshot and send it to the storage box by `scp`.

How would you solve this exactly?
Any better ideas?


----------



## zirias@ (Feb 5, 2022)

Can't you just run your own sshd and pipe zfs send/recv through that?


----------



## MasterOne (Feb 5, 2022)

Zirias said:


> Can't you just run your own sshd and pipe zfs send/recv through that?



That storage box likely runs on Debian Linux, and as said, without ssh login at that box, nothing can be done except sending backup files there by using one of the supported protocols.


----------



## zirias@ (Feb 5, 2022)

Ah, misunderstood you, I assumed the VPS was the "problem".

Hm, still, buy a cheap and large (USB?) HDD and put your backup pool there keeping it at your home (or business)? I mean, why not?


----------



## MasterOne (Feb 5, 2022)

Zirias said:


> Ah, misunderstood you, I assumed the VPS was the "problem". Hm, still, buy a cheap and large (USB?) HDD and put your backup pool there keeping it at your home (or business)? I mean, why not?



A possible solution for the future (though my internet connect s really slow at my current location), but right now I'm looking for the easiest approach to make use of that storage box for that.


----------



## zirias@ (Feb 5, 2022)

Sure, slow connectivity sucks, so now the most obvious solution is ruled out 

Looking at the docs you linked, I guess I'd try the "SMB/CIFS" route first. Of course, FreeBSD's SMB implementation probably won't do (only supporting SMBv1), but there are some fuse-based solutions. At least, that way you could store a "zfs send" stream, without the need to have a local copy first...


----------



## covacat (Feb 5, 2022)

i pay $6/month for a 1GB vps + 512GB block storage
i do nightly zfs sends
hosting is in luxembourg so  latency/bw is ok
the single problem is that zfs send runs out of memory some times but otherwise it's good enough


----------



## MasterOne (Feb 5, 2022)

Zirias said:


> Looking at the docs you linked, I guess I'd try the "SMB/CIFS" route first. Of course, FreeBSD's SMB implementation probably won't do (only supporting SMBv1), but there are some fuse-based solutions. At least, that way you could store a "zfs send" stream, without the need to have a local copy first...



This obviously will require more time to play around, but right now I just need a quick & dirty solution for that problem.

This is what I got so far:


```
# zfs snapshot -r zroot@2022-02-05
# zfs send -R zroot@2022-02-05 | gzip > 2022-02-05.zfs.gz
# gpg -c 2022-02-05.zfs.gz
# scp 2022-02-05.zfs.gz.gpg user@server:./
```

Pretty bad, as it takes 2 x the local storage pace of the whole snapshot (first the gzip file, and then the encryted file).

How can this be made into a pipe with gpg using a passphrase instead of a key?
Can this be converted into something that does not use local storage but just streams to the destination?


----------



## MasterOne (Feb 5, 2022)

covacat said:


> i pay $6/month for a 1GB vps + 512GB block storage
> i do nightly zfs sends
> hosting is in luxembourg so  latency/bw is ok
> the single problem is that zfs send runs out of memory some times but otherwise it's good enough



I really don't want to have additional costs for this right now, so any solution for what I already have (the storage box at Hetzner is included with the dedicated root server without additional charge) would be appreciated.


----------



## covacat (Feb 5, 2022)

try (s)ftpfs, or sshfs
or lftp which will read from nonseekable fd
pkg install lftp
lftp -e 'put /dev/fd/0 -o xx.bin'  sftp://10.1.1.2 </boot/kernel/kernel
this worked, tested with md5
so
zfs send |lftp


----------



## jordanch (Jun 23, 2022)

MasterOne said:


> I really don't want to have additional costs for this right now, so any solution for what I already have (the storage box at Hetzner is included with the dedicated root server without additional charge) would be appreciated.


If you really want to go the free route, use `gdrive` to backup files to your Google Drive(s). Make a bunch of Google accounts. Write a script to upload specific parts of the directory structure to different Google Drives. This obviously doesnt give you a full system backup, but then if need be, you can reinstall the same version of the OS and copy over the user data directories.

You will need to set some things up to allow gdrive to run automagically.


----------



## jbo (Jun 23, 2022)

covacat said:


> i pay $6/month for a 1GB vps + 512GB block storage


Which hoster would that be, if you don't mind sharing?


----------



## covacat (Jun 23, 2022)

jbodenmann said:


> Which hoster would that be, if you don't mind sharing?


my.frantech.ca (buyvm.net) / they don't have 'stock' available usually, i made a crude curl | grep script to notify me when to order
vegas / nyc was easier to get than luxembourg but latency was kind of shitty for interactive use (esp vegas)


----------

