---
name: "defragfs.ocfs2"
section: "8"
platform: "linux"
package: "ocfs2-tools"
version: "1.8.8-3"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/defragfs.ocfs2"
---

# defragfs.ocfs2(8)

online defragmenter for ocfs2 filesystem

## NAME

defragfs.ocfs2 - online defragmenter for ocfs2 filesystem

## SYNOPSIS

defragfs.ocfs2 \[-c\] \[-v\] \[-l\] \[-g\] \[-h\]\[target\]...

## DESCRIPTION

**defragfs.ocfs2** reduces fragmentation of ocfs2 based file. The file targeted by **defragfs.ocfs2** is created on ocfs2 filesystem The targeted file gets more contiguous blocks and improves the file access speed.

*target* is a regular file, a directory, or a device that is mounted as ocfs2 filesystem. If *target* is a directory, **defragfs.ocfs2** reduces fragmentation of all files in it. If *target* is a device, **defragfs.ocfs2** gets the mount point of it and reduces fragmentation of all files in this mount point.

## OPTIONS

- **-c**

  Print the numbers of files that should be processed

- **-v**

  verbose mode, the current fragmentation count and the ideal fragmentation count are printed for each file.

-

  If this option is specified, *target* is never defragmented.

- **-l**

  **defragfs.ocfs2** will run in low io mode, which means it will regularly yield cpu to allow other processes to run.

- **-g**

  **defragfs.ocfs2** regularly records the current progress. So if it is interrupted, the next time you run  **defragfs.ocfs2** with this option, it will resume from the recorded progress.  Note that if this option is specified, other options are ignored and replaced by those that were recorded.

- **-h**

  Print help info

## NOTES

**defragfs.ocfs2** does not support files in lost+found directory. When *target* is a device or a mount point, **defragfs.ocfs2** doesn't defragment files in mount point of other device.

It is completely **not** recommended to run against a file while it is actively in another application. Since the read/write of a file involves a dlm lock, this can result in a performance slowdown to both defragfs.ocfs2 and the application due to contention.

If the file system's free space is fragmented, or if there is insufficient free space available, defragfs.ocfs2 may not be able to improve the file's fragmentation.

Non-privileged users can execute **defragfs.ocfs2** to their own file. Therefore, it is desirable to be executed by root user.

## AUTHOR

Written by Larry Chen \<lchen@suse.com\>
