2

I'm running Debian 13 (fresh install) and want to use specifically Nextcloud and Immich on docker on an SSD and 2 HDDs with 10TB for data (and the second for raid/snapraid or backups or similar). For power efficiency and to make it quiet, I want the HDDs to spin down since the server is in idle 90% of the time. I know this is not standard and produces wear, but I have multiple unused drives, and for family reasons it's important to have the server quiet and efficient.

I looked into autofs and bcache and other software that allows me to spin down the HDDs. hdparm -Y doesn't spin down the HDDs, since the Kernel is keeping them active. I also tried external ext4 journaling on the SSD where the os runs. But still no spindown with hdparm or hd-idle. This only works, when I unmount the drives.

My question is, how can I spin down the drives, while still "seeing the files". Best case I want to have a cache like bcache and have most files hit the SSD and transfer them automatically to the HDD afterwards (in up to 24h intervals or when necessary). However I need the files to be visible for Nextcloud and Immich etc. even when the HDD is spun down. The wait time for spin up, when I request a very old file is acceptable. Also the "problem" that the cache ssd could break and data that's only on cache is lost is tolerable (up to N hour data loss is acceptable if the SSD breaks). Can I use bcache with autofs for this? Does bcache work, when the HDD is unmounted and spun down? Is there a better solution to this problem?

I tried putting the disks in some states and measure power consumption with a cheap power-meter at the plug of the pc. Values are with usb keyboard and hdmi cable attached and go further down by 1,2 W if those are removed:

~35-40 W writing to HDD
~30 W idle discs active
~28.5 W idle HDDs unmounted
~19.8 W idle with HDDs in standby (hdparm -y)

But: however long I leave the pc on and without any program installed or running (I freshly installed debian without any non-standard program (except htop, nvim and some tools like hdparm, which I use for this), I never stop hearing the HDDs. Also the status remains active/idle, when asked by hdparm -C.

So I really want to stop the drives, since those 10 W add cost and not useful power consumption and they are too loud for my family to live next to.

Is there a way I can debug further? See the io traffic on the drive or so something to allow the disks to really unmount and still be cached by the SSD?

1
  • Besides the power consumption and regarding the noise, an option that also applies for any noise machines could do, is to set some sort of "ambient cage" noise reduction using soundproofing panels, like those used in music studios. Commented Nov 13 at 13:55

1 Answer 1

2

I know this is not standard

it absolutely is

produces wear

negligibly much.

hdparm -Y doesn't spin down the HDDs, since the Kernel is keeping them active.

The kernel really doesn't do that by itself. Accesses to (non-read-cached) data does.

My question is, how can I spin down the drives, while still "seeing the files".

To me it sounds you're already doing the right thing! Keeping disks mounted does not stop them from being spun down when they're not accessed. Any caching solution as you propose in the rest of the paragraph doesn't work any better than that – the "countdown" to shutdown is only interrupted for actual access. And: that's all transparent, so you wouldn't have to worry about any of the things you worry about; again, this is all pretty standard.

Linux has pretty nice (in my humble opinion) read caching that just works, for almost all thinkable scenarios, as long as there's enough RAM to keep the read cache in. To demonstrate: try this:

# list all files with shell means only; time the results # echo First run /usr/bin/time find /path/to/mounted/drive/ > /dev/null echo Second run /usr/bin/time find /path/to/mounted/drive/ > /dev/null 

notice how the second run is much faster than the first? Most data for that simply came from RAM cache. And that's the whole magic here: as long as things are in the read cache, they will not be required to be read from disk. And to the best of my knowledge, as long as nothing needs your RAM, they won't be evicted (and being a local filesystem, they also don't get "stale"). In other words, for the second find, your HDD wouldn't be spun up.

Now, you do ask super interesting questions on multi-tier caching, and that does have the potential to reduce coldest-tier spin time. I just have zero experience with that! But you would usually these days just throw lvmcache at that problem – which is actually pretty OK to use. lvmcache would be ignorant of what a block actually contains – filesystem metadata or file contents – but would make sure that oft-read blocks are in SSD cache.

1
  • Thanks for the detailed comments. I thought so, but a clean install of debian never comes close in power consumption to the level I get, when I unmount and hdparm -y spin down a HDD. This is what I want and it actually makes up 1/3 of the total power.. Yes agreed also on the cache part. Again, the SSD caching would be nice, since I can hold 100 GB of images and documents (enough for months of full traffic for me) on the SSD and still have 10 TB of HDD space, if required ready in a few seconds. Commented Nov 12 at 14:45

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.