Howto: mounting ext4 partitions by using ext2fs, rw access

More recently, ext2fs(5) that comes in FreeBSD's base is capable of reading and writing ext4 filesystems. It's claimed to work on ext2 and ext3 as well. Previously, sysutils/fusefs-ext2 had to be used, or ext2fs could only mount ext4 as read only.

Set the ext2fs driver to be loaded by compiling it in the KERNEL, or through /etc/rc.conf:
Code:
kld_list="ext2fs"
Then, kldload ext2fs.

mkdir /share, or other preferred directory.

/etc/fstab:
Code:
/dev/ada1s3   /share  ext2fs  rw,noauto       2       0
In this, it's important that noauto is set, and that 0 is set for the Pass column. When this number is set to another number, bootup will fail, because the system will try to check and clean the filesystem.

In the following example, the label name for the partition is used. Use the command glabel(8) to label non-UFS (BSD) partitions. For example: glabel label share /dev/ad1s3. Use glabel list ada1 to see the labels of partitions, on ada1 for example. Type ls /dev/ext2fs, perhaps after a reboot, to see that it showed up. /etc/fstab:
Code:
/dev/ext2fs/share   /share  ext2fs  rw,noauto       2       0
Then, mount /share.

sysutils/e2fsprogs may be needed to check and clean ext filesystems. There may possibly be inconveniences from other operating systems trying to use this partition with journaling.

Previous threads in Howto about mounting ext4 partitions: Thread howto-mounting-ext4-in-lvm2.29659, Thread howto-mount-ext4-without-fuse-avoiding-wrong-permissions.59520, Thread mount-linux-ext4-drives-on-freebsd.74414.

Basic information on this has become obvious to some. The mounting requirements of ext in fstab are essential to ease troubleshooting. This is also here as a point of reference, so this information is in one place instead of multiple older threads.
 
Back
Top