• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • VCS
  • Interview Questions
  • Database
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

e4defrag Command Examples in Linux

by Deepika

The e4defrag command in Linux is a command-line utility that is used to defragment ext4 file systems. This command can be used to optimize the performance of an ext4 file system by rearranging the files and directories on the file system to improve the efficiency of read and write operations. The e4defrag command can defragment both regular files and directories, and it can be run on unmounted file system.

It is important to note that the use of e4defrag command requires root or superuser access. Also, the defragment process may take a while depending on the size of the file system and it may not always improve the performance. It’s recommended to backup important data before running the command.

e4defrag Command Examples

1. Defragment the filesystem:

# e4defrag /dev/sdXN

2. See how fragmented a filesystem is:

# e4defrag -c /dev/sdXN

3. Print errors and the fragmentation count before and after each file:

# e4defrag -v /dev/sdXN

Filed Under: Linux

Some more articles you might also be interested in …

  1. jello Command Examples
  2. “git rev-list” Command Examples
  3. “git secrete” Command Examples
  4. strace: command not found
  5. bosh Command Examples (Command-line tool to deploy and manage the bosh director)
  6. CentOS / RHEL 6 : How to Boot into single user mode
  7. pngcheck: command not found
  8. “sudo: /etc/sudoers is world writable” – How to correct the permissions of sudoers file
  9. gox Command Examples
  10. fgrep Command Examples in Linux

You May Also Like

Primary Sidebar

Recent Posts

  • Vanilla OS 2 Released: A New Era for Linux Enthusiasts
  • mk Command Examples
  • mixxx Command Examples
  • mix Command Examples

© 2025 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright