Where to find snapshots or backups on read only sdcard

Unfortunately, I’m a victim of my own folly with no backups and using the SDcard for running Home Assistant on a Pi4.

The SDcard seemed to have died after or during an OS update, and is stuck in read-only mode. I tried cloning to another SDcard, but the same contents will not boot at all.

The only corrupt partition is the hassos-data partition.

Things I tried that did not work:

  • Attempted to fix the partition on a cloned card with e2fsck (hassos-data partition)
  • Flashed a new hassos then copied the fixed hassos-data partition over
  • Looked into the folders inside the hassos-data partition…

Within the hassos-data partition, I see 3 folders:

  • docker*
  • lost+found*
  • supervisor
    *Needs root to view

However, I’m not sure where to look to find my HA config files to restore.

As title states, where can I find the snapshot locations or backups created on hassos for me to restore?

Scrap that. I don’t actually know.

Shot in the dark

Locate Snapshots on hassos-data

Snapshots are usually stored in the following directory within the hassos-data partition:

/mnt/data/supervisor/backup/
  1. Mount the hassos-data Partition:
  • Connect the SD card to a Linux system.
  • Mount the hassos-data partition with root privileges.
sudo mount /dev/sdX8 /mnt

Replace /dev/sdX8 with the correct partition identifier for your hassos-data.
2. Navigate to the Snapshots Directory:

  • Go to the supervisor backup directory.
cd /mnt/supervisor/backup
  • You should find .tar files here, which are your snapshots.
  1. Copy the Snapshots:
  • Copy these files to a safe location.
sudo cp *.tar /path/to/backup/location

Recovering Configuration Files

If snapshots are unavailable or corrupted, you can attempt to recover configuration files manually:

  1. Key Directories to Check:
  • /mnt/supervisor/homeassistant/: This folder contains your configuration.yaml and other Home Assistant configuration files.
  1. Copy Important Files:
  • Backup the configuration files.
sudo cp -r /mnt/supervisor/homeassistant /path/to/backup/location
  1. Examine and Validate:
  • Check if the files are readable and uncorrupted.

If the Files Are Corrupted

If the snapshot files or configuration files are corrupted, you can attempt to repair them:

  1. Repair File System Errors:
  • Use e2fsck to check and repair file system errors.
sudo e2fsck -v -y /dev/sdX8
  1. Extract and Validate Snapshots:
  • Test and extract .tar files with:
tar -tvf snapshot.tar
tar -xvf snapshot.tar -C /path/to/extract/location
1 Like

I think I’m getting somewhere… tho I might be worsening my system instead lol.

This is what I have found and done so far:

  1. I found that the cloned image works!
    • I enabled ssh by following the debugging docs. I created a GPT (NOT MBR) formatted USB via Gparted and named + labelled the partition as CONFIG since I didn’t know if it was partition name or label that requires it…

Use a USB drive with a partition named CONFIG (case sensitive) formatted as FAT, ext4, or NTFS. Create an authorized_keys text file (without a file extension) containing your public key(s), one per line, and place it in the root of the USB drive’s CONFIG partition. The file must use POSIX-standard newline control characters (LF), not Windows ones (CR LF), and needs to be ASCII character encoded (i.e. mustn’t contain any special characters in the comments).


…reboot the device leaving the drive attached, which automatically triggers the import.

  1. In the system, I ran ha backups list and found nothing… I guess I don’t have backups?
  2. I am able to access the observer http://homeassistant.local:4357/ with no issues, but no luck on https://homeassistant.local:8123/
  3. I ran a couple ha ... commands, but was met with an error
Error returned from Supervisor: System is not ready with state: setup
  1. I ran the following commands:
    • ha banner :white_check_mark: works
    • ha supervisor repair :white_check_mark: works
    • ha supervisor restart :white_check_mark: works
    • ha available-updates :white_check_mark: works
    • ha available-updates :white_check_mark: works, but returns a blank []
  2. Not sure what’s going on, I then figured… if it was borked during an OS update, could I re-install the OS again?
    • Searching around brought me to this reddit post.
    • Try this: ha os update --version n.n. Replace n.n with version you want…

    • So I did, but running ha os update --version 14.1, but was met with Error: Version 14.1 is already installed
  3. I then downgraded with ha os update --version 14.0.
  4. Unfortunately, that did not work. I am still at the same place as step #3.

With my OS downgraded, I am still not able to access https://homeassistant.local:8123

  • http://homeassistant.local:4357 works tho…

I then tried to mess around with docker while I still have access with ssh:

  • docker exec -it homeassistant /bin/bash:
Error response from daemon: container 204c2252d5cad547a4f3d413ccf20ac3aa01998e7ec32a04c5f03d646a4c2a82 is not running

Well uhh… that’s not good. I have no idea whatever the container is with that long name, so I tried running a few docker commands to try find the container id.

  • docker image list :x: not listed here
  • docker container list :x: not listed here either…

Maybe… I can try running a docker command to update or overwrite a system thing to make this work?

Looking at the links listed under docker image list, maybe I can manually run a container using the links under the repository column?

  • eg: ghcr.io/home-assistant/raspberrypi4-64-homeassistant

I visited the link and chose a tag that happened to have a lot of downloads: tag: 2024.12.3

  • docker run ghcr.io/home-assistant/raspberrypi4-64-homeassistant:2024.12.3

Unfortunately that did not work. I’m still at the same place.

I’ll try it out. I think I borked my system even more after messing around with docker. I’ll re-clone my storage and try again.

The other things I haven’t tried yet are:

  • changing the boot slot after enabling ssh on the cloned storage.
  • using the update bundle according to the dev docs

After a long day of flashing / backing up / updating / downgrading and other stuff in between, I have successfully restored my HA instance! :tada:

To retrace my steps, this is what I did:

  1. Clone the read-only SDcard to a spare USB stick (Let’s call it sdb)
  2. Use the Pi Imager, and create a new home assistant image on another USB stick (Let’s call it sdc)
  3. Plug both sdb and sdc to a linux machine and open gparted.
  4. Copy each partitions over one by one from sdbsdc and paste to overwrite the newly flashed partitions on sdc.
    • After copy pasting the last partition (hassio-data), gparted should automatically detect and fix any partition issues.
  5. Enable USB boot on the Pi4, and also ssh access
  6. Plug in sdc to the pi and boot it up
  7. ssh into the HA instance with ssh [email protected] -p 2222
  8. Then follow the raoc update guide to use the system update bundles
    • cd /mnt/data/
    • curl -L -O https://github.com/home-assistant/operating-system/releases/download/14.0/haos_rpi4-14.0.raucb
      • Since I am downgrading and using a Pi4, I chose haos_rpi4-14.0.raucb.
    • rauc status - Check the current version and booted slot
    • reboot '0 tryboot' - My device was alreay on slot 1, so I changed the reboot to explicitly boot to slot 0.

After restarting into the downgraded slot, I now have a working instance of Home Assistant again! :smiley:


However… I’m still curious on where the backups are located, as per the title. With a working system, I can now see my backup files with ha backups list, but where can I find it with ssh?

And follow up question: I had access to the /mnt/supervisor/homeassistant/ directory under hassio-data partition. I turned it into a TAR archive and tried to “restore” from it, but it wouldn’t work. How would I use the data to create my own TAR archive that the onboarding screen would accept?

1 Like