Howto mount ext4 (without FUSE), avoiding wrong permissions

This is going to be short. I write this tutorial, because a lot of tutorials mention ext4fuse. While it works for some things one experiences quite a few oddities.

Examples of problems I experienced:
  • everything has only read permissions
  • it is possible cd into non existing directories
  • things like recursive copies cause failures
  • sometimes stuff can't be read correctly
I wrote that everything has only read permissions. This DOES NOT mean that using this approach will give you write access, but that you SEE the right permissions. The effect is that copying over files via ext4fuse will cause you to have files that only be read-only. With this tutorial you will get the right permissions.

In other words: The file system will still be mounted read-only, but the permissions will be correct.

There is three things you need to take care of:
  • Load the ext2fs kernel module
  • Mount the partition with -t ext2fs (you need to specify it and it's ext2fs, not ext2!)
  • Mount it read-only! Trying to mount the partition without -o ro will not work


# Load the kernel module
kldload ext2fs

# mount
mount -t ext2fs -o ro /dev/<device/partition> <mountpoint>

# Exmaples:
mount -t ext2fs -o ro /dev/ad1s1 /mnt/

# Or on a different partition scheme (p vs s):
mount -t ext2fs -o ro /dev/ada0p1 /mnt/


So to repeat the important points. Load the kernel module! Make sure you always write ext2fs, both for the module AND the mount option. Don't forget about the fs part. And make sure to mount it read only.

You can of course add ext2fs to the list of automatically loaded kernel modules, so you don't have to load it over and over again.

In your /etc/rc.conf add:
Code:
kld_list="ext2fs"

This will make sure that the kernel module will be loaded on boot. If you already have a kld_list entry then just append ext2fs to it.
 
This does not work for me. I am using FreeBSD 12.0-CURRENT amd64. ext4fuse will mount the partition but the transfer rate is painfully slow. I have ext2fs module loaded. I've tried it with and without fuse. Any suggestions ?
 
mercurial , have you looked into dmesg output?
I guess, the problem is that the latest Linux's mke2fs adds some new features to ext4, here is what I get after an unsuccessful mount:
Code:
$ dmesg
. . . . .
WARNING: mount of da0s1 denied due to unsupported optional features
 
I get the same thing. Thank You aragats. I used to use reiserfs for linux partitions but FreeBSD dropped support for reiserfs. I have slightly over 10 GB of data to transfer. It's actually 2 times faster to transfer via ethernet using NFS
 
i can mount ext4 manualy by
ext4fuse /dev/ada0X /mnt

But for making it automatically mount in fstab i added ntfs and it's ok but when i added ext4
it dosn't load the system from boot and hung ?
i boot in single user and fsck the system and disable the automount of ext4 and it boot normaly
whatls the problem?
 
Do you have late option for it? I have the following in my /etc/fstab:
Code:
/dev/da0s1   /mnt/sdcard   ext4   mountprog=/usr/local/bin/ext4fuse,allow_other,late,rw   0   0
Back to the original topic: when mounted with ext4fuse it doesn't show the correct permissions, which is very annoying...
 
Do you have late option for it? I have the following in my /etc/fstab:
Code:
/dev/da0s1   /mnt/sdcard   ext4   mountprog=/usr/local/bin/ext4fuse,allow_other,late,rw   0   0
Back to the original topic: when mounted with ext4fuse it doesn't show the correct permissions, which is very annoying...
i used your options and it' ok :D
thanx for the second time friend aragats:)
 
ext2fs(5)
Add to your kernconf:
options EXT2FS

The biggest problem I have found with ext3/ext4 is FS journaling.
If you disable it on Linux than FreeBSD ext2fs works great.
With journaling enabled I have found that FreeBSD can corrupt the journal.
Not hard fixing it on Linux but not seemless.
 
ext2fs(5)
Add to your kernconf:
options EXT2FS

The biggest problem I have found with ext3/ext4 is FS journaling.
If you disable it on Linux than FreeBSD ext2fs works great.
With journaling enabled I have found that FreeBSD can corrupt the journal.
Not hard fixing it on Linux but not seemless.
I just occasionally need to mount a drive to change an IP address or interface name when I move a disk, so I'm not too worried about it. Linux has that great 3px font on the console so working on the console is a bit of a struggle. Thanks for the info.
 
Back
Top