this post was submitted on 09 Oct 2024
32 points (97.1% liked)

Selfhosted

40696 readers
320 users here now

A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don't control.

Rules:

  1. Be civil: we're here to support and learn from one another. Insults won't be tolerated. Flame wars are frowned upon.

  2. No spam posting.

  3. Posts have to be centered around self-hosting. There are other communities for discussing hardware or home computing. If it's not obvious why your post topic revolves around selfhosting, please include details to make it clear.

  4. Don't duplicate the full text of your blog or github here. Just post the link for folks to click.

  5. Submission headline should match the article title (don’t cherry-pick information from the title to fit your agenda).

  6. No trolling.

Resources:

Any issues on the community? Report it using the report flag.

Questions? DM the mods!

founded 2 years ago
MODERATORS
 

I run my HomeAssistant on a RaspberryPi 4 from a SD card. Two days ago I did a upgrade to the newest version (I don't remember if it was HomeAssistant or the Operating System) and since then it does not boot anymore.

I connected it via HDMI to a screen and got those errors:

It looks to me that the SD card is corrupted or something. Any idea if I can fix it in any way or do I need to redo the setup from scratch?

all 11 comments
sorted by: hot top controversial new old
[–] [email protected] 16 points 2 months ago (1 children)

Your image is itty-bitty here in Lemmy-land, at least, but a dead SD card on HA is... unsurprising.

It might be recoverable if you plug it into a linux box and try to extract the data, but as for recovering it, it's the same as a dead hard drive: you might get data back, but the physical media is trash.

You probably want to NOT use a SD card and pick any other option (USB real SSD, NVMe hat, etc.) because, well, SD cards are not very good at this kind of use case. (HA writes a lot of historical data, and is basically always chattering away on the disk.)

[–] [email protected] 3 points 2 months ago (1 children)

I think you should be able to click on the image and make it bigger.

https://i.imgur.com/HZZZwI9.jpeg

[–] [email protected] 3 points 2 months ago (1 children)

It's not clickable but it might be because I'm not caching/proxying images on my install (single user install, so really, no reason to do so) and that causes some other unexpected interactions.

But yeah, that looks like a dead SD card; the failed to mount the partition and then ext4 complaining it's in read-only mode is... probably not going to result in good things for your data :(

[–] [email protected] 1 points 2 months ago

Ah, I didn't make it a link to be clickable, sorry, fixed it now for everyone else ^^

[–] [email protected] 12 points 2 months ago

Your SD card is shot. SD cards aren't built for sustained read/write cycles, and RPi installs regularly kill them from excessive access to disk from things like logging and DB access.

On HA specifically, you can solve for part of this by reducing all logging to minimal, and then for the bulk of the rest setup something like log2ram to store system logs in RAM and prevent wearing out the SD disk.

A more permanent fix would be to get an SSD instead, but that's not always an option.

[–] [email protected] 8 points 2 months ago (1 children)

The SD card is broken, but not totally dead yet.

So, decide now if you want to try and rescue some files from it, then DO NOT USE IT anymore until the real data recovery operation starts. No further tries to boot, no fsck etc.

[–] [email protected] 7 points 2 months ago* (last edited 2 months ago)

To add to this, I’d personally just clone the card immediately to somewhere else then do all the recovery efforts on the clone; if only to avoid burning out the SD card even more during recovery.

Edit: Not sure if that would be better or worse.

[–] [email protected] 4 points 2 months ago

Those EXT4-fs write access unavailable errors look spooky. Should probably do some standard Linux FS testing (fsck)

I’ve not had to recover anything from a raspberry pi SD card, but in the case you start from scratch - and considering it’s upset at write access - you may be able to plug it into another machine and at least salvage bits of its configuration that way.

[–] [email protected] 2 points 2 months ago* (last edited 2 months ago)

2 things, one of which has already been said

Get an SSD and a usb cable for it. Boot off that. Be aware that not all cables are the same (have a Google for usb 3 SSD cables for home assistant before you buy one). There's a little song and dance you have to do to boot off ext SSD but it's not hard and doesn't take long (Google).

That combo will eliminate the SD card issues in the future. But you also need to look into the Google Drive backup add-on. Get that for when shit goes down.

With those two things you should be all set and eliminate this ever happening again. If it does you have a backup.

[–] [email protected] 1 points 2 months ago

Hope you were able to fix your Home Assistant. I just came to quickly recommend a way to easily backup your installation. https://github.com/sabeechen/hassio-google-drive-backup