Monday, July 16, 2007

Reading NTFS on a USB hard disk (Part I)

This was done on Keren's LG computer, running FC2, with some 2.6 kernel. The USB disk is a Maxtor 320 GB. I'll add the model number later. The goal was to be able to read/write on the disk. Only the read part worked. Writing will come in part 2:
1) Enable NTFS reading, which required me to go here.
a) Check the docs here to be sure NTFS is enabled in your kernel.
b) Get the RPM for the kernel you're using and install it (rpm -ivh *.rpm).
2) Plug in the USB drive, check /var/log/messages to see which /dev or /udev
it was assigned to.
3) Simply run "mount -t ntfs /udev/sda1 /mnt/usbdisk/"
a) /udev/sda1 was returned by /var/log/messages
b) I made the directory /mnt/usbdisk

This was all quite easy. It doesn't mount automatically when plugged in, so you need to run step 3 each time. In the future, I'll enable automounting, if it's possible.
No matter which mask options or r/w permissions I tried, I could not write to the disk. It looks like this may be a general problem. The two options are to format the full disk FAT32, as some have suggested that this works, or to partition the disk into ext3 and NTFS/FAT32. The latter is probably the way to go, but I need to consult with my wife, since it's her disk. I will conclude this tiny little project in forthcoming post.

For future reference, here's the man page for mount.

Alternatively, if you have an external USB disk, most if not all linux distros recognize fat32 right off the bat, and both linux and windows can read and write to fat32. This is key for Fedora Core 2, which is what my wife is using. I'm finding that I can't get FC2 to write to NTFS.
1) Format the disk as FAT32, and in linux
2) 'less /var/log/messages' and look for something like /udev/sda1 or /udev/sdb1
3) mount the volume with "mount -t vfat -o umask=000 /udev/sdb1 /mnt/usbdisk/"

I think she was able to read and write fine with this. One problem we ran into was filenaming: it doesn't know the difference between AAA and aaa. We tried using the shortname option, but it is probably a limitation of vfat, that caps and smalls are indistinguishable. Bummer, but that's tradeoff for being able to read and write from both linux and windows with fat32.

No comments: