Incomplete Document
Not for public use
{{ :underconstruction.jpg?400 |}} \\ ---- \\
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. \\ ===== 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 enabled, **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 SD-Card Users === - **Enable**: Write caching for `/var/log`\\ - **Enable**: Flush on shutdown\\ - **Enable**: Daily flush timer\\ - **Enable**: Journald volatile storage\\ \\ These settings maximum write reduction with reasonable data preservation.\\ === For SSD Users === - **Consider enabling**: Write caching for high-activity paths only\\ - **Enable**: Flush on shutdown\\ - **Optionally Enable**: Daily flush\\ - **Why**: Extends SSD life without being overly aggressive\\ === For Spinning Hard Drive Users === There's no practical gain. Write Cache is not needed.\\ \\ \\ ==== Frequently Asked Questions ==== **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 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: Should I use this?**\\ A: Yes, if you're running OpenMediaVault on SD cards, USB drives, or SSDs. Write Cache is not needed for spinning hard drives.\\ \\ **Q: Can I customize what gets cached?**\\ A: Yes, through the configuration file at `/etc/omv-writecache/config.yaml`, However, editing this file requires command-line knowledge along with detailed information about the files to be cached and their functions. Accordingly, customizing Write Cache outside of the GUI is not recommend or supported.\\ \\ \\ ==== Sys Admin ==== === When Cached Data is Lost === Cached data will be lost in these situations:\\ - Power loss or unexpected shutdown (if flush on shutdown isn't configured) - System crash - Between flush intervals === I Need to See Recent Logs === On the CLI, issue the following command flush cached logs to disk:\\ ''sudo /usr/sbin/omv-writecache flush''\\ === I Want to Temporarily Disable Write Cache === On the CLI, issue the following command:\\ ''sudo /usr/sbin/omv-writecache unmount''\\ This turns off caching until the next boot or until you manually mount it again.\\ \\ \\ ===== Source Code ===== -> [[https://github.com/OpenMediaVault-Plugin-Developers/openmediavault-writecache|Source Code]]