Banana Pi BPI-M1 – how to work remote with SSHFS and BorgBackup 1.2.0-1 with an official linux package on Armbian Linux Jammy

root@bpi-iot-jsho-borg-02:~# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
/root/.ssh/id_rsa already exists.
Overwrite (y/n)? y
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa
Your public key has been saved in /root/.ssh/id_rsa.pub
The key fingerprint is:
SHA256:qEVnZhnHaQSSZw60HpegRqTUqd/LZp/hu4MzQDz2ohM root@bpi-iot-jsho-borg-02
The key’s randomart image is:
+—[RSA 3072]—-+
| .ooo+.o+o. |
| . oo.o+o=+ |
| .oo +=O. |
| ..=o O. |
| + ++ S |
| E +oo |
| o.+ o. |
| o O..o |
| . o +*+ |
+—-[SHA256]—–+
root@bpi-iot-jsho-borg-02:~#
root@bpi-iot-jsho-borg-02:~# ssh-copy-id -f root@bpi-iot-jsho-rslsync-01
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: „/root/.ssh/id_rsa.pub“
root@bpi-iot-jsho-rslsync-01’s password:
Number of key(s) added: 1
Now try logging into the machine, with: „ssh ‚root@bpi-iot-jsho-rslsync-01′“
and check to make sure that only the key(s) you wanted were added.
root@bpi-iot-jsho-borg-02:~#
root@bpi-iot-jsho-borg-02:~# service ssh restart
root@bpi-iot-jsho-borg-02:~#
root@bpi-iot-jsho-borg-02:~# ssh bpi-iot-jsho-rslsync-01 uname -a
Linux bpi-iot-jsho-rslsync-01 5.15.48-sunxi #22.05.3 SMP Wed Jun 22 07:35:10 UTC 2022 armv7l armv7l armv7l GNU/Linux
root@bpi-iot-jsho-borg-02:~#
root@bpi-iot-jsho-borg-02:/# apt-get install sshfs
root@bpi-iot-jsho-borg-02:~#
root@bpi-iot-jsho-borg-02:~# sshfs root@bpi-iot-jsho-rslsync-01:/resilio-sync.data /mnt/sshfs
root@bpi-iot-jsho-borg-02:~#
root@bpi-iot-jsho-borg-02:~# df -k
Filesystem 1K-blocks Used Available Use% Mounted on
tmpfs 99044 4528 94516 5% /run
/dev/mmcblk0p1 117933592 7218400 109436900 7% /
tmpfs 495212 0 495212 0% /dev/shm
tmpfs 5120 4 5116 1% /run/lock
tmpfs 495212 4 495208 1% /tmp
/dev/zram1 47960 9116 35260 21% /var/log
tmpfs 99040 68 98972 1% /run/user/110
tmpfs 99040 60 98980 1% /run/user/0
root@bpi-iot-jsho-rslsync-01:/resilio-sync.data 60172896 6733472 52752824 12% /mnt/sshfs
root@bpi-iot-jsho-borg-02:~#
root@bpi-iot-jsho-borg-02:/# borg init –encryption=repokey /borgbackup.data2
Enter new passphrase: <password>
Enter same passphrase again: <password>
Do you want your passphrase to be displayed for verification? [yN]: n
By default repositories initialized with this version will produce security
errors if written to with an older version (up to and including Borg 1.0.8).
If you want to use these older versions, you can disable the check by running:
borg upgrade –disable-tam /borgbackup.data2
See https://borgbackup.readthedocs.io/en/stable/changes.html#pre-1-0-9-manifest-spoofing-vulnerability for details about the security implications.
IMPORTANT: you will need both KEY AND PASSPHRASE to access this repo!
If you used a repokey mode, the key is stored in the repo, but you should back it up separately.
Use „borg key export“ to export the key, optionally in printable format.
Write down the passphrase. Store both at safe place(s).
root@bpi-iot-jsho-borg-02:/#
root@bpi-iot-jsho-borg-02:~# borg create –compression lz4 –stats /borgbackup.data2::`date „+Backup-%Y-%m-%d-%H:%M:%S“` /mnt/sshfs
Enter passphrase for key /borgbackup.data2: <password>
——————————————————————————
Repository: /borgbackup.data2
Archive name: Backup-2022-13-13-13:35:03
Archive fingerprint: adcc8f6a6c8ab36341c9b055a07d0734264c34a5b6c58f5277d2de9d327b30f7
Time (start): Wed, 2022-07-13 13:35:14
Time (end): Wed, 2022-07-13 13:45:11
Duration: 9 minutes 56.65 seconds
Number of files: 2467
Utilization of max. archive size: 0%
——————————————————————————
Original size Compressed size Deduplicated size
This archive: 2.10 GB 1.29 GB 1.28 GB
All archives: 2.10 GB 1.29 GB 1.28 GB
Unique chunks Total chunks
Chunk index: 2740 3051
——————————————————————————
root@bpi-iot-jsho-borg-02:~#

 

root@bpi-iot-jsho-borg-02:~# borg create –compression lz4 –stats /borgbackup.data2::`date „+Backup-%Y-%d-%d-%H:%M:%S“` /mnt/sshfs
Enter passphrase for key /borgbackup.data2: <password>
——————————————————————————
Repository: /borgbackup.data2
Archive name: Backup-2022-13-13-14:14:26
Archive fingerprint: 3aee10863931c82a62355561a59f33b3f26c92621933993b19fdf31d7a2a6afa
Time (start): Wed, 2022-07-13 14:14:39
Time (end): Wed, 2022-07-13 14:15:09
Duration: 29.87 seconds
Number of files: 2467
Utilization of max. archive size: 0%
——————————————————————————
Original size Compressed size Deduplicated size
This archive: 2.10 GB 1.29 GB 719 B
All archives: 4.20 GB 2.58 GB 1.28 GB
Unique chunks Total chunks
Chunk index: 2741 6102
——————————————————————————
root@bpi-iot-jsho-borg-02:~#

 

root@bpi-iot-jsho-borg-02:~# borg create –compression lz4 –stats /borgbackup.data2::`date „+Backup-%Y-%d-%d-%H:%M:%S“` /mnt/sshfs
Enter passphrase for key /borgbackup.data2: <password>
——————————————————————————
Repository: /borgbackup.data2
Archive name: Backup-2022-13-13-15:04:05
Archive fingerprint: 8703aa110e9519005954f475e822be179be02b19e91b13ab18ae5d6ee1f1ded8
Time (start): Wed, 2022-07-13 15:04:16
Time (end): Wed, 2022-07-13 15:04:46
Duration: 29.79 seconds
Number of files: 2467
Utilization of max. archive size: 0%
——————————————————————————
Original size Compressed size Deduplicated size
This archive: 2.10 GB 1.29 GB 716 B
All archives: 6.30 GB 3.87 GB 1.28 GB
Unique chunks Total chunks
Chunk index: 2742 9153
——————————————————————————

root@bpi-iot-jsho-borg-02:~#
root@bpi-iot-jsho-borg-02:~# umount /mnt/sshfs
root@bpi-iot-jsho-borg-02:~# df -k
Filesystem 1K-blocks Used Available Use% Mounted on
tmpfs 99044 4520 94524 5% /run
/dev/mmcblk0p1 117933592 7218412 109436888 7% /
tmpfs 495212 0 495212 0% /dev/shm
tmpfs 5120 4 5116 1% /run/lock
tmpfs 495212 4 495208 1% /tmp
/dev/zram1 47960 9168 35208 21% /var/log
tmpfs 99040 68 98972 1% /run/user/110
tmpfs 99040 60 98980 1% /run/user/0
root@bpi-iot-jsho-borg-02:~#
root@bpi-iot-jsho-borg-02:~# vi borgbackup.sh
#!/bin/bash
#FileName: borgbackup.sh
set -x
export BORG_PASSCOMMAND=“cat /root/.borg-passphrase“
sshfs root@bpi-iot-jsho-rslsync-01:/resilio-sync.data /mnt/sshfs
borg create –compression lz4 –stats /borgbackup.data2::`date „+Backup-%Y-%m-%d-%H:%M:%S“` /mnt/sshfs
borg prune -v –list –keep-within 3d –keep-daily 7 –keep-weekly 12 –keep-monthly 12 –keep-yearly 5 /borgbackup.data2
borg compact /borgbackup.data2
borg list /borgbackup.data2
umount /mnt/sshfs
root@bpi-iot-jsho-borg-02:~#
root@bpi-iot-jsho-borg-02:~# crontab -l
# Edit this file to introduce tasks to be run by cron.
#
# Each task to run has to be defined through a single line
# indicating with different fields when the task will be run
# and what command to run for the task
#
# To define the time you can provide concrete values for
# minute (m), hour (h), day of month (dom), month (mon),
# and day of week (dow) or use ‚*‘ in these fields (for ‚any‘).
#
# Notice that tasks will be started based on the cron’s system
# daemon’s notion of time and timezones.
#
# Output of the crontab jobs (including errors) is sent through
# email to the user the crontab file belongs to (unless redirected).
#
# For example, you can run a backup of all your user accounts
# at 5 a.m every week with:
# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
#
# For more information see the manual pages of crontab(5) and cron(8)
#
# m h dom mon dow command
15 * * * * /root/borgbackup.sh >> /root/borgbackup.log 2>&1
root@bpi-iot-jsho-borg-02:~#
root@bpi-iot-jsho-borg-02:~# borg check -v /borgbackup.data2
Starting repository check
finished segment check at segment 199
Starting repository index check
Index object count match.
Finished full repository check, no problems found.
Starting archive consistency check…
Enter passphrase for key /borgbackup.data2: <password>
Analyzing archive Backup-2022-07-16-15:41:39 (1/24)
Analyzing archive Backup-2022-07-16-15:54:01 (2/24)

Analyzing archive Backup-2022-07-17-11:15:04 (23/24)
Analyzing archive Backup-2022-07-17-12:15:05 (24/24)
Archive consistency check complete, no problems found.
root@bpi-iot-jsho-borg-02:~#

Leave a Reply

You must be logged in to post a comment.