HA Backup file size

Team,

To keep track of where diskspace is being used I wanted to measure the size of local HA backups.

After a LOT of research I found that the HA “local” backups are stored in the home assistant OS_supervisor container, folder /data/backup.
Wonderfull.
The following command gives me the folder-size in GB:

du -s /data/backup | awk '{print int($1 / 1024 / 1024) }'

However, the “homeassistant” docker container is where command_line entries are executed. This container:

  • Does not have access to the supervisor /data/backup folder
  • Does not have docker cli installed

The docker command to get the foldersize from the supervisor container:

docker exec -it hassio_supervisor sh -c "echo \$(du -s /data/backup | awk '{print int(\$1 / 1024 / 1024) }') GB"

did not work as a command_line but only in an SSH session.

Ideally: have 3 sensors indicating the backup size of local-files/external-nas/nabucasa-cloud.
Do you have any idea how I could get the size of the supervisor/data/backup folder?

Cheers!
DJ

I don’t know enough about the system configuration you describe to offer you a starting point, but I did want to note that

du -sh /data/backup

might be a simpler command to use. I only note it because you’re currently using the UNIX | and that might complicate things in some scenarios.

Correct. I actually tried with the simpeler version - without luck.
The challenge is that the command_line runs on the ‘homeassistant’ container that does not have direct access to the hassio_supervisor container.

Yeah, and like I said, I don’t know enough about the system setup–I haven’t used Docker, for example–to help. It might be that you need to use something like MQTT or CGI to expose the value so that your HA container can access it. But I would guess there should be a simpler way.