Domoticz reinstall on USB drive; how to keep switch settings
Moderator: leecollings
- Dutchsea
- Posts: 120
- Joined: Tuesday 08 December 2015 13:22
- Target OS: Raspberry Pi / ODroid
- Domoticz version: v2023.2
- Location: The Netherlands
- Contact:
Domoticz reinstall on USB drive; how to keep switch settings
Hi,
I am going to do a fresh reinstall of Raspbian and Domoticz on my Pi. I have been tinkering with it (including accidently power losses) as the newby I am and feel its not 100% healthy anymore.
Its not going to be a install on top of the existing Domoticz as I plan to do the new install on a USB drive while its now on the Memory card.
I'd like to keep all settings of the switches somehow. I have read there is a database with the settings but I have not been able to find its location.
Can someone tell me what files I should save and copy to the new installed Domoticz?
Thx
I am going to do a fresh reinstall of Raspbian and Domoticz on my Pi. I have been tinkering with it (including accidently power losses) as the newby I am and feel its not 100% healthy anymore.
Its not going to be a install on top of the existing Domoticz as I plan to do the new install on a USB drive while its now on the Memory card.
I'd like to keep all settings of the switches somehow. I have read there is a database with the settings but I have not been able to find its location.
Can someone tell me what files I should save and copy to the new installed Domoticz?
Thx
Raspberry PI 3B on USB drive, Debian version: 12 (bookworm), Domoticz 2024.7
Aeon Z-Wave G5 stick, RFXCOM, Sonof Zigbee 3.0 Dongle plus E, Nefit Easy, Fritzbox, Buienradar, Sonos
Aeon Z-Wave G5 stick, RFXCOM, Sonof Zigbee 3.0 Dongle plus E, Nefit Easy, Fritzbox, Buienradar, Sonos
Re: Domoticz reinstall on USB drive; how to keep switch sett
Setup->Settings->Backup/Restore
Save the database and if you are finished installing, restore it
Save the database and if you are finished installing, restore it
- nayr
- Posts: 354
- Joined: Tuesday 11 November 2014 18:42
- Target OS: Linux
- Domoticz version: github
- Location: Denver, CO - USA
- Contact:
Re: Domoticz reinstall on USB drive; how to keep switch sett
domoticz.db in the root of your install, or through the gui using backup/restore.
Debian Jessie: CuBox-i4 (Primary) w/Static Routed IP and x509 / BeagleBone with OpenSprinkler / BeagleBone Planted Aquarium / 3x Raspbery Pi2b GPIO Slaves
Elemental Theme - node-domoticz-mqtt - Home Theatre Controller - AndroidTV Simple OSD Remote - x509 TLS Auth
Elemental Theme - node-domoticz-mqtt - Home Theatre Controller - AndroidTV Simple OSD Remote - x509 TLS Auth
- Dutchsea
- Posts: 120
- Joined: Tuesday 08 December 2015 13:22
- Target OS: Raspberry Pi / ODroid
- Domoticz version: v2023.2
- Location: The Netherlands
- Contact:
Re: Domoticz reinstall on USB drive; how to keep switch sett
That easy
, thx both.

Raspberry PI 3B on USB drive, Debian version: 12 (bookworm), Domoticz 2024.7
Aeon Z-Wave G5 stick, RFXCOM, Sonof Zigbee 3.0 Dongle plus E, Nefit Easy, Fritzbox, Buienradar, Sonos
Aeon Z-Wave G5 stick, RFXCOM, Sonof Zigbee 3.0 Dongle plus E, Nefit Easy, Fritzbox, Buienradar, Sonos
- TazDevl
- Posts: 9
- Joined: Friday 04 September 2015 10:29
- Target OS: Raspberry Pi / ODroid
- Domoticz version: NewBeta
- Contact:
Re: Domoticz reinstall on USB drive; how to keep switch sett
I'm switching to usb after my SD got corrupted again, think my psu (big apple charger) isn't as stable as expected...
Hope I can revive the SD card enough to copy the .db file
Hope I can revive the SD card enough to copy the .db file

- nayr
- Posts: 354
- Joined: Tuesday 11 November 2014 18:42
- Target OS: Linux
- Domoticz version: github
- Location: Denver, CO - USA
- Contact:
Re: Domoticz reinstall on USB drive; how to keep switch sett
beware of counterfeit SD cards, they just keep writing over the same small bit of flash continuously so they appear bigger then they are.. of course this corrupts everything.
even legit sd cards I went through a few before I found one reliable enough for being a domoticz appliance.. I am using Samsung Pro cards now after having both Sandisk and Kingston uSD crap out on me in short order.
even legit sd cards I went through a few before I found one reliable enough for being a domoticz appliance.. I am using Samsung Pro cards now after having both Sandisk and Kingston uSD crap out on me in short order.
Debian Jessie: CuBox-i4 (Primary) w/Static Routed IP and x509 / BeagleBone with OpenSprinkler / BeagleBone Planted Aquarium / 3x Raspbery Pi2b GPIO Slaves
Elemental Theme - node-domoticz-mqtt - Home Theatre Controller - AndroidTV Simple OSD Remote - x509 TLS Auth
Elemental Theme - node-domoticz-mqtt - Home Theatre Controller - AndroidTV Simple OSD Remote - x509 TLS Auth
-
- Posts: 121
- Joined: Sunday 11 October 2015 8:50
- Target OS: Raspberry Pi / ODroid
- Domoticz version: V3.6224
- Location: Holland
- Contact:
Re: Domoticz reinstall on USB drive; how to keep switch sett
I'm using a small SSD in an USB enclosure.nayr wrote: I am using Samsung Pro cards now after having both Sandisk and Kingston uSD crap out on me in short order.
Until now no problems.
RPI-2 + SSD / ESPEasy Sensors & Switches / Sonoff / RFLink / Action Switches / TP-Link switch / Node-Red / Reacticz
- Egregius
- Posts: 2592
- Joined: Thursday 09 April 2015 12:19
- Target OS: Linux
- Domoticz version: v2024.7
- Location: Beitem, BE
- Contact:
Re: Domoticz reinstall on USB drive; how to keep switch sett
What is the difference between SD Card and USB stick? Aren't they the same?
- nayr
- Posts: 354
- Joined: Tuesday 11 November 2014 18:42
- Target OS: Linux
- Domoticz version: github
- Location: Denver, CO - USA
- Contact:
Re: Domoticz reinstall on USB drive; how to keep switch sett
SD card dont have to go through the USB bus, its potentially faster than USB 2.0.. I dunno what the Pi's bus speeds are but my CuBox can definitely see higher speeds off microsd than usb..
in my case the SD card is for boot and main OS, all heavy writing is done to a 4TB eSata.. but its mostly just ftp storage for my IP cams.
in my case the SD card is for boot and main OS, all heavy writing is done to a 4TB eSata.. but its mostly just ftp storage for my IP cams.
Debian Jessie: CuBox-i4 (Primary) w/Static Routed IP and x509 / BeagleBone with OpenSprinkler / BeagleBone Planted Aquarium / 3x Raspbery Pi2b GPIO Slaves
Elemental Theme - node-domoticz-mqtt - Home Theatre Controller - AndroidTV Simple OSD Remote - x509 TLS Auth
Elemental Theme - node-domoticz-mqtt - Home Theatre Controller - AndroidTV Simple OSD Remote - x509 TLS Auth
- Dutchsea
- Posts: 120
- Joined: Tuesday 08 December 2015 13:22
- Target OS: Raspberry Pi / ODroid
- Domoticz version: v2023.2
- Location: The Netherlands
- Contact:
Re: Domoticz reinstall on USB drive; how to keep switch sett
Been reading various post that Raspian on USB is more stable and as a bonus much faster.Egregius wrote:What is the difference between SD Card and USB stick? Aren't they the same?
So expect the same applies to Domoticz on Rasbian on USB
Raspberry PI 3B on USB drive, Debian version: 12 (bookworm), Domoticz 2024.7
Aeon Z-Wave G5 stick, RFXCOM, Sonof Zigbee 3.0 Dongle plus E, Nefit Easy, Fritzbox, Buienradar, Sonos
Aeon Z-Wave G5 stick, RFXCOM, Sonof Zigbee 3.0 Dongle plus E, Nefit Easy, Fritzbox, Buienradar, Sonos
- Egregius
- Posts: 2592
- Joined: Thursday 09 April 2015 12:19
- Target OS: Linux
- Domoticz version: v2024.7
- Location: Beitem, BE
- Contact:
Re: Domoticz reinstall on USB drive; how to keep switch sett
What I mainly meant whas: why would a SD card get corrupted and an USB stick doesn't?
About speed... You made me think
What is you put all files upon boot in a ramdrive and sync them regularly to sd card? Wouldn't that be a big speed improvement?
About speed... You made me think

What is you put all files upon boot in a ramdrive and sync them regularly to sd card? Wouldn't that be a big speed improvement?
- Dutchsea
- Posts: 120
- Joined: Tuesday 08 December 2015 13:22
- Target OS: Raspberry Pi / ODroid
- Domoticz version: v2023.2
- Location: The Netherlands
- Contact:
Re: Domoticz reinstall on USB drive; how to keep switch sett
Googling shows different views as to why. Drivers, power supply, smaller memory cores (i doubt this), karma...
A discussion here https://www.raspberrypi.org/forums/view ... 62&t=83346
Some of the driver issues may have been fixed by now.
Maybe stability aint an issue anymore but its a fun project.
A discussion here https://www.raspberrypi.org/forums/view ... 62&t=83346
Some of the driver issues may have been fixed by now.
Maybe stability aint an issue anymore but its a fun project.
Raspberry PI 3B on USB drive, Debian version: 12 (bookworm), Domoticz 2024.7
Aeon Z-Wave G5 stick, RFXCOM, Sonof Zigbee 3.0 Dongle plus E, Nefit Easy, Fritzbox, Buienradar, Sonos
Aeon Z-Wave G5 stick, RFXCOM, Sonof Zigbee 3.0 Dongle plus E, Nefit Easy, Fritzbox, Buienradar, Sonos
- Egregius
- Posts: 2592
- Joined: Thursday 09 April 2015 12:19
- Target OS: Linux
- Domoticz version: v2024.7
- Location: Beitem, BE
- Contact:
Re: Domoticz reinstall on USB drive; how to keep switch sett
Hmm, no noticable speed difference between running domoticz from SD or from tmpfs. Timigs are exactly the same: 0,097 seconds to read status of 60 devices of a floorplan thru json api.
So I'm not going to look any further for running from memory.
So I'm not going to look any further for running from memory.
- Dutchsea
- Posts: 120
- Joined: Tuesday 08 December 2015 13:22
- Target OS: Raspberry Pi / ODroid
- Domoticz version: v2023.2
- Location: The Netherlands
- Contact:
Re: Domoticz reinstall on USB drive; how to keep switch sett
Nice test. Indeed shows there is no dif.
For reference, article which was my starting point. No reasons/proof provided for better speed/stability.
Just took it for granted.
http://raspipress.com/2013/05/install-a ... ash-drive/
For reference, article which was my starting point. No reasons/proof provided for better speed/stability.
Just took it for granted.
http://raspipress.com/2013/05/install-a ... ash-drive/
Raspberry PI 3B on USB drive, Debian version: 12 (bookworm), Domoticz 2024.7
Aeon Z-Wave G5 stick, RFXCOM, Sonof Zigbee 3.0 Dongle plus E, Nefit Easy, Fritzbox, Buienradar, Sonos
Aeon Z-Wave G5 stick, RFXCOM, Sonof Zigbee 3.0 Dongle plus E, Nefit Easy, Fritzbox, Buienradar, Sonos
-
- Posts: 6
- Joined: Sunday 27 November 2016 12:40
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 3.5877
- Location: Netherlands
- Contact:
Re: Domoticz reinstall on USB drive; how to keep switch settings
Although this is a pretty old post right now, I thought to document what I just did to make the change from the SD to a USB drive work. I had to collect information from several places.
This is my first post on this forum, so please bare with me.
I used an 8MB mini USB stick, and wanted to have Domoticz run exclusively from that stick.
Warning:
Don't be tempted to install and use usbmount, I lost a few hours trying to get the access rights working, but failed doing that.
Mounting the USB drive:
Find out what the UUID is: (safer than using sda1 or 2)
ls -l /dev/disk/by-uuid
Depending on the format, you either get a very long string, or a short one like this : 66C8-1C51
You can try to mount this first with:
sudo mount UUID=66C8-1C51 /mnt/usb -o uid=pi,gid=pi
The uid and gid bits are important in order to get user access to the drive later on.
Use
df
to see if it worked. You should get something like this:
/dev/sda1 7817216 26692 7790524 1% /mnt/usb
Check the ownership rights:
ls -al /mnt/usb
If that works, unmount the drive again with:
umount /dev/sda1
Find out what the format of the USB drive is:
df -T
And make a note.
To mount the drive at boot time, do this:
sudo nano /etc/fstab
And add this:
# USB stick
UUID=66C8-1C51 /mnt/usb vfat defaults,umask=000,uid=pi,gid=pi 0 2
vfat is the format that was reported with df -T
The additional umask will set everything on (rwxrwxrwx), you can modify that if you want.
You can reboot the Pi now to see if it all worked.
Now copy the domoticz installation in /home/pi to the USB disk: (you may have to install rsync first)
rsync -rlptDOv /home/pi/domoticz /mnt/usb --owner --group
--owner and --group will maintain the original rights.
Although I did not see any effects when I tried, I still modified this file, just in case:
sudo nano setupVars.conf
change the directory from /home/pi/domoticz to /mnt/usb/domoticz
Preserve an original copy of the startup script:
sudo cp /etc/init.d/domoticz.sh /etc/init.d/domoticz.orig
Now modify the startup script:
sudo nano /etc/init.d/domoticz.sh
Change the following:
DAEMON=/mnt/usb/domoticz/$NAME
#DAEMON=/home/pi/domoticz/$NAME
Update the systemd environment:
sudo systemctl daemon-reload
Restart the domoticz server:
service domoticz.sh restart
Check it, if all went well, reboot the Pi and check again.
Enjoy!
This is my first post on this forum, so please bare with me.
I used an 8MB mini USB stick, and wanted to have Domoticz run exclusively from that stick.
Warning:
Don't be tempted to install and use usbmount, I lost a few hours trying to get the access rights working, but failed doing that.
Mounting the USB drive:
Find out what the UUID is: (safer than using sda1 or 2)
ls -l /dev/disk/by-uuid
Depending on the format, you either get a very long string, or a short one like this : 66C8-1C51
You can try to mount this first with:
sudo mount UUID=66C8-1C51 /mnt/usb -o uid=pi,gid=pi
The uid and gid bits are important in order to get user access to the drive later on.
Use
df
to see if it worked. You should get something like this:
/dev/sda1 7817216 26692 7790524 1% /mnt/usb
Check the ownership rights:
ls -al /mnt/usb
If that works, unmount the drive again with:
umount /dev/sda1
Find out what the format of the USB drive is:
df -T
And make a note.
To mount the drive at boot time, do this:
sudo nano /etc/fstab
And add this:
# USB stick
UUID=66C8-1C51 /mnt/usb vfat defaults,umask=000,uid=pi,gid=pi 0 2
vfat is the format that was reported with df -T
The additional umask will set everything on (rwxrwxrwx), you can modify that if you want.
You can reboot the Pi now to see if it all worked.
Now copy the domoticz installation in /home/pi to the USB disk: (you may have to install rsync first)
rsync -rlptDOv /home/pi/domoticz /mnt/usb --owner --group
--owner and --group will maintain the original rights.
Although I did not see any effects when I tried, I still modified this file, just in case:
sudo nano setupVars.conf
change the directory from /home/pi/domoticz to /mnt/usb/domoticz
Preserve an original copy of the startup script:
sudo cp /etc/init.d/domoticz.sh /etc/init.d/domoticz.orig
Now modify the startup script:
sudo nano /etc/init.d/domoticz.sh
Change the following:
DAEMON=/mnt/usb/domoticz/$NAME
#DAEMON=/home/pi/domoticz/$NAME
Update the systemd environment:
sudo systemctl daemon-reload
Restart the domoticz server:
service domoticz.sh restart
Check it, if all went well, reboot the Pi and check again.
Enjoy!
-
- Posts: 822
- Joined: Wednesday 12 November 2014 15:01
- Target OS: Raspberry Pi / ODroid
- Domoticz version: latest b
- Contact:
Re: Domoticz reinstall on USB drive; how to keep switch settings
I followed the below procedure from this forum to move domotics to an usb stick.
ls -l /dev/disk/by-uuid
sudo mkdir /media/usb1
sudo mount UUID=E9B1-43F0 /media/usb1 -o uid=pi,gid=pi
DF
You should get something like this:
/dev/sda1 7817216 26692 7790524 1% /media/usb1
Check the ownership rights:
ls -al /media/usb1
If that works, unmount the drive again with:
sudo umount /dev/sda1
Find out what the format of the USB drive is:
df -T
And make a note.
To mount the drive at boot time, do this:
sudo nano /rsyncetc/fstab
And add this:
# USB stick
UUID=E9B1-43F0 /media/usb1 vfat defaults,umask=000,uid=pi,gid=pi 0 2
vfat is the format that was reported with df -T
The additional umask will set everything on (rwxrwxrwx), you can modify that if you want.
You can reboot the Pi now to see if it all worked.
Now copy the domoticz installation in /home/pi to the USB disk:
rsync -rlptDOv /home/pi/domoticz /media/usb1 --owner --group
Although I did not see any effects when I tried, I still modified this file, just in case:
sudo nano setupVars.conf
change the directory from /home/pi/domoticz to /media/usb1/domoticz
@pvk does not exist
Preserve an original copy of the startup script:
sudo cp /etc/init.d/domoticz.sh /etc/init.d/domoticz.orig
Now modify the startup script:
sudo nano /etc/init.d/domoticz.sh
Change the following:
DAEMON=/media/usb1/domoticz/$NAME
#DAEMON=/home/pi/domoticz/$NAME
Update the systemd environment:
sudo systemctl daemon-reload
@pvk gives an error
Restart the domoticz server:
service domoticz.sh restart
@pvk gives an error: "could not open lock file /var/run/domoticz.pid, I rebooted the machine, everything seems to work!
I did get a couple of errors:
1) sudo nano setupVars.conf does not exist
2) sudo systemctl daemon-reload gives an error
3) service domoticz.sh restart gives an error: "could not open lock file /var/run/domoticz.pid,
I rebooted the machine, everything seems to work!
I missed one command in these procedure, to delete the old domoticz folder!
Are these errors a problem, otherwise a try to delete the original domoticz folder...
ls -l /dev/disk/by-uuid
sudo mkdir /media/usb1
sudo mount UUID=E9B1-43F0 /media/usb1 -o uid=pi,gid=pi
DF
You should get something like this:
/dev/sda1 7817216 26692 7790524 1% /media/usb1
Check the ownership rights:
ls -al /media/usb1
If that works, unmount the drive again with:
sudo umount /dev/sda1
Find out what the format of the USB drive is:
df -T
And make a note.
To mount the drive at boot time, do this:
sudo nano /rsyncetc/fstab
And add this:
# USB stick
UUID=E9B1-43F0 /media/usb1 vfat defaults,umask=000,uid=pi,gid=pi 0 2
vfat is the format that was reported with df -T
The additional umask will set everything on (rwxrwxrwx), you can modify that if you want.
You can reboot the Pi now to see if it all worked.
Now copy the domoticz installation in /home/pi to the USB disk:
rsync -rlptDOv /home/pi/domoticz /media/usb1 --owner --group
Although I did not see any effects when I tried, I still modified this file, just in case:
sudo nano setupVars.conf
change the directory from /home/pi/domoticz to /media/usb1/domoticz
@pvk does not exist
Preserve an original copy of the startup script:
sudo cp /etc/init.d/domoticz.sh /etc/init.d/domoticz.orig
Now modify the startup script:
sudo nano /etc/init.d/domoticz.sh
Change the following:
DAEMON=/media/usb1/domoticz/$NAME
#DAEMON=/home/pi/domoticz/$NAME
Update the systemd environment:
sudo systemctl daemon-reload
@pvk gives an error
Restart the domoticz server:
service domoticz.sh restart
@pvk gives an error: "could not open lock file /var/run/domoticz.pid, I rebooted the machine, everything seems to work!
I did get a couple of errors:
1) sudo nano setupVars.conf does not exist
2) sudo systemctl daemon-reload gives an error
3) service domoticz.sh restart gives an error: "could not open lock file /var/run/domoticz.pid,
I rebooted the machine, everything seems to work!
I missed one command in these procedure, to delete the old domoticz folder!
Are these errors a problem, otherwise a try to delete the original domoticz folder...
Raspberry (raspbian on rpi 3) , Domoticz Beta, dzVents , RFXtrx433e, P1, Hue, Yeelight, Zwave+, X10, ESP(easy), MQTT,Weather Underground, System Alive Checker, Domoticz Remote Server to RPI with Google Assistant,
Jablotron connection, Ikea
Jablotron connection, Ikea
Who is online
Users browsing this forum: Google [Bot] and 1 guest