Restore function with HAOS - What is it actually doing?

I recently installed HAOS on my Raspberry Pi 4. After I got it running, I created a backup, and begun fooling around and adding add-ons and configuring other things.

I mounted an external ext4 HDD, then ended up messing up some configuration with one of the add-ons and decided to do a full restore to that original backup. Unfortunately because of how I mounted the external HDD to the /media/ folder, I lost around 8tb of data because the restore function clears that folder. This sucks, and because I have little experience with Linux, and even less with data recovery, I’m in a bad spot.

I’ve used gddrescue and created a full image of that 8tb disk because I read that’s a smart/safe first step to do. I haven’t touched the drive other than that. My question is, what is happening exactly when HA ‘restores’ its OS? Is it formatting everything? Removing? Copying blank data over it? I don’t really know where to go from here, but these are common questions I’m finding that I can’t find in the HA docs.

A full backup restore does not replace the OS.

It replaces the Docker containers that Home Assistant and (if you have any) Addons run in.

Not sure what you mean by " when HA ‘restores’ its OS". If you do a clean install from the Home Assistant image then yes everything including the OS is wiped and replaced.

I used the installation guide here to install the HAOS. When I said ‘when HA ‘restores’ its OS’ I meant when I use the ‘restore’ function.

What does ‘replaces the Docker containers’ mean exactly? And how would that affect the /media/ folder and all potential data in it or mounted to it?

Using that install method Home Assistant and Addons run in Docker containers. They’re like a package of all the code and dependencies. https://www.docker.com/resources/what-container/ They don’t include an OS like a VM.

Screenshot 2022-08-20 at 12-48-48 What is a Container - Docker

Home Assistant and the Addons are the Apps in that picture.

Looking at one of my backup contents (they’re just compressed files you can open with winzip, 7zip, or winrar), the /media folder gets it’s own archive. So whatever you had in there when you made the backup will be replaced with the contents of the backup.

Thank you for the explanation. I know what containers are, but I think the last bit you wrote is almost getting to what I’m asking about. ‘will be replaced with’ means what exactly? Is this akin to ‘rm -r /media/’ followed by copying the backup’s /media/ folder where the previous one was? Or copying the contents? I suppose I’m looking for the actual action, assigning, deleting+copying, etc., because it doesn’t seem like the drive itself was formatted.

The reason I’m asking is because it may be relevant to getting my data back if I know how exactly it was deleted. It seems like a delete followed by a copy of the backup.