Tagged: fusefs-ext4fuse

FreeBSD 10: Mounting USB Drive with ext4 Filesystem

I have been configuring FreeBSD 10 on my HP Pavilion laptop for a while now. On and off, I tried to mount a USB drive formatted with ext4 filesystem but failed with below messages: # mount /dev/da0s1 /mnt mount: /dev/da0s1: Invalid argument # mount -t ext4 /dev/da0s1 /mnt mount: /dev/da0s1: Operation not supported by device

Hmm... the device is not available? # dmesg | grep da0 ... da0 at umass-sim0 bus 0 scbus1 target 0 lun 0 da0: <HITACHI_ DK23ES-20 00K5> Fixed Direct Access SCSI-0 device da0: Serial Number 0B02011C050FB0DC da0: 40,000MB/s transfers da0: 19077MB (39070080 512 byte sectors: 255H 63S/T 2432C) da0: quirks=0x2<NO_6_BYTE> # gpart show da0 => 63 39070017 da0 MBR (19G) 63 1985 - free - (993K) 2048 39068032 1 linux-data (19G) # ls /dev/da0* /dev/da0 /dev/da0s1

I have no idea why it's not working so I followed the handbook, 18.5. USB Storage Devices (and I also made a regular user mountable).

Edit /etc/devfs.rules to allow the operator group to be able to read and write the device: # vi /etc/devfs.rules -------------------------------------------- [localrules=5] add path 'da*' mode 0660 group operator

Then edit /etc/rc.conf to enable the devfs.rules(5) ruleset: # vi /etc/rc.conf -------------------------------------------- devfs_system_ruleset="localrules"

Next allow regular user to mount file system: # vi /etc/sysctl.conf -------------------------------------------- vfs.usermount=1

Also execute sysctl to make the update available now: # sysctl vfs.usermount=1 vfs.usermount: 0 -> 1

Create a directory which a regular use can mount to: # mkdir /mnt/ubyt3m3 # chown ubyt3m3:ubyt3m3 /mnt/ubyt3m3

Now return to a regular user and try to mount the USB drive: $ mount -t ext4 /dev/da0s1 /mnt/ubyt3m3 mount: /dev/da0s1: Invalid argument

I got Invalid argument instead of Operation not permitted but this did not resolve my original issue. Hmm... does this mean FreeBSD does not support mounting ext4 filesystem? A bit of googling found that FreeBSD supports ext2/ext3 with ext2fs type but not ext4. However, I found that FreeBSD base system comes with the fuse implementation. Indeed, there is sysutils/fusefs-ext4fuse. Let's try installing this. # cd /usr/ports/sysutils/fusefs-ext4fuse # make install clean

Well, will mounting work now? Let's see... $ ext4fuse /dev/da0s1 /mnt/ubyt3m3 fuse: failed to open fuse device: No such file or directory

So, it's still not working, huh? A further googling led me to some hints. It looks like there is a kernel module for fuse, fuse.ko, and this needs to be loaded to the kernel. # kldload fuse.ko

Lastly, edit /boot/loader.conf to load the module each boot: # vi /boot/loader.conf -------------------------------------------- fusefs_load="YES"

Now mounting USB drive with ext4 filesystem is working! $ ext4fuse /dev/da0s1 /mnt/ubyt3m3 $ ls /mnt/ubyt3m3 lost+found $

Disclaimer:
The information in this site is the result of my researches in the Internet and of my experiences. It is solely used for my purpose and may not be suitable for others. I will NOT take any responsibility of end result after following these steps (although I will try to help if you send me your questions/problems).

That's all!
-gibb