I recently wanted to read an external drive which I’d formatted under Mac OS with Linux. Unfortunately, it was > 2TB, which seems to not be supported under Linux. It appears as if many of the vulnerabilities which used to exist (use of 32-bit values instead of 64-bit ones) seems to have been fixed, but the kernel still refuses to allow mounting. I figured out how to patch the kernel module to allow me to mount > 2TB partitions.
Important: I only intended to mount the partitions read-only, so I didn’t go through the code carefully to ensure that it won’t corrupt your data if you try to write to it! Use this at your own risk!!
- Using Ubuntu 11.04, upgrade to the latest kernel
- Next, unzip the source
- Next, patch the errant file; comment out the “goto out” code so it looks like this:
- Next, copy some files needed to build the module, and fix up the makefile:
- at this point, you should be able to run
insmod fs/hfsplus/hfsplus.ko
and then mount your hfsplus partition, using -oforce . please also use -oro for now.
root@mysterion:~# apt-get install linux-image-2.6.38-8-generic && apt-get install linux-headers-2.6.38-8-generic &&
apt-get install linux-source-2.6.38 && reboot
root@mysterion:~# cd /usr/src/linux-source-2.6.38
root@mysterion:/usr/src/linux-source-2.6.38# tar xfvp linux-source-2.6.38.tar.bz2
root@mysterion:/usr/src/linux-source-2.6.38# grep -A 3 supported linux-source-2.6.38/fs/hfsplus/wrapper.c
pr_err("hfs: volumes larger than 2TB are not supported yet\n");
//goto out;
}
root@mysterion:/usr/src/linux-source-2.6.38/linux-source-2.6.38# kernver=$(uname -r)
root@mysterion:/usr/src/linux-source-2.6.38/linux-source-2.6.38# kernextraver=$(echo $kernver | sed "s/$kernbase\(.*\)/\1/")
root@mysterion:/usr/src/linux-source-2.6.38/linux-source-2.6.38# sed -i "s/EXTRAVERSION = .*/EXTRAVERSION = $kernextraver/" Makefile
root@mysterion:/usr/src/linux-source-2.6.38/linux-source-2.6.38# cp /usr/src/linux-headers-2.6.38-8-generic/Module.symvers .
root@mysterion:/usr/src/linux-source-2.6.38/linux-source-2.6.38# cp /boot/config-2.6.38-8-generic .
root@mysterion:/usr/src/linux-source-2.6.38# make oldconfig && make prepare && make modules_prepare && make SUBDIRS=fs/hfsplus/ modules
Leave a Reply