Allow disk to spin down even if paired clients are online?

Based on 000xx.log file in index-v0.11.0.db is written very frequently, it seems that hard drives cannot go to sleep as long as there are paired clients online because there is continuously data written to the local database like “last seen” time etc.

This basically defeats my idea of using Syncthing to replicate my music library from the HDD-backed NAS to a SSD-backed Raspberry for power saving reasons.

Is there a way to configure that, like e.g. that such volatile data is held in RAM instead of in the DB or that “last seen time” is not tracked for a specific client?

I’m not aware of Syncthing having those two features/options, but there are ways to do what you’re looking for…

The index database is pretty crucial to Syncthing’s functionality so there are caveats to holding it in RAM. If your NAS has very reliable power and/or is backed by an UPS, then relocating the database to a ramdrive or similar volatile storage is one option. You’d also need to back up and restore the database whenever the NAS is rebooted otherwise it’d be almost like a syncthing --reset-database.

If your NAS unit has a USB port, a less complicated alternative is to relocate the database to a USB flash drive or SSD (the latter is best given the much higher TBW).

Or if you’re not constantly updating your music collection, perhaps use Syncthing’s API to pause the remote device connection to your RPi whenever there has been no changes for some preset number of hours.

Power savings…

There’s reducing power consumption to save money on electricity, and then there’s doing it to save the environment. Neither is mutually exclusive and both are worthwhile.

As a sysadmin maintaining servers in data centers, I’ve seen first hand how putting HDDs to sleep saves electricity, which in turn reduces the load on power (e.g., UPS, generators, etc.) and cooling systems. It all adds up to significant savings when multiple 42U server racks are involved (a single rack can easily require more than 4KW of power).

However, spinning up the motor in a HDD causes extra wear. An earlier study on HDD longevity found that each time a HDD is spun up is equivalent to about 6 hours of wear. Or in other words, spinning up a HDD once every 4 hours during the course of a day is the same as if the HDD had been spinning continuously for 24 hours.

According to Western Digital, a 6TB “Red Plus” (WD60EFZX) has the following power profile:

Activity			Watts
-------------------------
Read/write			6.2
Idle				4.1
Standby and sleep	0.4

Assuming an electricity rate of $0.11/kWh, the difference between idle and standby/sleep is $3.57 per year (can be lower or significantly higher elsewhere). A shortened lifespan can easily cost more than the electricity saved – a WD60EFZX is around $106, so the break even point is as much as 29 years.

It takes a tremendous amount of electricity to produce aluminum (HDD platters are nearly 100% aluminum; enclosures are more than 75% by volume). The semiconductors, CNC machines, polishers, lasers, electronic waste, etc. add to the total environmental impact, so keeping a HDD in service for as long as possible is ideal.

I’ve seen at least a few topics on the forum about this problem (newer than the linked one). You should be able to find them if you search for “spin down database”. The conclusion was that this isn’t currently possible. Some solutions included moving the database to a RAM disk and then sync it back periodically.

Thanks for sharing your insights. It basically confirms my assumptions.

Shutting down the peer is what I do now. But then again, the mirroring is no more transparent but needs manual intervention in the update case to happen within a reasonable amount of time. So, in my situation, there is no real advantage of using Syncthing over using less advanced tools like rsync or even cp.

Moving the DB to RAM disk is not an option as I also use Syncthing for backup purposes (copy data from other peers) and I don’t want reduce operation guarantees there.

Moving the DB to flash certainly is an option. Thanks for pointing me to the USB stick option. If I used SSDs, then the whole mirror thingy would not be needed at all.

My 9-10 year old 2-bay Synology is equipped with 2 WD Reds. It eats roughly 7 W at idle and 20 W with spinning disks. The electricity rate here is 0.25-0.30 $/kWh with significant increase announced for the upcoming period. When eventually replaced, SSDs will be the choice.

You know that a synchronized copy does not count as backup, do you? Example: In case one of your machines is hit by ransomware, the encrypted files are synchronized to your other machines more or less instantly.

This is way off-topic to my original issue; but yes, I am aware.

Let’s assume that it is easier to create offline backups from a single centralized and accessible machine than from multiple geographically distant machines that are infrequently online.

2 Likes