Openhab-cli backup from 700KB to 85MB!

After the last upgrade from 2.2.0 to 2.3.0 the ZIP backup running openhab-cli incresed from 700KB to 85MB!!!

unzip -l show standard file but also these:

  318112  Defl:N   287849  10% 2018-06-26 20:52 3b7f1e62  userdata/cache/org.eclipse.osgi/193/0/bundleFile
       0  Stored        0   0% 2018-06-26 20:51 00000000  userdata/cache/org.eclipse.osgi/27/
       0  Stored        0   0% 2018-06-26 20:51 00000000  userdata/cache/org.eclipse.osgi/27/0/
   26366  Defl:N    23290  12% 2018-06-26 20:51 729c4ef1  userdata/cache/org.eclipse.osgi/27/0/bundleFile
       0  Stored        0   0% 2018-06-26 20:51 00000000  userdata/cache/org.eclipse.osgi/177/
       0  Stored        0   0% 2018-06-26 20:51 00000000  userdata/cache/org.eclipse.osgi/177/0/
   11044  Defl:N     8820  20% 2018-06-26 20:51 76681bb1  userdata/cache/org.eclipse.osgi/177/0/bundleFile


 2885688  Defl:N  2865393   1% 2018-06-26 20:52 1646e17c  userdata/tmp/mvn/org/openhab/binding/org.openhab.binding.systeminfo/2.3.0/org.openhab.binding.systeminfo-2.3.0.jar
      40  Stored       40   0% 2018-06-26 20:52 ea62ce9c  userdata/tmp/mvn/org/openhab/binding/org.openhab.binding.systeminfo/2.3.0/org.openhab.binding.systeminfo-2.3.0.jar.sha1
       0  Stored        0   0% 2018-06-26 20:52 00000000  userdata/tmp/mvn/org/openhab/action/
       0  Stored        0   0% 2018-06-26 20:52 00000000  userdata/tmp/mvn/org/openhab/action/org.openhab.action.pushover/
       0  Stored        0   0% 2018-06-26 20:52 00000000  userdata/tmp/mvn/org/openhab/action/org.openhab.action.pushover/1.12.0/
      40  Defl:N       39   3% 2018-06-26 20:52 0c3889d8  userdata/tmp/mvn/org/openhab/action/org.openhab.action.pushover/1.12.0/org.openhab.action.pushover-1.12.0.jar.sha1
   14757  Defl:N    12787  13% 2018-06-26 20:52 969f50c1  userdata/tmp/mvn/org/openhab/action/org.openhab.action.pushover/1.12.0/org.openhab.action.pushover-1.12.0.jar
       0  Stored        0   0% 2018-06-26 20:52 00000000  userdata/tmp/mvn/org/openhab/io/
       0  Stored        0   0% 2018-06-26 20:52 00000000  userdata/tmp/mvn/org/openhab/io/
       0  Stored        0   0% 2018-06-26 20:52 00000000  userdata/tmp/mvn/org/openhab/io/
      40  Defl:N       39   3% 2018-06-26 20:52 0ef1c9c4  userdata/tmp/mvn/org/openhab/io/
 4716861  Defl:N  4711534   0% 2018-06-26 20:52 8afb1bdf  userdata/tmp/mvn/org/openhab/io/


Is it a bug with tmp/cache folder?


I think @Benjy added the bindings themselves to the backups between 2.2 and 2.3, IIRC.

I found this sufficiently annoying that I edited the backup script at /usr/share/openhab2/runtime/bin/backup to make it remove the cache and tmp temporary directories before zipping. Given I want to keep months of backups, just in case, having 100MB each time was not fantastic…

it would have taken you less time to open up an issue on github with your proposed changes than to post a complaint here :stuck_out_tongue:

previous discussion suggested this is intentional behaviour, requiring me to go off-grid!

Hi all, sorry intermittent access to internet at the moment until mid-august.

It’s true that the intention was to keep an exact copy of the state of openHAB’s dynamic files. However, as @dan12345 has pointed out this isn’t a great idea if someone wants to do regular backups of their configuration (we should all want that right?).

I think the best solution would be to add a --full flag. If used, the userdata/tmp/ and /userdata/cache files will not be deleted within the zip. On the other hand, if the default function should be the same as it is now, then a --nocache flag could be implemented?


I have to agree with @dan12345 here, this is an irritating behaviour. I think the default should be to not include tmp and cache in the backup. Isn’t everything in those folders recreated upon startup of OH anyway?

Anyway, did anyone start any work on changing this? No matter what is default, there ought to be a choice whether to include tmp and cache or not :slight_smile:

1 Like

No, I think some files are updated each startup but many files persist. Each update should clear them though.

Not to my knowledge, it would be great if you could create an issue in the openhab-distro github repo for it though.

1 Like



Hi all,

I got a question regarding openhab-cli backup and restore, I recently upgrade my rpi from 3B to 4B with openhab-cli backup & restore, restore process is smooth, everything works as expect, It only come to me one issue recently. I can’t manually upgrade addon. (put jar to usr/share/openhab2/addons)

I got few binding were installed by manual (put jar to usr/share/openhab2/addons),
after restore on 4B, binding is working, but it’s not inside folder usr/share/openhab2/addons, when I put a new version of jar inside addons folder, there is error, bundle:list shows new jar is installed, but old bundle still exist, I can manually uninstall the jar with bundle:uninstall, but I would like to do a backup with bundle before I remove, so in case anything went wrong, I can restore back, anyone know where that jar located? I also tried /var/lib/openhab2/tmp/mvn/org/openhab/binding, it’s also not there, please kindly advise me if you know. thank you.

It’s not located anywhere really. It’s embedded inside the kar files and it’s “installed” into the karaf container. You can’t just find and delete the jar file. You have to remove it which is probably best done using bundle:uninstall. For some reason on the restore your add-ons that were manually installed to the addons folder got installed “normally”.

Thanks Rich, that’s what I am expecting, as I found no where to found the jar files.