Sortix
Sortix Download Manual Development Source Code News Blog More
current nightly

Sortix nightly manual

This manual documents Sortix nightly, a development build that has not been officially released. You can instead view this document in the latest official manual.

NAME

extfs — ext2 filesystem driver

SYNOPSIS

extfs [-bf] [-o mount-options] [-p path] device mountpoint

DESCRIPTION

extfs mounts the ext2 filesystem on the device for reading and writing at the mountpoint. extfs forks and runs in the background once the filesystem has been mounted.
A compatible ext2 filesystem can be created using mkfs.ext2(8) using the -O none,large_file,filetype option, and such filesystems can be checked and repaired using fsck.ext2(8). The filesystem parameters can be tuned with tune2fs(8), and the filesystem label can be set with e2label(8). Filesystems can be automatically mounted by init(8) on boot by creating an entry in fstab(5) with the ext2 type. disked(8) is typically used for partition and filesystem administration.
extfs will mount the filesystem as read-only if the filesystem uses unimplemented features that are read-compatible, and will refuse to mount if the filesystem uses read-incompatible unimplemented features.
The options are as follows:
-b, --background
Run in the background in a subprocess after successfully mounting. This is the default behavior.
-f, --foreground
Run in the foreground and do not detach in a subprocess.
-o mount-options
Mount the filesystem with the following comma-separated mount-options:
cache=size
Sets the filesystem cache to the specified size, which is measured in an optional suffix: % for percent of system memory, K for KiB, M for MiB, or G for GiB. The default is 10% of the system memory.
ro
Mount the filesystem as read-only.
rw
Mount the filesystem for read and write. This option is the default behavior.
-p, --pretend-mount-path=path
When answering requests about where the filesystem is mounted, reply with this path instead of the actual mountpoint in tcgetblob(2). This behavior is useful for chroot(2) environments.
The following identifiers are available to recognize a filesystem in fstab(5) in the fs_spec field and can be queried with the disked(8) id command:
LABEL=label
Search for a filesystem with this label.
UUID=uuid
Search for a filesystem with this 16-byte hexadecimal uuid. This identifier is recommended for filesystem searches to avoid mounting the wrong filesystem.

IMPLEMENTATION NOTES

If -f, then extfs signals readiness when it has successfully mounted the filesystem.
extfs implements the filetype and large_file extensions.

ASYNCHRONOUS EVENTS

SIGTERM
Request daemon termination. extfs will exit after gracefully unmounting the filesystem.

EXIT STATUS

If -b, extfs exits 0 after successfully mounting the filesystem and serving requests in a background process.
If -f, extfs signals readiness on the READYFD file descriptor when filesystem has been mounted, and continues running in the same process.
extfs runs as a daemon(7) until stopped by SIGTERM or until the filesystem is unmounted with unmount(8) or unmount(2), after which extfs exits 0 if the filesystem was cleanly unmounted.
extfs exits non-zero on fatal errors.

EXAMPLES

$ mkfs.ext2 -O Ar none,large_file,filetype /dev/foo0 
$ extfs /dev/foo0 /mnt 
$ echo bar > /mnt/bar 
$ unmount /mnt 
$ fsck.ext2 /dev/foo0

SEE ALSO

fstab(5), disked(8), e2label(8), fsck.ext2(8), init(8), lsblk(8), mkfs.ext2(8), tune2fs(8), unmount(8)

STANDARDS

D. Poirier, Second Extended File System, https://www.nongnu.org/ext2-doc/ext2.html, May 8, 2019.

BUGS

Many extensions are not implemented yet, including the extensions needed for ext3 and ext4 support.
readdir(2) runs in O(n) linear time, which takes O(n^2) quadratic time when reading a full directory. Many other internal operations have similar quadratic time performance problems.
The owner and group of files might not be set and respected correctly in all cases.
The timestamps are limited to 32-bit seconds after 1970 and will overflow in 2106. The owner and group values are limited to 16-bit.
fsync(2) does not sync the inode data contents, but only its metadata. extfs will sync in the background, but this fact cannot be observed yet. To reliably sync, unmount the filesystem.
The filesystem bookkeeping information is not always correctly updated and fsck.ext2(8) may complain and fix the incorrect cached counts in the filesystem.
The preferred block group heuristic is not tuned and properly used.
Copyright 2011-2025 Jonas 'Sortie' Termansen and contributors.
Sortix's source code is free software under the ISC license.
#sortix on irc.sortix.org
@sortix_org