Pishrink with openhabian

Hallo there,

I would like to secure my openhabian image and compress it with pishrink (GitHub - Drewsif/PiShrink: Make your pi images smaller!)

Does anybody of you have experience with pishrink and openhabian with openhab3?

Thanks for your response.

I haven’t used it, but I’m also interested. I’ve been using 32GB SD cards and would like to move my current system to a 16GB card without starting from scratch.

I was thinking of setting up a separate Raspbian Desktop system so that I can use the built-in SD Card Copier to move from the 32GB to the 16GB card.

i use openhabian with openhab 3.3.0.m2 and i use a little script for my backups what i start manually from time to time, most before doing updates.

some time ago i had oh system installed on a ssd, this was 120gb, there i started using pishrink to avoid having always 120gb big backups. acutally i am back on a sd-card, but also use pishrink to receive backups as small as possible. thats the reason i have both versions (ssd and sd) in my script, ssd is commented out.

#!/bin/bash
#!/usr/bin/env bash

# timestamp funktioniert nur wenn er vor sudo -s gesetzt wird!
timestamp() { date +"%Y-%m-%d"; }

sudo -s <<EOF

echo "################################"
echo "### datensicherung gestartet ###"
echo "################################"

#sudo systemctl stop openhab2.service

echo "backup laufwerk anschließen ..."
mount -t cifs -o user=XXXX,password=XXXX,rw,file_mode=0777,dir_mode=0777 //XX.XX.XX.XX/XXXXX /mnt/smb/

echo "ordner für sicherung erstellen ..."
mkdir /mnt/smb/$(timestamp)
mkdir /mnt/smb/$(timestamp)/influxdb-dasi

#echo "komplette sd-karte in voller größe sichern..."
#dd if=/dev/mmcblk0 of=/mnt/smb/$(timestamp)/SD-Karte-$(timestamp).img bs=1MB
#echo "und jetzt das image komprimieren ..."
#pishrink.sh /mnt/smb/$(timestamp)/SD-Karte-$(timestamp).img

echo "komplette usb-ssd-festplatte in voller größe sichern ..."
dd if=/dev/sda of=/mnt/smb/$(timestamp)/USB-SSD-$(timestamp).img bs=1MB
echo "und jetzt das image komprimieren ..."
pishrink.sh /mnt/smb/$(timestamp)/USB-SSD-$(timestamp).img

echo "openhab-backups sichern ..."
openhab-cli backup
find /var/lib/openhab/backups -cmin -33 -exec cp {} /mnt/smb/$(timestamp) \;

echo "influxdb datenbanken sichern ..."
influxd backup -portable /mnt/smb/$(timestamp)/influxdb-dasi

echo "diverse konfigurationsdateien sichern ..."
cp /etc/hosts /mnt/smb/$(timestamp)
cp /etc/dhcpcd.conf /mnt/smb/$(timestamp)
cp /etc/owfs.conf /mnt/smb/$(timestamp)
cp /etc/samba/smb.conf /mnt/smb/$(timestamp)
cp /etc/influxdb/influxdb.conf /mnt/smb/$(timestamp)
cp /etc/grafana/grafana.ini /mnt/smb/$(date +%Y-%m-%d)

echo "###############################################################"
echo "### grafana dashboards bitte manuell als *.json exportieren ###"
echo "###############################################################"

umount /mnt/smb
EOF

I wouldn’t mess with this. You are just about to very likely break anything.
Just export your config, install to another (smaller) SD from scratch, and reimport.

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.