> For the complete documentation index, see [llms.txt](https://book.bsdcn.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://book.bsdcn.org/ask/flat/chapter-26-other-file-systems/di-26.2-jie-linux-wen-jian-xi-tong.md).

# 26.2 Linux File Systems

FreeBSD provides native support for some Linux file systems. This section demonstrates how to load and mount these supported Linux file systems.

## EXT Series File Systems

Since FreeBSD 2.2, the kernel has supported the ext2 file system from the Extended File System (EXT) series. FreeBSD 9.0 merged important allocation code from NetBSD's clean-room implementation, making the ext2fs driver BSD-licensed. Starting from FreeBSD 12.0-RELEASE, the ext2fs driver natively supports mounting ext4 file systems in read-write mode, but does not support journaling and encryption features.

> **Warning**
>
> Since FreeBSD's ext2fs driver does not support ext4 journaling, mounting ext4 file systems in read-write mode may result in data corruption or metadata inconsistency in the event of unexpected power loss, system crash, or improper shutdown. In severe cases, the file system may become unmountable. Do not perform write operations on ext4 volumes containing critical data, or ensure the device is connected to a UPS or other power loss protection.

### Formatting a Disk as Ext4 File System

The Port **filesystems/e2fsprogs** must be installed separately; it provides the `mke2fs` tool for formatting disks to ext format.

* Create a GPT partition table

```sh
# gpart create -s gpt ada0
```

* Create a partition containing all remaining space

```sh
# gpart add -t linux-data ada0
```

* Format as Ext4

```sh
# mke2fs -t ext4 /dev/ada0p1
```

* Verify the file system used by the **/dev/ada0p1** partition:

```sh
# fstyp /dev/ada0p1
ext2fs
```

### Test Mounting an Ext4 File System

* Create the mount directory **/home/ykla/test**:

```sh
$ mkdir -p /home/ykla/test
```

Adjust according to the actual path; the same applies below.

* Mount partition **/dev/ada0p1** to **/home/ykla/test**:

```sh
# mount -t ext2fs /dev/ada0p1 /home/ykla/test
```

* Verify the mount status

```sh
$ df -hl
Filesystem            Size    Used   Avail Capacity  Mounted on
/dev/ada0p1            20G    128M     19G     1%    /home/ykla/test

……irrelevant output omitted……
```

* Try reading and writing some files:

```sh
# touch test
# mkdir -p test2/test2
# ls -al
total 33
drwxr-xr-x  4 root wheel  4096 May 29 17:20 .
drwxr-xr-x  3 ykla ykla     10 May 29 17:08 ..
drwx------  2 root wheel 16384 May 29 17:12 lost+found
-rw-r--r--  1 root wheel     0 May 29 17:19 test
drwxr-xr-x  3 root wheel  4096 May 29 17:20 test2
```

## Btrfs and XFS File Systems

fusefs-lkl is a FUSE implementation based on the Linux Kernel Library (LKL). By running Linux kernel code in user space, it provides complete support for Btrfs, XFS, and other Linux file systems. Compared to fusefs-ext2, fusefs-lkl supports a wider range of file system types but with slightly lower performance.

For ease of demonstrating mount operations, this section assumes an example environment containing multiple Linux file system partitions for verifying each mount method.

Display partition information for the **nda1** device:

```sh
# gpart show -p nda1
=>      34  41942973    nda1  GPT  (20G)

			……irrelevant output omitted……

  20971520   8388608  nda1p2  linux-data  (4.0G) # btrfs
  33554432   8386560  nda1p4  linux-data  (4.0G) # xfs
```

The `-p` parameter displays full device paths.

The example partitions are pre-configured with files and directories for subsequent mount verification.

The relevant directory structure is as follows:

```sh
/
├── home
│   └── ykla
│       ├── btrfs                     # Btrfs mount point
│       └── xfs                        # XFS mount point
└── etc
    └── fstab                          # Persistent mount configuration file
```

### Installing fusefs-lkl

* Install using pkg:

```sh
# pkg install fusefs-lkl
```

* Or install using Ports:

```sh
# cd /usr/ports/filesystems/lkl/
# make install clean
```

### Loading the FUSE Kernel Module

fusefs is the FUSE framework kernel module for FreeBSD, providing underlying support for all FUSE-based file systems. Run the following command to add it to the system startup load list:

```sh
# sysrc kld_list+="fusefs"
```

The above command makes the configuration persistent. To apply it immediately, run:

```sh
# kldload fusefs
```

### Test Mounting a Btrfs Partition

Use `lklfuse` to mount the Btrfs partition `nda1p2` to **/home/ykla/btrfs**:

```sh
# mkdir -p /home/ykla/btrfs # Create mount directory
# lklfuse -o type=btrfs /dev/nda1p2 /home/ykla/btrfs # Mount disk partition
# ls /home/ykla/btrfs # View mount directory contents
test1	test2	test3	test4
```

### Test Mounting an XFS Partition

Use `lklfuse` to mount the XFS partition `nda1p4` to **/home/ykla/xfs**:

```sh
# mkdir -p /home/ykla/xfs # Create mount directory
# lklfuse -o type=xfs /dev/nda1p4 /home/ykla/xfs # Mount disk partition
# ls /home/ykla/xfs # View mount directory contents
cfc	test1	test2
```

## Troubleshooting and Outstanding Issues

### Unmounting File Systems

Use the `umount` command to unmount file systems. Before unmounting, ensure that no processes are accessing the mount point; otherwise, the unmount will fail. If the mount point is busy, use `umount -f` to force unmount (which may cause undefined behavior in applications accessing the file system). The basic syntax is:

```sh
# umount /home/ykla/test    # Unmount the file system at the specified mount point
```

### Persistent Mount Configuration

Persistent mounting can be configured by writing entries to the **/etc/fstab** file. For FUSE file systems, pay attention to mount parameters and the delayed mount option `late` — `late` ensures the file system is mounted only after the system has finished booting, preventing boot failures caused by FUSE dependencies not being ready.

## References

* FreeBSD Forums. mount linux ext4 drives on Freebsd\[EB/OL]. (2020-03-10)\[2026-03-25]. <https://forums.freebsd.org/threads/mount-linux-ext4-drives-on-freebsd.74414/>. FreeBSD forum discussion detailing the practice of mounting EXT4 file systems on FreeBSD using fusefs-ext2.
* FreeBSD Forums. XFS support\[EB/OL]. \[2026-03-25]. <https://forums.freebsd.org/threads/xfs-support.61449/>. FreeBSD forum discussion on XFS support, exploring XFS file system compatibility and mounting methods on FreeBSD.
* FreeBSD Project. fusefs -- Filesystem in Userspace\[EB/OL]. \[2026-04-14]. <https://man.freebsd.org/cgi/man.cgi?query=fusefs&sektion=4>. FUSE kernel interface manual page, describing the user-space file system framework.
* FreeBSD Project. ext2fs -- ext2/ext3/ext4 file system\[EB/OL]. \[2026-04-14]. <https://man.freebsd.org/cgi/man.cgi?query=ext2fs&sektion=4>. ext2/ext3/ext4 file system manual page, describing Linux file system mounting support on FreeBSD.
* FreeBSD Project. mount -- mount file systems\[EB/OL]. \[2026-04-14]. <https://man.freebsd.org/cgi/man.cgi?query=mount&sektion=8>. File system mount command manual page.
* FreeBSD Project. fstab -- static information about the filesystems\[EB/OL]. \[2026-04-14]. <https://man.freebsd.org/cgi/man.cgi?query=fstab&sektion=5>. File system table configuration file format manual page.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://book.bsdcn.org/ask/flat/chapter-26-other-file-systems/di-26.2-jie-linux-wen-jian-xi-tong.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
