If data is written, it is first written to the Page Cache and managed as one of its dirty pages . Dirty means that the data is stored in the Page Cache, but needs to be written to the underlying storage device first. The content of these dirty pages is periodically transferred (as well as with the system calls sync or fsync) to the underlying storage device.
Command line execution
grep Dirty Dirty: 1092 kB Now, we can use sync command in Linux to make sure all the dirty pages are cleared and the cached data is written to disk, so we are safe to perform any operations like unmount etc on the disk. $ sync Now, we can verify that all cached data is written to disk. $ cat /proc/meminfo | grep Dirty Dirty: 0 kBImplementation details
$ dd if=/dev/zero of=demofile.txt bs=1M count=20 20+0 records in 20+0 records out 20971520 bytes (21 MB, 20 MiB) copied, 0.0320754 s, 654 MB/s Now we can check the Dirty pages, which shows the amount of data in Page cache which needs to be written to storage. $ cat /proc/meminfo | grep Dirty Dirty: 1092 kB Now, we can use sync command in Linux to make sure all the dirty pages are cleared and the cached data is written to disk, so we are safe to perform any operations like unmount etc on the disk. $ sync Now, we can verify that all cached data is written to disk. $ cat /proc/meminfo | grep Dirty Dirty: 0 kB
Gotchas and common issues
Permission checks - verify user access rights and sudo privileges before executing system-level operations.
Environment configuration - double-check path variables and dependency versions to prevent runtime failures.
Backup safeguards - maintain configuration backups before applying system or database modifications.
Following these steps ensures clean configuration and reliable execution for understanding linux page cache memory.
Comments and corrections