This tutorial will allow us to download, back up, and re-inject the operational files of the zigbee2mqtt integration during a Gladys reinstallation in order to avoid re-pairing all your devices. (personally I have about forty).
Warning this requires quite a few steps.
For now this tutorial is intended for users on a Windows system.
Prerequisites:
- Have a virtual machine running Linux
- Know how to connect via SSH to your Gladys instance
Installing a Linux virtual machine:
You need to enable the Windows Subsystem for Linux:
- Press the Windows key + R then type: optionalfeatures.exe then press Enter
- Scroll down and check:
– Windows Subsystem for Linux
– Windows Hypervisor Platform
– Virtual Machine Platform
Then click OK.
You will be asked to perform an update; you must do it.
If you have problems you can take a look here.
After rebooting, we will install WSL2.
- Download the package :
Package de mise à jour du noyau Linux WSL2 pour machines x64 - Run the update package you just downloaded.
- set WSL 2 as the default version with the following command
– Press the Windows key + R then type: wsl --set-default-version 2 then press Enter.
All that’s left is to download a Linux distribution from the Microsoft Store.
I chose Ubuntu 18.04 LTS.
If you have problems you can take a look here..
Now that you have installed your Linux virtual machine, we will begin the procedure.
-
Connect via SSH to your Gladys instance:
ssh [Nom d'utilisateur]@gladys

-
Stop the zigbee2mqtt container
docker stop gladys-z2m-zigbee2mqtt

-
Switch to root
sudo su
Then:
/home/[Nom d'utilisateur]

-
Create a compressed archive of the complete zigbee2mqtt folder in the /home/user folder of the RPi
tar -zcvf zigbee2mqtt_z2m.tar.gz /var/lib/gladysassistant/zigbee2mqtt/z2m
-
Exit from root:
exit -
Restart the zigbee2mqtt container:
docker start gladys-z2m-zigbee2mqtt
Then disconnect from the SSH console.
Now that the archive is created, we will retrieve it directly onto our PC.
For example into the « Downloads » folder
To know the exact path (with capitals); open your file explorer and right-click on the « Downloads » folder, then « Properties » and click on the « Location » tab
Here is my path:
« C:\Users\vince\Downloads »
-
Restart your SSH console and navigate to the folder:
cd /mnt/c/Users/vince/Downloads/
For William it is like this, with the following result:

-
Then enter the command:
scp [Nom d'utilisateur]@gladys:/home/[Nom d'utilisateur]/zigbee2mqtt_z2m.tar.gz /mnt/c/Users/willi/Downloads/
/home/william/ => replace with the path of the archive created previously on the RPi
/mnt/c/Users/willi/Downloads/ => path where you want to copy your archive
![]()
Here is the result in your folder:
Next step, transfer your files to your new Gladys instance.
For my part, I am moving from an SD card to an SSD.
Be careful, you will need to restore the Gladys database. Either with Gladys Plus or if you have backed up your database.
I highly recommend using Gladys Plus for more ease.
See this topic Offre limitée : Gladys Plus à -50% pendant 1 an ! 🤩
On your new instance restore your Gladys database but do not reactivate the zigbee2mqtt integration.
-
Restart the Windows Ubuntu terminal
-
First, using the Windows Ubuntu terminal, go to the folder where the zigbee2mqtt archive is stored. In William’s case the « Downloads » folder of his PC.

-
Enter the command
scp dossier.tar.gz [nomutilisateur]@adresseip:~/
~/ => corresponds to the /home/user folder in Linux
Which gives

The folder is copied into the /home/user folder, now all that remains is to decompress it into \var\lib\gladysassistant\zigbee2mqtt\z2m\
To simplify things we will first decompress the archive and copy only the 3 files. No need to copy all the logs.
-
Reconnect via SSH to your Gladys instance:
ssh [Nom d'utilisateur]@gladys

-
To check if your archive is present:
ls

The archive has been successfully copied -
Enter the command to decompress the archive
tar -zxvf zigbee2mqtt_z2m.tar.gz
Now we will just copy the 3 files configuration.yaml, coordinator_backup.json and database.db into the \var\lib\gladysassistant\zigbee2mqtt\z2m\ folder
- In the terminal switch to root with the command
sudo su
- Create the zigbee2mqtt and z2m directories with the following commands:
mkdir /var/lib/gladysassistant/zigbee2mqtt
mkdir /var/lib/gladysassistant/zigbee2mqtt/z2m
- Copy the 3 files with the following commands:
cp var/lib/gladysassistant/zigbee2mqtt/z2m/configuration.yaml /var/lib/gladysassistant/zigbee2mqtt/z2m/
cp var/lib/gladysassistant/zigbee2mqtt/z2m/coordinator_backup.json /var/lib/gladysassistant/zigbee2mqtt/z2m/
cp var/lib/gladysassistant/zigbee2mqtt/z2m/database.db /var/lib/gladysassistant/zigbee2mqtt/z2m/
- Now plug in your Zigbee dongle and activate the service
This tutorial was written with the help of @_Will_71.
This solution should be adapted if you use a NAS or other, but I am not in a position to tell you what to do.
Don’t hesitate to ask your questions; we’ll try to answer them.





