How to: The method I use to backup my PI and C2 based Openhab

Thanks for the heads up, it appears they may have gone back to a stand alone free program like they used to offer which has a different name. Backup and Recovery free…

I have added Clonezilla to the first post as I do prefer Opensource programs and it looks great.

3 Likes

HI guys,

please tell me if there is a way completely to backup the image without disconnectiong the disk from Raspi and stopping OH at all?

Thanks!

Along the same lines as your advice of learning one solution, I only use CloneZilla these days.

I have tired lots of other OS dependant bits of software (meaning that they run within Windows or a Linux Desktop) , but I ALWAYS had some kind of {time consuming} issue.

Regardless of the device I’m trying to backup / restore, CloneZilla has consistently worked.

(Other than that 1 occasion I ticked the “repair sectors” option, which caused new C2 eMMC cards to not boot)

The only down side I have found with CloneZilla is that it refuses to restore an image that comes from a larger partition, even if 50% of that image was empty.
There may be a way around this, but as I tend to restore 8Gb images (from my donor / development / master card) onto larger 16Gb cards, this isn’t a problem.

That’s a great bit of advice, next time I’m building a new machine, I’ll have a play with shrinking the partition on the donor card before using CloneZilla.

As I believe CloneZilla will use every bit of available space on the destination card / device when restoring.
{Obviously, I’ll check}

Just for information sake,

I can have a new machine up and running, from being unwrapped to connected to the myopenhab service is just under 20 minutes.

Importing Velbus hardware assets and building a UI takes slightly longer.

I use a similar method. Originally I installed Openhab on an SD card, but after a few months I switched over to an SSD. I started running out of space so I resized the partition slightly using a linux virtual machine so that the partition is now big enough.

To make backups I just plug the SSD into my computer and do a backup with dd…

dd if=/dev/rdiskX of=pi_image_XX_XX_XXXX.img bs=1m count=4500

Basically the important part is that bs=1m and count=4500. That basically means that I want to copy 4500MB only. This is to avoid copying the blank space. The 4500 is an arbitrary number slightly higher than the size of all the partitions… just so I don’t forget to copy the last few bytes or something like that.

1 Like

Yes I believe that can be done with dd under Linux via command line. Amanda can do it too I believe. However I strongly recommend against backing up a drive that has been running for any length of time as you do not want to backup the corruption that creeps in. A $35 computer is not the same as an expensive server so what may be fine to do on a server is not a good idea on a great priced $35 computer.

That works well and since larger SD/flash cards perform much faster you can benefit from the larger card and reduce its size down so the backups don’t take up as much space and copying to cards that are ‘the same size’ that fail it fixes this issue. You can also resize the partition without loosing data at any time, but I would take an image of it before doing so in case you make a mistake. Parted and GParted can do this.

1 Like

Why do people keep asking how to reinvent the wheel ?
Because they’re too lazy or impatient to read up first what’s already available.
Apart from that capturing a thread is a bad habit, you should have searched the forum first
How to ask a good question / Help Us Help You - Tutorials & Examples - openHAB Community
You would have found many references to Amanda and posts to answer your question.

Because if it was really so simple, there was no 18 posts with different opinions.
Of course i have searched a lot, but i have not found an answer to my question.

Hi

I’ve looked at the images that CloneZilla makes , without any adjustments or resizing of partitions and it looks like either the blank parts are compressed or ignored.

:slight_smile:

Thx for sharing!

I tried the Paragon software and liked it.
But it says at the end of the recovery process:
“If you have Linux installed reinit its bootloader”

I don’t know how I can do that. Can somebody help me?

Just ignore it works fine.

Unfortunately, it doesn’t ;-(
System starts to boot but stops at some point.

Did you image the DISK or did you image the PARTITION? Make sure you image and restore the whole disk. Can you ssh in and look at the linux system log file to see where it fails?

GRUB Reinit: Repair or Replace GRUB in One Easy Step | Scottie’s Tech.Info (scottiestech.info)

I imaged and backuped the whole disk (sdcard)
I also tried different sd cards. Always the same result.

I can’t ssh in. The boot process stops:

I tried boot-repair via Ubuntu bootable stick, but after the “Recommended repairs” there are also problems:

I think my skills are not tight enough ;-((

I solved the problem now.

I use dd or Win32DiskImager in combination with pishrink script.
Works like a charm. And with the dd variant I can even do the backup without downtime of the system.

Thx anyway ;-))

Great news, any details or a link to how to use pishrink that you found useful? Would like to check it out.
I used dd a long time ago and it is great however you need to partition the master card to a smaller size to ensure it is smaller than any target drives you wish to copy to. Perhaps things have changed over the past 20 years :slight_smile:

I used the following link to get startet with pishrink:
https://hoerli.net/raspberry-pi-backups-verkleinern/

It’s in german but the commands are pretty simple :wink:

2 Likes

One little edit:

Using dd with a running system is not advisable!!
After checking the openhab logs with a system started with a backup card created this way, i had issues with a corrupted persistence db and some other problems.

So, I will use Win32Imager or dd on a second Linux system.

Did any one succedd with Paragon?

Hi Guys

I use rpi-clone to create online backup. No need take down sd card or usb drive . It allso cones with resize capability.
My setup : 240 GB SSD back up on 64 gb sd @ pi4
64 gb sd backup on 16 gb usb drive

I use BorgBackup for making backups of the whole pi. It is de-duplicated, works at runtime and supports encryption.

So I can go back to any point in time or grab that file I changed a few weeks ago (although there is git for this use case, but it is not always practicable like for databases)