3/14/08

Read and Write Windows Partitions From Linux

First of all windows uses FAT32 and NTFS file systems. FAT stands for File Allocation Table. Actually it is a table of information about the hard disk blocks. But the size of any table in computers can not be unlimited. With FAT32 users can not store files larger than 2GB. This cannot change because that's the way the system was designed. You can read more about FAT from wikipedia here.
Now let's come to the point. Linux can read ntfs partitions but cannot write them. The solution is not that easy as Read and Write Linux Partitions From Windows.
First you will need to download the ntfs-3g from it's homepage here.
After downloading ntfs-3g you follow the well known procedure of configure , make , make install . If compile fails you probably don't have FUSE (Filesystem in USErspace) installed or you have an old version. FUSE can be downloaded for it's homepage here. You can follow the previous procedure to install it. If you are with Gentoo you can install ntfs3g and FUSE with these simple commands:

echo "sys-fs/ntfs3g" >> /etc/portage/package.keywords
echo "sys-fs/fuse" >> /etc/portage/package.keywords
emerge ntfs3g fuse

The two first commands write to the file specified and the third download and install ntfs3g and FUSE.
Very simple isn't it? Wait a minute, we are not over. To use the new driver we type the command:

ntfs-3g /dev/hda3 /mnt/windows -o uid=xxxx, gid=yyyy

This command will mount the hda3 partition to the directory windows and give owner rights to user with id xxxx and the group with id yyyy.
Alternately you can edit fstab for autostart. The line you must enter in fstab to have the above command autostarted is:

/dev/hda3 /mnt/windows ntfs-3g uid=xxxx,gid=yyyy 0 0

Lastly if we want users without root rights to be able to execute ntfs-3g we use the chmod command. e.g. chmod xxxx /usr/bin/ntfs-3g
For help about chmod type man chmod

No comments: