---
name: "f2fs_io"
section: "8"
platform: "linux"
package: "f2fs-tools"
version: "1.17.0-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/f2fs_io"
---

# f2fs\_io(8)

f2fs ioctl utility

## NAME

f2fs\_io - f2fs ioctl utility

## DESCRIPTION

**f2fs\_io** is used to send various commands to the f2fs file system for administrative purposes.

## AVAILABLE COMMANDS

- **set\_verity** *\[file\]*

  Set the verity flags associated with the specified file.

- **fsync** *\[file\]*

  fsync given the file.

- **fdatasync** *\[file\]*

  fdatasync given the file.

- **getflags** *\[file\]*

  Get the flags associated with the specified file.

- **setflags** *\[flag\] \[file\]*

  Set an f2fs file on specified file.  The flag can be casefold, compression, nocompression, immutable, and nocow.

- **clearflags** *\[flag\] \[file\]*

  Clear the specified flag on the target file, which can be compression,\
    nocompression, immutable, and nocow.

- **shutdown** *shutdown filesystem*

  Freeze and stop all IOs for the file system mounted on *dir.* The level parameter can be:

  - 0

    going down with full sync

  - 1

    going down with checkpoint only

  - 2

    going down with no sync

  - 3

    going down with metadata flush

  - 4

    going down with fsck mark

- **pinfile** *\[get\|set\|unset\] \[file\]*

  Get or set the pinning status on a file.

- **fadvise** *\[advice\] \[offset\] \[length\] \[file\]*

  Pass an advice to the specified file. The advice can be willneed, dontneed, noreuse, sequential, random.

- **fallocate** *\[-c\] \[-i\] \[-p\] \[-z\] \[keep\_size\] \[offset\] \[length\] \[file\]*

  Request that space be allocated on a file.  The *keep\_size* parameter can be either 1 or 0. The *pattern* parameter can be:

  - **-c**

    collapse range

  - **-i**

    insert range

  - **-p**

    punch hole

  - **-z**

    zero range

- **write** *\[chunk\_size in 4kb\] \[offset in chunk\_size\] \[count\] \[pattern\] \[IO\] \[file\_path\]*

  Write a given pattern to *file\_path*. The *pattern* parameter can be:

  - **zero**

    zeros

  - **inc\_num**

    incrementing numbers

  - **rand**

    random numbers

-

  The *IO* parameter can be:

  - **buffered**

    buffered I/O

  - **dio**

    direct I/O

  - **dsync**

    direct I/O with O\_DSYNC

- **read** *\[chunk\_size in 4kb\] \[offset in chunk\_size\] \[count\] \[IO\] \[print\_nbytes\] \[file\_path\]*

  Read data in *file\_path* and print *print\_nbytes*. The *IO* options can be:

  - **buffered**

    buffered I/O

  - **dontcache**

    buffered I/O with RWF\_DONTCACHE

  - **dio**

    direct I/O

  - **mmap**

    mmap(MAP\_POPULATE)

  - **mlock**

    mmap() + mlock()

- **fiemap** *\[offset in 4kb\] \[count\] \[file\_path\] {flags}*

  get block address in file

- **gc\_urgent** *dev \[start\|end\|run\] \[time in sec\]*

  Start, end, or run gc\_urgent for a given time period

- **defrag\_file** *\[start\] \[length\] \[file\_path\]*

  Defragment a file.

- **copy** *\[-d\] \[-m\] \[-s\] \[src\_path\] \[dst\_path\]*

  Copy file from src\_path to dst\_path. The *pattern* parameter can be:

  - **-d**

    use direct I/O

  - **-m**

    use mmap for source file

  - **-s**

    use sendfile to transfer data

- **get\_cblocks** *\[file\]*

  Get the number of compressed blocks.

- **release\_cblocks** *\[file\]*

  Release compressed blocks to get free space.

- **reserve\_cblocks** *\[file\]*

  Reserve free blocks to prepare decompressing blocks in the file.

- **gc** *\[sync\_mode\] \[file\]*

  Trigger filesystem GC

- **checkpoint** *\[file\]*

  Trigger filesystem checkpoint

- **precache\_extents** *\[file\]*

  Trigger precache extents

- **move\_range** *\[src\_path\] \[dst\_path\] \[src\_start\] \[dst\_start\] \[length\]*

  Move a range of data blocks from source file to destination file

- **gc\_range** *\[sync\_mode\] \[start in 4kb\] \[length in 4kb\] \[file\]*

  Trigger gc to move data blocks from specified address range

- **get\_advise** *\[file\]*

  Get i\_advise value and info in file

- **ioprio** *\[hint\] \[file\]*

  Set ioprio to the file. The ioprio can be ioprio\_write.

- **test\_create\_perf** *\[-s\] \[-S\] \[dir\] \[num\_files\] \[size\_kb\]*

  Measure file creation and deletion performance.

  - **-s**

    Call fsync() after each file creation.

  - **-S**

    Call sync() after deleting all files.

- **test\_lookup\_perf** *\[-i\] \[-v\] \[dir\] \[num\_files\]*

  Measure readdir/stat performance.

  - **-i**

    Initialized to create files only.

  - **-v**

    Verbose mode.

- **freeze** *\[directory\]*

  Freeze filesystem that directory belongs to.

- **thaw** *\[directory\]*

  Thaw filesystem that directory belongs to.

## AUTHOR

This version of **f2fs\_io** has been written by Jaegeuk Kim \<jaegeuk@kernel.org\>.

## AVAILABILITY

**f2fs\_io** is available from git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs-tools.git.
