Home > Desktop User > Mounting an NTFS drive in Debian

Mounting an NTFS drive in Debian

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!

About these ads
Categories: Desktop User Tags: ,
  1. miksuh
    March 20, 2009 at 3:03 pm

    If you are using Debian 5.0 ‘lenny’ amd Gnome desktop then you don’t nesessarily need to modify /etc/fstab by hand. You can let disk-manager to detect and mount new unmounted partitions, including NTFS-partitions. You can also use disk-manager tool to set mount point for the partitions.

    It’s good to know how to modify fstab by hand, but for the new users it probably is much easier to use disk-manager.

    Here is how you can install disk-manager:

    # apt-get install disk-manager

    Now you can find disk-manager from gnome menu:

    System->Administration->Disk Manager

  2. March 21, 2009 at 8:21 pm

    Accellent tutorial!

    Couldn’t be easier than this.

    All you have to to is do a quick
    apt-get install ntfs-3g

    and then mount the drive to a given folder
    mount –t ntfs-3g /dev/hda1 /media/windows

    /Simon

  3. Brad Chun-Ting Liu
    May 1, 2009 at 10:55 pm

    Thank you for your guide.

    I am forever in debted to you… maybe not but thank you anyway :D. I must still ask though. Last time when I installed debian I can mount things just fine. This time around, somehow I had to worry about not able to access NTFS directly anymore…. By last time, I meant last september with debian 4.0r5. Anyway got things working ^^ thank you~

  4. Peter Williams
    May 23, 2009 at 9:12 am

    Cheers dude. Been looking for how to do this for ages. Thanks heaps.

  5. August 2, 2009 at 12:49 am

    How to auto mount in ubuntu? Means if we open NTFS doesn’t ask password

  6. NiVy
    November 4, 2009 at 12:40 pm

    THANK YOU!

  7. Arfan
    November 23, 2009 at 12:58 pm

    i have a problem – the thing is that i don’t want the mounted ntfs volumes to be shown on desktop but only in computer folder – what should i do? i tried moving the directories created to a new folder named “mount” instad of “media” because i thought the directories in “media” folder are shown on desktop but it didn’t work

  8. satish
    January 5, 2010 at 5:15 pm

    thank you

  9. santhosh
    February 9, 2010 at 11:44 am

    thank you very much friends…

  10. huge
    February 23, 2010 at 3:22 am

    ‘all you have to do is apt-get install … blah blah .. ‘
    only ntfs-3g isnt in the official repo’s ..

  11. vlad
    February 25, 2010 at 3:48 pm

    thanks!

  12. March 27, 2010 at 11:19 am

    @Huge: ????
    ntfs-3g has been in an official repo for sometime together with libntfs-3g31. Maybe, you are not using lenny or your sources are kinda jacked up…

  13. June 23, 2010 at 12:09 am

    It did not work in my case. I am running SUSE Linux 11 SP1


    outlook:/opt # apt-get install ntfs-3g
    If 'apt-get' is not a typo you can run the following command to lookup the package that contains the binary:
    command-not-found apt-get
    bash: apt-get: command not found
    outlook:/opt # apt-get install libntfs-3g31
    If 'apt-get' is not a typo you can run the following command to lookup the package that contains the binary:
    command-not-found apt-get
    bash: apt-get: command not found

  14. Glitch
    August 10, 2010 at 12:25 am

    @Yamen, the apt-get only runs on Debian and Ubuntu.

  15. Abu Shoaib
    August 20, 2010 at 2:10 pm

    @Yamen: If I remember correctly SUSE uses YUM not apt-get check the manual for reference.

  16. Michael
    October 1, 2010 at 1:06 am

    @Miksuh

    THANK YOU ! For some reason the coherently written article didn’t help me much. But installing disk-manager was just three clicks away from the solution to my problems.

    Thank you very much.

  17. pravin shedage
    February 27, 2011 at 12:43 pm

    There is no ntfs packages in SLES11 SP1.
    Can you give me the solution to install it because I can’t mount ntfs partition’s.

    pravin:/home/pravin # cat /etc/SuSE-release
    SUSE Linux Enterprise Server 11 (x86_64)
    VERSION = 11
    PATCHLEVEL = 1
    pravin:/home/pravin #

    pravin:/home/pravin # df -kh
    Filesystem Size Used Avail Use% Mounted on
    /dev/sda2 20G 4.5G 14G 25% /
    devtmpfs 1.9G 116K 1.9G 1% /dev
    tmpfs 1.9G 88K 1.9G 1% /dev/shm
    /dev/sr0 2.9G 2.9G 0 100% /media/SLES-11-SP1-DVD-x86_64.0432..001
    pravin:/home/pravin # mount -t ntfs -o utf8,id=1000,gid=1000 /dev/sda8 /media/100GB_F
    mount: unknown filesystem type ‘ntfs’
    pravin:/home/pravin # mount -t ntfs-3g -o utf8,id=1000,gid=1000 /dev/sda8 /media/100GB_F
    mount: unknown filesystem type ‘ntfs-3g’
    pravin:/home/pravin # rpm -qa | grep -i ntfs
    pravin:/home/pravin # lsmod | grep -i ntfs
    pravin:/home/pravin # fdisk -l

    Disk /dev/sda: 500.1 GB, 500107862016 bytes
    255 heads, 63 sectors/track, 60801 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Disk identifier: 0x0007536b

    Device Boot Start End Blocks Id System
    /dev/sda1 1 3188 25600000 7 HPFS/NTFS
    /dev/sda2 * 3188 5737 20480000 83 Linux
    /dev/sda3 5737 7650 15360000 7 HPFS/NTFS
    /dev/sda4 7650 60802 426943488+ f W95 Ext’d (LBA)
    /dev/sda5 7650 9562 15360000 7 HPFS/NTFS
    /dev/sda6 9562 11474 15360000 7 HPFS/NTFS
    /dev/sda7 11474 24223 102400000 7 HPFS/NTFS
    /dev/sda8 24223 60802 293820416 7 HPFS/NTFS
    pravin:/home/pravin #

  18. THAAAAAAAAAAAAAAAAAA
    May 26, 2011 at 9:42 pm

    AAAAAAAAAAAAAAAAAAAAAAAAANXXXXXXXXX!

    why is this not on the frontpage of debian.org ???

  19. Enrico
    June 5, 2011 at 2:48 pm

    tHANK YOU VERY MUCH.
    I’ve been on others websites, gave the right commands but did non say you have to install libfuse2 and ntfs-3g.
    I couldn’t understand why the commands put in fstab did not work but now I know .I didn’t have libfuse and ntfs-3g on my Debian Lenny v5.
    Thank you again.

  1. August 4, 2010 at 7:25 pm
  2. August 20, 2010 at 2:55 pm
  3. November 5, 2010 at 4:46 pm
  4. March 25, 2011 at 6:37 pm

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 56 other followers

%d bloggers like this: