Friday 18 February 2011

LAP - Accessing NTFS Partitions

Eventually you may want to use your Linux USB system to access a Windows HDD. It won't be a problem if the windows system uses a FAT32 disk, but those things are rare outside USB Keys now. Most windows HDDs will be formatted with NTFS, and that required some tweaking to get my system to talk to it. First of all I needed to recompile the kernel. Yes, really. If you followed my instructions on how to compress your kernel source directory using LZMA then you can just run the following command to uncompress it to the ramdisk. Makes things a bit quicker, but you need a sensible (2G) amount of ram to make this work.

cd /dev/shm
cat /sources/linux.tar.lzma | lzma -d | tar x
cd linux-2.6.32.8
make mrproper
cp /boot/config-2.6.32.8 ./.config
make LANG=en_GB.utf8 LC_ALL= menuconfig

You then go into the Filesystems section and activate NTFS support (including write support) and also turn on Fuse (as a module). You can now exit the menu system. You compile the kernel, make a backup of your old kernel and settings and copy the new kernel into place by running these commands:

make $CORES_TO_USE
make modules_install
cp -v /boot/vmlinux-2.6.32.8-lfs-6.6 /boot/vmlinux-2.6.32.8-lfs-6.6.backup
cp -v /boot/System.map-2.6.32.8 /boot/System.map-2.6.32.8.backup
cp -v /boot/config-2.6.32.8 /boot/config-2.6.32.8.backup
cp -v arch/x86/boot/bzImage /boot/vmlinux-2.6.32.8-lfs-6.6
cp -v System.map /boot/System.map-2.6.32.8
cp -v .config /boot/config-2.6.32.8

You would be best to reboot now, to make sure the new kernel is working. After you get back up and running, you then download the source code for the necessary software in the usual way:

cd /sources/extras
wget http://prdownloads.sourceforge.net/fuse/fuse-2.7.4.tar.gz
wget http://www.ntfs-3g.org/ntfs-3g-2009.4.4.tgz

Now, move to the ramdisk and uncompress and compile FUSE. I am not entirely clear what FUSE is, but it seems to be a bit of software that lets you load weird and wonderful filesystems.

cd /dev/shm
tar -xzvf /sources/extras/fuse-2.7.4.tar.gz
cd fuse-2.7.4
./configure --prefix=/usr &&
make $CORES_TO_USE
make install &&
rm -rf /etc/init.d
cd ..
rm -rvf fuse-2.7.4

The installation is pretty basic. Not sure why it wants to delete the whole of [/etc/init.d] though. Still my LFS install doesn't use that, so hey ho. Next up is the ntfs driver itself:

tar -xzvf /sources/extras/ntfs-3g-2009.4.4.tgz
cd ntfs-3g-2009.4.4
./configure --prefix=/usr --libdir=/usr/lib &&
make $CORES_TO_USE
make install
cd ..
rm -rvf ntfs-3g-2009.4.4

Again, all pretty straightforwards. We just need to make sure it knows where to put its libraries.

You then mount NTFS partitions with:

mount -t ntfs-3g [device] [mountpoint]

No comments:

Post a Comment