HA install is suddenly very HUGE!

I’m having some issues with errors popping up on restarting the HA service. Also, I have done some recent backups that I tried to shrink but PiShrink reports that the img file is already the smallest it can be (which I chalked to being just an error in my shrink procedure). Then I tried to upgrade to Python 3.6 and the update failed on downloading files due to there being no more disk space.

I have System monitor running and I finally looked at it and, lo and behold, it reports disk usage being 100%! :astonished:

I’m using an 8gb SD card in a Rpi3. Is it reasonable that HA is really using up that much disc space? Or is there something else going on here?

I have only HA installed using Hassbian 1.21 and updating the installation periodically (currently up to v0.54.0). My previous backups up to v0.50.2 were able to be shrunk to around 3.5gb. Then after upgrading to v0.54.0 the img file is 8gb.

Looking at the file sizes of different things, my home/homeassistant/.homeassistant directory is almost 4gb just by itself with most of it being taken up by a single file called “home-assistant_v2.db”. It is pretty close to 3.9gb. Is that a reasonable size for that file?

Bottom line is do i need to move to a bigger memory card or is there something I need to do to clear a cache or extraneous db file or some such thing?

home-assistant_v2.db is the database uses by Home Assistant. If you are running into size issue, I would like to suggest that you start tweaking the recorder settings.

I can’t seem to get the recorder setup correctly.

I added the following to my configuration.yaml file:

recorder:
  purge_interval: 1
  purge_keep_days: 5

After I do a config check I get the following error:

2017-12-03 06:22:42 ERROR (MainThread) [homeassistant.config] Invalid config for [recorder]: [purge_interval] is an invalid option for [recorder]. Check: recorder->recorder->purge_interval. (See /home/homeassistant/.homeassistant/configuration.yaml, line 87). Please check the docs at https://home-assistant.io/components/recorder/
2017-12-03 06:22:42 ERROR (MainThread) [homeassistant.setup] Setup failed for recorder: Invalid config.

I have pretty much triple checked my syntax and I can’t see any spelling errors.

Not sure where to go to fix it now.

Also I tried to write an automation so I could easily purge the data but it didn’t seem to work either. It is valid in the checker but it doesn’t do anything when I trigger it with the input_boolean.

- id: purge_recorder
  alias: Purge Recorder Database
  trigger:
    platform: state
    entity_id: input_boolean.bool_test
    to: 'on'
  action:
    service: recorder.purge
    data:
      keep_days: 1

In the meantime can I just delete the large DB file occasionally and it will rebuild it?

The config options and purge service were only recently added to HA in version 0.57 and 0.58. You will need to upgrade to a later version to do this. Yes, you can stop HA and delete the recorder database if required. This will lose all of your history and a new database will be created when re-started.

@PeteB

OK. Thank you. Looks like I will be getting busy on upgrading.

Do I have to upgrade to python 3.6 before upgrading to v0.55?

Hi, is there any easy method to shrink any image file taken of a working HA SD Card on Pi 3 ?

I am struggling with PiShrink.

PiShrink does not seem to work properly with Home Assistant (Hassio).
It does the shrink without complaining (via Windows Subsystem for Linux - 5.10.16.3-microsoft-standard-WSL2) , but the momemt I write the shrunk image to SD card on Win 10 using Balena Etcher (or Win32DiskImager), the resulting SD card does not work.

A interesting side-effect to this is that the SD card maps to a handful of drive letters on Windows 10, instead of the usual 2 drive letters.

This might be realated to the fact that there seems to be multiple logical parts within the image file:
sudo mount -t drvfs -o noatime,uid=0,gid=0 ‘W:’ /mnt/w

sudo fdisk -l /mnt/w/Home_Assistant_Working.img

Device Start End Sectors Size Type
/mnt/w/Home_Assistant_Working.img1 2048 67583 65536 32M Microsoft reserved
/mnt/w/Home_Assistant_Working.img2 67584 116735 49152 24M Linux filesystem
/mnt/w/Home_Assistant_Working.img3 116736 641023 524288 256M Linux filesystem
/mnt/w/Home_Assistant_Working.img4 641024 690175 49152 24M Linux filesystem
/mnt/w/Home_Assistant_Working.img5 690176 1214463 524288 256M Linux filesystem
/mnt/w/Home_Assistant_Working.img6 1214464 1230847 16384 8M Linux filesystem
/mnt/w/Home_Assistant_Working.img7 1230848 1427455 196608 96M Linux filesystem
/mnt/w/Home_Assistant_Working.img8 1427456 124735454 123307999 58.8G Linux filesystem