Feature Request: Backup Directly to External Storage

Summary: Instead of creating the backup on the same device running HA, then using add-ons or the download option to copy it somewhere else, I’d like to have the option to just create it on another device in the first place.

Long, rambling explanation: I’ve heard all the horror stories about SD card failures from too many writes.

Yet, there seems to be no alternative when taking a backup. HA on a RPi with SD card is a supported configuration, and that is how beginners are encouraged to start out. Overall, it works well for me, but…

It seems to me putting the backups on the SD card is setting users up for failure. Not only because of excessive writes, but if (when) the SD card fails, or if HA has to be restored for any reason, the backup is not easily available to restore from.

One option might be to just download it directly to the device that the backup is being initiated on. For example, when I launch the Settings / System / Backups page in my browser, I have the option to download the backup after it’s created on the SD card. I’d much rather skip writing it to SD and just download it live as it’s being created.

But other ideas are welcome. For example, I use the SAMBA add-on, and writing it directly to a share on my NAS would be even better. Or to a cloud service like Google Drive or any other. Even a USB memory stick on the device running HA would be better than the SD card.

This excellent guideline shows links to multiple ways to automatically backup to a NAS, Google Drive etc.

Thank you, yes, I’ve seen that, and used two of those methods. That’s not what I was requesting.

As the title suggests, I would like to see some way to back up directly to something other than the device the OS is installed on (in many cases, an SD card.) Please re-read my OP and let me know if there’s any part of that I could explain better.

2 Likes

You made it sound like these options don’t exist.
It’s a valid feature request, but I don’t think it will get attention of the devs, there are so many easy options to save the backup in a separate place.

Anyway, vote for your own request :wink:

I think you’re still missing my point. I am not talking about what to do with the snapshot AFTER it’s taken!

My issue is having no other option as to where to create it in the first place.

I never said anything to suggest there aren’t already enough ways to copy the snapshots to another device. The fact that there are so many ways to do that already only proves my point.

I think we can all agree that the drive with the HA core on it is not the best place for the snapshot. That’s why there are add-ons to copy it to somewhere more practical.

These add-ons exist because the snapshot is not very useful in the default location. There’s a good chance that will not be available during a restore anyway. Furthermore, if that location happens to be on an SD card with a limited lifespan of writes, we’re “wasting” all those writes.

So, if we had the option to create the snapshot somewhere else, we wouldn’t need all these add-ons to move it around afterward. And for those of us still using the recommended “beginner” install method (Raspberry Pi and SD card) the current default is downright harmful.

3 Likes

I totally got your point and I also said that it’s a valid feature request.

I just didn’t vote because I don’t care, I make backups of my whole VM directly to a NAS automatically.

1 Like

i use this add-on :slight_smile:
hassio-addons/samba-backup at master · thomasmauerer/hassio-addons · GitHub

Make snapshot to my synology-NAS

Understood, thanks. I just didn’t know if I was expressing it correctly for other viewers.

If no-one else wants it, fine. But I didn’t want to drive people away before they even knew what I was asking!

1 Like

+1, and it is working great. That being said I do understand what the OP is looking for and like the idea. Voted!

1 Like

My HASSIO SD card failed and even though I have a Nabu Casa subscription, the only backup location was on the card that failed. This was surprising to me, and although I was able to recover some of the files, I completely started over.

I don’t have, nor want, a Google account, so I don’t use that third-party integration.

It would be very useful to be able to set up backups from Home Assistant natively to the Nabu Casa server or to other local/cloud storage services (CIFS, NFS, OneDrive, iCloud, DropBox, S3 APIs to AWS, BackBlaze, iDrive, etc.)

It seems the only way to do something like this is to use a third-party hack or roll your own.

It looked like version 2023.6 included this feature. Now there is some doubt as to whether the data is created on the external storage, or created locally and then just copied there.

Until there is some clarity on that, I consider this FR to still be open. I’d be interested to hear how the new Network Storage feature actually works.

You would be correct in your assumption. The backup process uses the Linux TAR (short for “Tape ARchive”) command to take the contents of your config folder and database and consolidate into a single archive file. The TAR process, by its nature builds the file locally in a temp directory, and then will copy the completed file to its destination. Likewise, if it was using GZip compression (which at least looking at my backups HA is not), then the TAR process would take a second pass at the file to compress it before the copy.

TAR operates with the presumption that its destination will a tape drive - a process which is much slower than the fixed disks, and likewise is very linear in its storage, so it was much more efficient to do these activities before writing to the destination.

I have several dozen servers in my day job that use TAR for backups, and they all behave the exact same way. I don’t see the HA team building a new backup method just to reduce local disk I/O when the existing one is widely supported. The other option would be to force TAR to use a RAMdisk, but considering my modest HA instance has 2.2GB backup files, it would put most Raspberry PI’s out of the mix for supportability.

2 Likes

As a new user of Home Assistant Green, I would really like to have the option for the local backups to be created and stored on the normally unused SDcard (I also use Google Drive Backup) so that:

  1. the backup activity is not writing anything to the eMMC drive (reducing its lifetime) assuming the temp directory for the tar creation could also be the SDcard or at least not the second stage of writing the completed tar file, reducing the impact on the eMMC drive.
  2. local backups are resilient to eMMC failure without having to go to the cloud in the first instance (just a convenience piece).

I would go as far as making this request as adding a complete “Local Storage” pane to Settings > System > Storage ike the “Network Storage” pane, so that one or more local disks can be added for Backup/Media/Share usage.

2 Likes