HOWTO: Mounting ext4 in LVM2

Hi there! As a FreeBSD newbie I found it hard to find this information (how to mount your Linux ext4 filesystems on LVM2 in FreeBSD) on the interwebs, so I'm posting it here for another clueless Linux convert like me.

Prerequisites: FreeBSD 9.0 with ports. I used the amd64 version.

The process is actually extremely simple, once you know the right tools. You only need to:
  1. Gain access to the LVM logical volumes (Now the volumes should appear in /dev/linux_lvm/)
  2. Get the ext4 filesystem driver,
  3. Mount happily away!
  4. Maybe chown, if needed

Code:
# kldload /boot/kernel/geom_linux_lvm.ko
# cd /usr/ports/sysutils/fusefs-ext4fuse/
# make install clean
# mkdir /mnt/blah
# ext4fuse /dev/linux_lvm/volumegroup-logicalvolume /mnt/blah
# cp -r /mnt/blah/home/username/stuff /home/username/stuff
# chown -R username /home/username/stuff
 
Nice, did not even know that FreeBSD would let me use Linux LVM and then even mount ext4.

Seems that the old sentence about FreeBSD is still true:
"FreeBSD can be Linux, but Linux can't be FreeBSD" ;)
 
I'm replying here as I did not find the information elsewhere and it could be useful to others.
Now, you just need to :

Bash:
kldload fuse
kldload /boot/kernel/geom_linux_lvm.ko # This will make /dev/linux_vm appear
fuse-ext2 -o rw+ /dev/linux_lvm/VolGroup00-lvhome /Linux

where VolGroup00 is my physical volume, lvhome is my logical volume and /Linux the mountpoint.
-o rw+ is used for read and write access.
 
Back
Top