mount linux ext4 drives on Freebsd

You can mount linux ext4 drives on Freebsd using fusefs-ext2 package

Install fusefs-ext2

Bash:
# pkg install fusefs-ext2

Enable the fuse kernel module

To enable loading FUSE kernel module at boot add
fuse_load=YES line to the /boot/loader.conf file

Edit /boot/loader.conf

Bash:
# vi /boot/loader.conf

Add the following code to the loader.conf

Bash:
fuse_load=YES

You can also load the fuse kernel module on a running system just using the kldload command.

Code:
# kldload fuse

Create a mount point

Bash:
# mkdir -p /mnt/linux

plug in the drive and use dmesg to find the device id

Bash:
# dmesg

find the drives device id which should be something like da0

use gpart to show information about the drive

Code:
# gpart show da0

check /dev/da0

Code:
ls -l /dev/da0*

the slice should be called /dev/da0s1

mount the ext4 drive to /mnt/linux

Bash:
# fuse-ext2 /dev/da0s1 /mnt/linux

unmount the drive

Bash:
# umount /mnt/linux
 
This is all good, except the quality of sysutils/fusefs-ext2. It chokes at large number of files (tens of thousands) and symlinks with long target names.
The latter is the most dangerous thing since you may not even discover the issue until try to use, e.g. copied files.
At work I have to deal with ext4 formatted SD cards almost every day, and found the most reliable is sysutils/fusefs-lkl.
Everything remains the same, but the mount part of the how-to will look as the following:
Code:
# lklfuse -o type=ext4 /dev/da0s1 /mnt/linux
 
I found fusefs-ext2 is also very slow i got an average speed of 4.5mb,
compared to 11.2mb when i plugged in the ext4 drive into a linux machine and used rsync over ssh to transfer to freebsd

I started off using cp -r to copy files from the ext4 drive but as you point out it just choke,
so i ended up using rsync in small batches
 
Back
Top