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-
make mrproper
cp /boot/config- ./.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 modules_install
cp -v /boot/vmlinux- /boot/vmlinux-
cp -v /boot/ /boot/
cp -v /boot/config- /boot/config-
cp -v arch/x86/boot/bzImage /boot/vmlinux-
cp -v /boot/
cp -v .config /boot/config-

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

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 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 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