Help! My whole /config dir got deleted

Hi Guys,

My apologies in advance if this is not the right topic, but I did something stupid and I’m a little desperate here. While I was struggling with creating a git repo for my HA /config dir, in order to keep my files safe, after issuing a few git commands, my whole directory disappeared (Feel the irony?).
The config dir is (was) on my Synology NAS, just like my HA instance, running in a docker container. The config remote dir was mounted on my mac, and when the accident happened, I was playing around in that directory to sync the files to my git server, running also on my NAS. The shared directory that holds the files on the NAS has no recycle bin enabled.
The nice thing is, HA is still running without noticing anything about this, since it loaded up the config when it was started up a few days ago. The not-so-nice thing is HA will be restarted by an automation in a few hours (at 2 AM), so then I’ll lose everything.

So this is where I am. Sitting on a timed bomb.
My question: what would you guys do in my place to get back the configuration and all files? Is there a hidden dump-config tool in HA that dumps the current configuration from where I can reconstruct my working setup?

Thank you in advance for your help.

PS: …and yes, this is a lesson to learn. Always backup, don’t be so stupid like me.

I’d goto the synology forums and beg. The only thing you’ll get from the hass database is entity_id’s and their state changes. Nothing really useful unless you want your old entity names back but I’m guessing those aren’t really what you’re looking for.

Have you tried to copy files from container to host?
Something like this:
docker cp :/file/path/within/container /host/path/target

If you don’t know the location of config files in docker container then first connect via ssh to container:
docker run -it /bin/bash

Thanks for the answer. Synology forums say two things:

  • use the shared folder’s recycle bin (if turned on) feature - it’s turned off on my folder
  • take the drive out of the NAS, plug it in another machine, mount it and try running some undelete tools on it - it’ll be plan B for me if I don’t find a better/quicker solution

Thanks, I’ve checked the config dir in the container itself, empty.
Would be nice if HA held a cached version of the config files while running, somewhere in it’s core path.

Update: good news, git fsck --full saved the day.
I’ve found all my cached files in the .git folder, all I lost is the file names, no big deal. Everything is working now.

Cheers!

3 Likes