__fpurge - Linux


Overview

fpurge is a command-line utility used to flush the file system page cache to the backing storage device. It helps reclaim memory used by the cache and can improve system performance when memory is low.

Syntax

fpurge [OPTIONS]

Options/Flags

  • -a, –all: Flush all filesystems.
  • -d, –directories: Flush all filesystems containing mounted directories.
  • -f, –fs: Flush a specific filesystem. Requires the -v option.
  • -i, –ignore-errors: Ignore any errors encountered while flushing.
  • -v, –verbose: Display information about filesystems being flushed.
  • -h, –help: Display help information.

Examples

Flush all filesystems:

fpurge -a

Flush a specific filesystem:

fpurge -v -f /dev/sda1

Flush all filesystems containing mounted directories:

fpurge -d

Common Issues

  • Error flushing filesystem: Ensure that the filesystem is not mounted or in use.
  • No output in verbose mode: Verify that the verbose option is enabled (-v) and that the filesystem is mounted.

Integration

fpurge can be used in conjunction with other commands to optimize system performance:

  • free -m | fpurge: Flush the cache after checking memory usage.
  • sync; fpurge: Flush buffers and then the cache for a complete cleanup.

Related Commands

  • fsync: Force data to be written to disk.
  • vmstat: Display virtual memory statistics.
  • top: Monitor system processes.