Archive

Posts Tagged ‘mount ntfs’

Mounting an NTFS drive in Debian

March 18, 2009 23 comments

As an ex Windows user, I still have quite a collection of music on my old NTFS drive that I don’t want to mess with Fortunately you can mount the drive in Linux and read and write to it as you would have done before Here I get the best of both worlds.

Being able to access my old Windows drives was one of the big barriers to my coming over to Linux. Once I had trawled the forums and help pages and found out I can still use ntfs to a degree I was sold. The tools won’t make 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, which is the holy grail for me right now!

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

Once you have the two packages installed we can begin.

deb5_468

The first step is to ensure your Debian system ‘sees’ the ntfs drive. You’re not going to be able to mount anything if Linux can’t see it.
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;
mount

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

Categories: Desktop User Tags: ,
Follow

Get every new post delivered to your Inbox.

Join 57 other followers