Friday, September 17, 2010

Mounting NTFS Filesystem In DEBIAN

Generally we could mount NTFS drives by editing the fstab file. But doing so it will not give you read write permission even when you are logged in as root.
Linux use ntfs, they just allow you to access them.
The process has two dependencies, ntfs-3g and libfuse 2. You will need these two packages installed before you begin the process. Ntfs-3g is a third party package that allows reading and writing to ntfs drives.To install these, use the commands.

apt-get install libfuse2
apt-get install ntfs-3g

Once you have the two packages installed we can begin.
Check whether Linux can see NTFS drives.

fdisk -l | grep NTFS

You should then see something like;
/dev/hda1   *           1       14387   156288421+    7  HPFS/NTFS

So now we know your ntfs drive is located on hda1. Check it isn’t mounted already by typing;

There should be nothing coming up unless this isn’t the first time you are attempting this. The next step is to create a folder to mount the drive in. Linux won’t create somewhere dynamically for you. You have to tell it where you want it to put the information. I called my directory ‘windows’ but you can call it what you want.

mkdir /media/windows
mount –t ntfs-3g /dev/hda1 /media/windows

This last command mounts hda1 with ntfs-3g in the /media/windows directory. If you navigate to it now you should see your ntfs files inside. If yours works like mine did then you should also get a drive icon on the desktop. This should be labeled as whatever you called your folder in /media. You can now double click and access the files inside.

Now here is a very important step that had me stumped for ages. Unmounting the ntfs drive.
umount /dev/hda1

Notice the spelling. U-mount, not un-mount! I saw unmount whenever I read this for ages and couldn’t for the life of me figure out what was going on. So hopefully those few words are going to save you much more time than I spent trying to get the thing to work properly.

Auto mounting NTFS  at  startup

You don’t want to have to manually mount the drive every time you boot up Debian. So here is another little trick to auto mount it whenever the system starts. To do this we have to modify a file called fstab. Be very careful!!!! If you damage this file it will not boot.

Modify the file in your text editor of choice and add the line;
/dev/hda1 /media/windows ntfs-3g defaults 0 0

Save this, and now every time you boot your machine your ntfs drive will b mounted and ready to use!


Post a Comment

Twitter Delicious Facebook Digg Stumbleupon Favorites More

Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | coupon codes