Does HA prevent a HDD go idle?

Continuing the discussion from What cpu are you using in your NUC?:

Is HA a foreground or background process (in case of CCTV is properly is)?

The reason is, that if HA is installed on an external HDD, it will prevent the HDD going idle, so it will spin all time long.
This, of course, depends on how HA is configured, run on demand, e.g it act as a remote control, doing cronjobs or recording data (video or sensors) continuously.

Asking differently, what is carried out in the memory and what has to be pulled from the HDD?

The only thing that requires space related to Home Assistant is the database that records sensors and events.
And most of the traffic that spins a harddisk is data written to the disk. The Python code gets fetched from cache memory in multiple levels I am sure.
Home Assistant is a 24/7 software running time based events, sensor events, etc etc. Foreground vs backgroud makes little sense in this context.
The required diskspace is very small for the base Linux, the Python system and various addons. People run HA on quite small SD cards.
The issue with SD cards is if people have very small cards that do not have enough storage to allow wear levelling. And then the time it takes during heavy reading during boot and restart of HA.

On a raspberry pi you need to buy cards that are rated for I/O of many small files (A2 is the rating to look for) and buy a well known brand and a card that is much larger than you need so the primitive wear levelling on SD cards can move data around as data is written

When we talk external disk we mostly talk Raspberry Pi.
And you would not want to use a spinning hard drive. A small SSD like 64 or 128 GB with USB3 interface is more than enough and will fly as a rocket on a Rpi 4. You cannot boot from USB on Rpi 4 yet but it may be months, maybe weeks before we have that as well.
An SSD of that size does not consume much power, makes no noise, does not spin up and down. It is storage in the Terabyte class where spinning harddrives still make sense seen from price per gigabyte. But the size of drive you need for Home Assistant in a NUC or Raspi or virtual machine is so small that SSD is the only thing that makes sense.

1 Like

Linux caches disk so as to use RAM ss much as possible. So the answer depends on how much RAM your system has.

1 Like

thx folks for that super quick answer.

for me it is a question of what SBC I shall buy to run my applications but as HA accepts all kind of flash/solid state drive I’m not limited by HA :slight_smile: although if I buy my current favourite RockPro64, I won’t face storage problems anyway.

My plans for HA are:

  1. Multi-room audio
    Like Multi-room audio with Snapcast, Mopidy, and Home Assistant but with multiple BT portable speakers and my stereo
  2. hope to make HA work with my Panasonic Viera TV TX-P55VT30J
  3. automate radiators and jalousie
    That will take me time as the mechanical interface are not designed for automation :roll_eyes:
  4. similar Baby Room Automation what might be necessary as from next spring :slight_smile:
  5. and last but not least a watering system for our plants on the balcony

The scope is not little, isn’t it? I don’t think the database will become super big, won’t it? I guess, the entire HS installation maybe needs some few GBs, doesn’t it?

I search for min 4 GB.

Your original question was a concern about external hard disk drive (which means a magnetic disk spinning) and a concern about spinning up and down. And the answer is - you do not need a disk of a size where it makes sense to use a spinning harddisk. You will want to run on something solid state such as SD card, eMMC, or SSD. And none of these care about how often they are woken up as they have no moving parts. It is only the amount of data that matters. You can read as much as you want. They all have a limited number of write cycles. SD cards are less robust than SSD but for all flash memory based disks the trick to have long life is to have lots of unused space so the controller inside the drive can move data around. This is called wear levelling. You want to avoid running any SD/eMMC/SSD at 90-100%. Best is to have a drive which is 2-3 times what you need. An SSD will then live longer than the rest of your computer.
If you install HA on Linux then the distribution will be by far the largest thing on the SSD. Home Assistant is not large. The largest part is the database which can easily grow up to 100 MB and up to a gigabyte. Mine is 274 Mbytes and I have limited the database to 3 days and only half of possible data. If you want to keep weeks and have lots of events then it will be multiple gigabytes. It is logging and this database that is the main reason why SD cards may be worn out after half a year. So go a bit higher in size than you think if you run SD card only. Or attach an external USB SSD drive in the 64 or 128 GB size and either boot from this, or mount the external drive so the home assistant data is stored on this external drive. Someone posted about this approach with good result

yep I know but I was quite concerned about the storage requirements as the documentation requires not little. I was afraid that an internal eMMC of 16GB might be not enough, forcing me to get an external disk. This, in turn, going to be an HDD as I have quite extensive picture collection.

Thanks to your answers my concerns have vanished into thin air :smiley:

I think 16 GB may be low because of wear levelling. The base OS may start as a few gigs but quickly grows as you install software and various dependencies. And for your home assistant you will quickly be tempted to install a few addons that add some gigs. Your base OS will also keep a few kernel versions as you apt upgrade the base OS. Add to this some gigabytes of HA database and log files from both base OS and Home Assistant. Then you have maybe half the 16 GB left and those 8 GB is what the eMMC has available to move data around. And even if every update to a log or database is only a few hundred bytes flash memory is always taken and erased in larger chunks so you will overwrite the flash more often than you think. Going from 16 to 32 your free space increase from 8 to 24 and your flash device will suddenly last 3 times longer.
So if you want to use an SBC with a 16GByte eMMC then it may make sense to add an external storage like a 32 GB SD card or a small USB SSD. The smallest you can get are typically 64. If your SBC can boot from USB or has SATA or M.2 then forget the eMMC and run everything from the external drive. A 64 GB USB3 SSD cost in the order of 40 dollars. Add 10 dollars and you can get 240 GB SSD with USB interface. They are so cheap now.