I believe the SD card in my RPi running Hass.io is dying so I need to migrate everything over to a new SD card running a new install of Hass.io. Unfortunately every time I try to create a Snapshot it fails so there’s no way I can import a Snapshot to the new Hass.io install. Is it possible to just copy the config files over and have all my Zwave devices, automations and other settings work with the new install of Hass.io? If so, what directories and files should I copy over?
You have a couple of options. You can copy the /config directory. As long as you also include the /config/.storage directory (hidden), then you should be ok.
You can also clone the SD card. There may be a way to do this on a Windows machine, but here is how to do it on a Mac or Linux based system/VM using the DD command. Your syntax will be something like what I spelled out here: Best way to replace the SD card?
What makes you think the sd card is dying? Is it because snapshots fail?
Copying config files will get most of it working, but if you are using any addons then you’d be missing some things. I would first check that the SD card isn’t just too full to do a snapshot. Sometimes your homeassistant_v2.db file can grow huge and cause problems… or if you aren’t in the habit of deleting snapshots from your instance. Both of those issues are very easy to fix.
I was trying to avoid DD’ing just in case a Hass.io database/file system was corrupted and/or the SD card is dying. I scp’d everything to the new Hass.io install and at first all my Zwave devices were missing the metadata (it was a mess). I started with a new Hass.io install, removed the Aeotec-Z-Stick and only scp’d these files over to the new install:
According to this the pyozw.sqlite would be recreated so I omitted copying it over to avoid any further problems.
Everything has been working great! I can create full snapshots from the web UI, the SSH server and Configurator Add-ons are no longer crashing, and there’s no delay turning my Zwave devices on and off.
I thought the SD card was dying or something was corrupted because of weird anomalies I was experiencing. Yes, the inability to create snapshots from the web UI or CLI was part of it. For example, the SSH Server and Configurator add-ons would crash sometimes once or every other day. Executing a reboot from the web UI or hassio host reboot would fail. It would require me to power cycle the RPi each time. Also, Zwave devices had high latency when switching on and off. The SD card was not full either. I posted about this in another thread: