Could someone please create a clone sd util for Home Assistant OS running on Pi

Hi Devs,

I am new to Home Assistant and running it on Pi4 8GB with SD card (yes I know) it would be great to use the RPI clone capability to create live clones of the SD card ideally to another PI but as a minimum to another SD on the same PI.

Would be great to provide this level of resilience in case of SD card failure.

The snapshot service backs up everything you need to start another identical instance.

2 Likes

so it does, BUT what would be better is frictionless process, so image the sd card that running in LIVE and allow that to be imaged to another SD, snapshots are ok but you are down for an hour at least to get the new HAOS up with your last snapshot

1 Like

This capability does not exist when running HassOS:

Home Assistant Operating System is not based on a regular Linux distribution like Ubuntu. It is built using buildroot and it is optimized for running Home Assistant, especially on single board compute (SBC) devices like the Pi, ODROID, NUC and Tinker Board

See: GitHub - home-assistant/operating-system: đź”° Home Assistant Operating System

Hence my request to BUILD the capability. :slight_smile:

Reading back the whole SD card like that would require unmounting the file systems on the SD card, and since Home Assistant OS is running from those file systems, in order to do that you would need to shut down the Pi and then boot from a different file system.
You could theoretically do this by having a small OS installed in a separate partition on the SD card that Home Assistant reboots to, and it then runs the backup and then reboots back to regular home assistant once it is done.

The trouble with doing this, however is I think it would defeat the purpose of what you’re trying to achieve with this as a plan, which is to minimise downtime.
Home Assistant would be down for the length of the backup, every backup, instead of being down for the length of time it takes to image a new SD card and then restore the snapshot just once, when you leave SD card fails.

Snapshots are quite quick to restore nowadays, so maybe a more accessible option to shrink that downtime further is to have a SD card that is imaged when the same version of Home Assistant OS as the system you are currently running, and whenever you update your live system, you reimage the SD card to the same version? That way if your SD card fails and you need to switch it out, you can just put in the already imaged spare SD card and then restore the snapshot, which has all the main software already, and you only need to wait for the snapshot to load.

Another thought though, if the speed you can write to the SD card bothers you, maybe start looking at switching to a SSD. You could pick up a 64gb for pennies these days and they run rings around SD cards in terms of performance, both when you are restoring a system and when you are running day to day.
They’re also much less likely to fail, reducing the likely hood of you needing to restore the backup at all, but even if a update goes really bad, it will be very very fast to revert back and get up and running again

other option could be to have a second pi with HAOS running and the ability to bring the snapshot up but then HAOS to allow an active passive failover capability

1 Like

This would be nice. Not everyone would have enough running through their home assistant to make it worth having a complete second system to run just as a backup (keeping in mind people run this on NUCs and old laptops and so on) but for those whose homes are fully wired to be smart and have everything controlling through home assistant, it would be something to consider.

It can be worth taking this thinking into your choices of smart devices as well: will this function doing its main purpose if my home assistant goes down. Many smart bulbs fail this test, but most smart switches do fine, as an example

If nothing else, I’d settle for:

  • snapshots on a schedule (and certain system events, like starting an update)
  • being able to set an external destination for snapshots, whether a USB or a network share
1 Like

And you can do both of that.

Not sure I see any benefit of having two SD cards with the same data.
They would both wear down having it like that and when you need the second card it’s probably already so worn down that it will fail soon anyways.

The extra load from becoming the primary would probably not help, like a raid disk failing while restoring to a new disk. I’ve never seen any info on a SD card to help you identify a week or site of manufacture either, so it would be hard to ensure separate batches…

Mirrored SSDs anyone?

No. You can’t.

You can take snapshots to the SD card (or whatever device HA is running off.) You can then copy those snpashots to another device.

What I’d like to see is to save the snapshots directly to another device.

In my case, for example, I used the Samba Backup to schedule snapshots which were then copied to my NAS. But the snapshots were still written to the SD card, first.

They are of little use there. If I had to restore, I’d have to extract them off the SD card before I could use them on the new HA install. And the most likely reason for having to restore would be a failed SD card. And the most likely reason for a failed SD card is because they are known to fail after a certain number of writes. And writing the entire snapshot every day only makes that more likely.

I did post a feature request for this, but it wasn’t well received.

Sorry but I probably miss the most important but your discussion looks to me completely irrelevant with Pi4 ! You have the opportunity to run HA from SSD plugged on PI4 reducing at the extreme risk of failure of storage device compared at SD ! It’s supported by Hassio so pretty easy to setup (only drawback you might have is need to use non powered USB hub between SSD and Pi4…).
I don’t even speak about important speed increase also when you do that compared at SD Card :wink:

How about using “home assistant google drive backup” supervisor addon?

If you are looking to just have a “ready to go” SD card then setup your HA on the card the way you like with any addons/devices/automations/etc. then power down the Pi then connect the SD card to a PC/mac using a usb adapter.
Once connected use a program like balena etcher(or similar) to create an image of the card.
You can then use the same program to restore the image o as many other spare/backup cards as you like.

1 Like

I think some of you are missing the point. The same thing happened on my other feature request post (see above.)

The first thing a new user to HA sees is the “Getting Started” page.

They are presented with a list of recommended hardware:

Then, when the beginner posts on this forum, they’re told they shouldn’t use an SD card, shouldn’t use a Raspberry Pi, shouldn’t use the native database, etc.

Frankly, I think HA could be a world-class product if only a small amount of effort were diverted away from dismissing beginner questions and toward developing simple, user-friendly solutions.

For the record, the above-mentioned Google Drive Backup add-on is a great example of a developer who went the extra mile to develop and document a solution which just works, right out of the box, without forcing the user to climb a steep learning curve. But even so, it can’t solve the underlying problems of how HA produces the snapshots in the first place.

Agreed, that’s not how it should be. USB boot is only a recent addition and now that it’s stable it would be a value add to have it in the getting started guide, since the process is pretty much the same now. That way new users can balance up the two options there against their needs/budget/intended features more readily, and ask advice if they want the community’s experience with the different options.

When such users do reach the forums here for help, we should definitely be helping them with their chosen set up so long as it is a supported one. That isn’t to say that we shouldn’t suggest alterations to how they have chosen to set it up, as long as we can articulate the benefits to that user’s particular situation, and still offer advice on how their current setup can also achieve what they are aiming for.

And “because SD cards suck” isn’t really articulating a benefit, it is much better to be focussing on the positives and how your suggestion improves things, than why the other option does not. No need to sound like politicians :sweat_smile:

Sorry if any of my above came across sounding like I was aiming to discount the OP’s situation or chosen setup, I was aiming to think around possible problems implementing something like they were asking for so we can know the challenges up front, but also offer ideas about how what we have now could be used to get as close to the goal as possible in the meantime :pray:

1 Like

Thank you, well said!

I’m pretty thick-skinned, and have had a career in IT, including lots of development and customer support. So I’ve been able to stick with HA and extract a lot of value for me.

But I cringe at some of the replies I see to posts here.

A user will ask an honest question, and instead of a helpful answer, they’ll get a barrage of unhelpful, dismissive and even demeaning posts. Some are from folks who clearly didn’t read and understand the question. Maybe they saw one word and went off on a tangent. Example: this thread and the other thread I linked to above got responses recommending add-ons which had no relation to the underlying problem. They’re great add-ons, but not helpful to the OP, and they detracted from the whole purpose of the Feature Requests forum; improving the native HA functionality.

Some are from the holier-than-thou crowd who believe their superior knowledge of obscure details means they can rail on the uninitiated as unworthy of using this product. I can’t see how this helps HA achieve its full potential as the best-in-class product it should be.

Obviously there are many ways for someone posting here to feel unwelcome. Probably most aren’t intentional or as blatant as the above examples. But it all adds up to a very exclusionary attitude. All these tangential posts muddy the thread and detract from those who are sincerely trying to improve the product and help the users.

This is a very active forum, and topics fly by faster than most people can handle. Those of us who scan all new posts must choose where to spend our time. It astonishes me how many folks take the time to write unhelpful posts instead of moving on to a thread where sharing their experience can contribute in a positive way.

Yes, I’m violating my own rule by spending my time writing this. But if even one reader takes it to heart and pauses to consider how their posts will contribute, it was worth it.

2 Likes

Wow…
Maybe people try and be helpful by directing you to things that you may have missed?

It’s not that uncommon that people just haven’t noticed integrations or custom components that do exactly what people ask for.

And regarding writing directly to a off site drive vs copying it there.
Well… If you had included, i know you can use… But it still saved on the sd card then I would agree it would be unnecessary comment to write it exists.
But as that information was missing one can only assume that it’s something that is unknown to the asker.

As always. If you want a very strict topic then make sure the question is clear and add all the details that you don’t want as suggestions.

I am an IT guy and have built lots of customer experience stuff (well my teams of devs have) my main experience this far is if the team of devs doing HASSOS want it to be successful globally and mass adopted, there needs to be a change to frictionless design thinking, if they want it to be a toy that tinkerers play with and is marginally adopted then carry doing what you are doing, the analogy is steve and steve, one wanted a hobbyist machine (wozniak) the other wanted something the whole world could use (jobs) and then bill went and did it on mass scale. So far the learning curv (I haven devved in 20 years) is crazy, the instructions are very often out of date so when you do follow them and then all of a suddent something different is happening, you post that error, the response is oh you must leave that part out, lol.

Anyway point is, if its to be the platform to use for anyone who wants home automation, they may very well not be as technical as most, they are probably even less technical than even I am (cough) there needs to be a focus on building better processes. Yes I know its tough, hell windows wasnt built in a day but, MS today is where it is cause of taking the remove friction approach.

Thats my 2c worth, use it dont use it.

Now when will we get an sd clone util.

PS in the meantime i have fired up a hassos vm on windows 10 as my backup, which has its own challenges in keeping them now both in sync

2 Likes