For reducing the number of disk writes, what is the difference between using fstab to change the disk commit frequency and using sysctl for controlling when dirty data is written back to disk?
-
which specific parameters? also it looks like `commit` is ext3 specific – don_aman Jul 18 '22 at 19:05
-
Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Jul 21 '22 at 18:40
1 Answers
In fstab you define file system mount option:
Increasing
commitvalue means you might lose as much as the latest N seconds of work (where N = commit interval) though most of the time this won't happen as software can still call fsync() and get its data written to disk, overriding the commit setting. Advantages/disadvantages of increasing "commit" in fstab
With sysctl you define kernel parameters (remember to save values use something like /etc/sysctl.d/99-custom.conf too apply they on boot)
There are several key parameters to tune the operation of the virtual memory subsystem of the Linux kernel and the write out of dirty data to disk. See the official Linux kernel documentation for more information. For example:
vm.dirty_ratio = 10 Contains, as a percentage of total available memory that contains free pages and reclaimable pages, the number of pages at which a process which is generating disk writes will itself start writing out dirty data. vm.dirty_background_ratio = 5 Contains, as a percentage of total available memory that contains free pages > and reclaimable pages, the number of pages at which the background kernel flusher threads will start writing out dirty data. https://wiki.archlinux.org/title/sysctl