\\
Write Cache Plugin For OMV8
{{ :omvextras_logo4.jpg?400 |}}
\\
====== Write Cache Plugin For OMV8 ======
\\
\\
===== Summary =====
\\
The Write Cache Plugin was designed to make booting from USB thumbdrives and SD-cards feasible and a practical
alternative to booting from a hard drive or and SSD. In addition to the relative low cost, using USB thumbdrives
enable easy [[https://wiki.omv-extras.org/doku.php?id=omv7:utilities_maint_backup#operating_system_backup|OS backup]]
options, quick recovery from boot drive failure and it saves a SATA port for a
data storage drive.\\
**Note;** for users who are upgrading OMV versions:\\
The **Write Cache** plugin is the OMV8 upgrade, for the **Flashmemory** plugin that was used in OMV7. The Flashmemory plugin has been depreciated.
\\
===== Prerequisites =====
* [[https://wiki.omv-extras.org/doku.php?id=misc_docs:omv_extras|OMV-Extras]] must be pre-installed.
===== Installation =====
In OMV8's GUI:\\
Under **System**, **Plugins**, find and highlight **openmediavault-writecache 8.X**, and click the **install** button.
After the installation is complete, refresh your browser (**Cntl+shift+R**) while on the OMV console page
===== Configuration =====
After installation, the plugin can be found under **Services**, **Write Cache**.\\
For the majority of users, **Enabling** the Write Cache plugin with the default settings, **Flush on Shutdown** and **Rotate on Shutdown**, is the best approach.\\
\\
----
===== Additional Information: =====
==== Why is the Write Cache Plugin Required? ====
\\
**Wear Leveling**
Flash memory drives, like USB thumb drives and SD cards, are solid state, but their memory cells can only handle a limited number of writes before they wear out. When too many cells can no longer be written or erased, the drive’s controller may switch it to ‘read-only’ mode, meaning new data can't be saved and the drive’s useful life is over.\\
\\
To make flash drives last longer, modern drives use “wear leveling.” This is a clever system used by the drive’s controller that spreads writes across all the memory cells, so no single spot gets worn out too quickly. Instead of reusing the same cells over and over, the controller picks cells that have been used less, even if they’re not next to each other. This keeps the drive working reliably for a long time.\\
\\
A larger drive, like a 64GB USB compared to a 32GB one, can last longer because it has more cells to share the wear. For example, a drive twice as large might last about twice as long for the same amount of writing. However, larger drives take __longer__ to back up and they create bigger backup files. For a boot drive, a 16GB to 32GB drive is a good balance of lifespan, cost, and backup convenience.
\\
**The Purpose of the Plugin**
Most writes to OMV's boot drive are entries added to log files. These writes are very small, sometimes as little as 80 bytes, but they happen often. A write to a flash device happens in “blocks", typically 4KB or larger, no matter how small the write may be. This causes “write amplification,” where large chunks of the drive are written to store tiny amounts of data (like 80 bytes). Over time, this can wear out a flash drive’s blocks quickly, making it go read-only.\\
\\
The Write Cache Plugin reduces wear by collecting these small writes in memory and saving them as one larger write that flushed to the boot drive on shutdown (in the default configuration). This can cut down the number of blocks written to the drive by up to 10 times. As a result, a drive might last up to 10 times longer, depending on how it’s used, compared to operating without the plugin.
\\
\\
==== Best Practices ====
=== For Flash Drive Users ===
(SD-cards and USB drives.)
- **Write caching for `/var/log`**: (Enabled by default)\\
- **Flush on shutdown**: (Enabled by default)\\
- **Journald volatile storage**: (Enabled by default)\\
The above settings maximum write reduction with reasonable data preservation.\\
\\
- **Daily flush timer**: (**Optional** - NOT enabled by default.)\\
This setting will result is some additional flash drive wear.\\
\\
=== For SSD Users ===
- **Daily flush timer**: (While optional, consider enabling.)
\\
**Why?**: Even with the **Flush Daily** timer enabled, **Write Cache** will still extend SSD life while providing more log file availability.\\
\\
=== For Spinning Hard Drive Users ===
Write Cache is not needed - there's no practical gain.\\
\\
==== Frequently Asked Questions ====
**Q: Should I use Write Cache?**\\
A: Absolutely, if you're running OpenMediaVault on SD-cards and USB drives. Failure to use Write Cache will result in the premature failure SD-cards and USB drives. Write Cache is, however, optional for SSDs and is not needed for spinning hard drives.\\
\\
**Q: I need to view logs from my current session, without shutting down. What do I do?**\\
A: Under **Services**, **Write Cache**, click the **Flush** button (or the Rotate & Flush button).\\
\\
**Q: Will this make my system faster?**\\
A: Potentially yes, because RAM is much faster than disk storage. However, the primary benefit is reducing disk writes, not improving speed.\\
\\
**Q: How much RAM does this use?**\\
A: Typically very little - just enough to hold recent logs and cache files. Usually well under 100MB.\\
\\
**Q: Can I lose important data?**\\
A: Your personal files and shares are not affected. Only system logs and temporary files are cached.\\
\\
**Q: When is Cached Data Lost?**\\
A: Cached data will be lost in the following situations:\\
- In the event of a power loss or and unexpected/forced shutdown (such as holding the power button in for 3 or more seconds).\\
- A system crash\\
\\
===== Source Code =====
-> [[https://github.com/OpenMediaVault-Plugin-Developers/openmediavault-writecache|Source Code]]