With fstab: How to automatically mount an NTFS partition

One of the things that many users want to do is automatically mount a partition automatically. In other words, suppose we have a part of the hard disk (100GB for example) in a different partition, a partition that we use to store our things, or play games on Windows.

How to do so that we can automatically access this partition from Linux?

There are several ways, but in this post I will show you the most common, using / etc / fstab

The / etc / fstab file is useful for many things, but ... let's focus on what we are dealing with now 😉

Suppose we have a partition called "Windows" (without the quotation marks), and we want that whenever we start the computer, this partition is accessible, that is, that it is mounted. For it …

1. We must first create a folder in /half/, for example: / media / windows To do this, open a terminal and put the following in it:

sudo mkdir /media/windows

2. Ready, now we must find out exactly what partition we want to mount, that is, its real location. To do this in the terminal write the following:

sudo fdisk -l | grep NTFS

This in case of being an NTFS partition, if you want to mount one that is FAT32 it is simple, change where it says NTFS for FAT32

3. It should appear something like this:

/ Dev / sda1 63 40965749 20482843+ 7 HPFS / NTFS / exFAT

I detail in bold what we need from that line, which is just the first thing in the line, in the example: / Dev / sda1

In fact ... here is the line that would show you just that:

sudo fdisk -l | grep NTFS | cut -d" " -f1

Well ... the point is that we remember VERY WELL what we need from that line.

4. So far we have to want to mount (following this example) the / dev / sda1 partition in the folder that we created at the beginning, / media / windows / ... for this in a terminal let's put:

sudo echo "/dev/sda1 /media/windows ntfs-3g auto,rw,users,umask=000 0 0" >> /etc/fstab

What it will do is write the instruction in / etc / fstab so that when the system starts it will automatically mount the partition.

Important!: For this to work it is necessary to have the package installed ntfs-3g, because without this package the partition cannot be mounted

Restart the computer and you should mount the partition as desired.

The content of the article adheres to our principles of editorial ethics. To report an error click here!.

31 comments, leave yours

Leave a Comment

Your email address will not be published. Required fields are marked with *



  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   platonov said

    excellent post, I was just struggling with this.
    Before reading this post I had a problem of being able to modify the data that I had in the ntfs partition, I imagine that it is solved with "rw" and another that is that it does not let me delete the data that I already had in the nfts partition since it tells me that it cannot link to the trash.
    Could you explain what the commands you use mean:… "users, umask = 000 0 0 ″ >> / etc / fstab"?
    Thank you

  2.   Ariel said

    After making the changes to the / etc / fstab file, you can write in the terminal:
    $ sudo mount -a
    Then linux mounts the partitions mentioned in the fstab file, without the need to reboot the system.


    1.    David Becerra Montellano said

      Excellent, thank you very much for the command:

      sudo mount -a

      It's perfect, it's like making the source after applying an alias or declaring a variable,
      for example: $ JAVA_HOME


  3.   RudaMale said

    @platonov Let's go in parts

    The option "users" enables the users belonging to the group "users" to mount the partition (the similar option "user" enables all users without exception)
    The option "umask = 000" is a permission mask, in this case the files of the mounted partition will take 777 permissions, that is rwx rwx rwx, the most permissive. If you want the files to take permissions 755 the umask would be 022, you just have to subtract the mask from 777, is that understood? 🙂
    the two trailing zeros correspond to the "dump" and "pass" columns. The first is for partition backups, in general it is at 0. The second is the fsck priority order, if it is at 1 (usually the root partition) it is the first to be checked, if it is at 2 it is the next and if it is at 0 it is not checked.

    I think that's the way it is, at some points I have doubts, so let me down if I'm wrong 🙂

    1.    hexborg said

      Very good explanation.

      One question: Do you know if the dump column is used by some modern program or is it already deprecated? Maybe I'm wrong, but as far as I know, the only command that uses it is dump, which is already quite obsolete ... It's just curious. 🙂

    2.    platonov said

      Thanks for the information, now it works correctly for me and I have learned a little more.
      One of the many things I like about Linux is the support you give to users!

    3.    RudaMale said

      About dump, no idea, I never do that kind of backup. We are here to learn 🙂

  4.   Tafurer said

    When I run:
    sudo echo "/ dev / sda1 / media / windows ntfs-3g auto, rw, users, umask = 000 0 0" >> / etc / fstab

    He answers me:
    bash: / etc / fstab: Permission denied

    Thanks in advance for your response.

    1.    eVeR said

      to modify any file in the / etc directory (as is the case with fstab) you need to be root or use the sudo program (which makes you root in that particular command).
      Whenever "Permission denied" appears, that's the problem. It may seem annoying to have to become root, but it is a great system measure to avoid unwanted changes.

      1.    Tafurer said

        Well yes, it was what you tell me.
        I was confused because I believed that with the initial sudo I was already as root.

        Many thanks to you for the trouble in answering me and also the same thanks to the post of the article, which I will save for later occasions.

        1.    hexborg said

          Actually with sudo you do launch the command as root. What happens is that the redirection >> is done by bash before executing sudo, so the file is trying to write without root permissions.

          @ KZKG ^ Gaara: One option may be to put the command like this:

          sudo sh -c 'echo «/ dev / sda1 / media / windows ntfs-3g auto, rw, users, umask = 000 0 0» >> / etc / fstab'

          It is less clear, but does not give permission problems. 🙂

  5.   Neo61 said

    Thanks Gaara, I solved knowing the partition that interests with gparted, variant that I look for, everything else OK

  6.   isanter said

    If it is a partition in FAT32 the command as it would be
    sudo echo "/ dev / sda1 / media / windows ntfs-3g auto, rw, users, umask = 000 0 0" >> / etc / fstab
    sudo echo "/ dev / sda1 / media / windows FAT32-3g auto, rw, users, umask = 000 0 0" >> / etc / fstab

    I hope you can help me, thanks

    1.    KZKG ^ Gaara said

      sudo echo "/ dev / sda1 / media / windows vfat auto, rw, users, umask = 000 0 0" >> / etc / fstab

      vfat is Fat32 😉

  7.   izzyvp said

    Good post 😀

  8.   edo said

    very good for Fedora users, which has an installer that does not allow mounting during installation

  9.   jorgecg said

    Just great article.

    It has come to me of pearls.

    Thank you!

  10.   Rocholc said

    This tutorial would have been great for me a few days ago, but I have decided to do a clean installation of my beloved Mageia 3 on a hard disk and a clean and basic installation of W7 on another disk to leave it as "Console", hehehe. Even so I will use it little because I am already testing good games that run natively on Linux ...

  11.   patodx said

    It is never too late, thank you very much for the explanation.

  12.   cristian said

    I never could with that code, nothing happened with the fstab file, it came out:

    sudo echo "/ dev / sda1 / media / windows ntfs-3g auto, rw, users, umask = 000 0 0" >> / etc / fstab

    He answers me:
    bash: / etc / fstab: Permission denied

    test with:
    sudo echo "/ dev / sda1 / media / windows ntfs-3g auto, rw, users, umask = 000 0 0" >> sudo / etc / fstab

    sudo echo "/ dev / sda1 / media / windows ntfs-3g auto, rw, users, umask = 000 0 0" >> su / etc / fstab

    and nothing happened, I had to add it manually, it already works, the funny thing is that two files were created in Home, one called su, and the other sudo and inside were all the attempts made to copy the said line, but without the quotes ,
    What do you think?

    1.    x11tete11x said

      It is because of how the "echo" works, it does this, log in as root, for that it does:
      [code] sudo su [/ code]

      It will ask you for the sudo password and then you will see something like this:
      [code] [root @ Jarvis x11tete11x] # [/ code]

      Here you will have root permissions and you can execute that command quietly

  13.   Ghermain said

    It worked perfect for me in Mageia 4 alpha 3 because although I checked in "System Preferences" that it automatically mounted all partitions and marked them all, it did not.

  14.   linuxer said

    In ubuntu and derivatives that have udisk it is easier using:

    user @ machine: # udisk –mount / dev / sdaX

    sdaX = ntfs partition

    You can easily add it to /etc/rc.local and voila = D

  15.   David said

    Hello, I have a problem, what happens is that I cannot mount my Windows partition and I try to use Ubuntu 14.04 without having it installed, how can I do this? I need to get my things out of the personal folder: / And when I wanted to install this it wants to remove Windows completely: /

  16.   johnjoneshq said

    Thank you very much for the contribution but I cannot mount the partition, it tells me permission denied, I must also say that before I had windows 8 installed but I totally removed it, I don't know what to do, I hope you can help me, thanks in advance 😀

    1.    moonwatcher said

      works perfect, thanks.
      @johnjoneshq do it as root (your + password) and not with sudo.
      that's how it works for me 😉

  17.   Nerol said

    It is not necessary to restart if we execute the command:
    $ mount -a

    Probably the best linux blog in Spanish. Greetings to the whole community

  18.   qinxiu said

    How to undo the last instruction you have put?

    because when I enter the last code several times, I get the following in the system entry:

    The ntfs-3g drive is not ready or present.

    Keep waiting, or press S for no mount or M for manual recovery

  19.   Nathan said

    I loved!!! Thanks a lot!!

  20.   the_blunderbuss said

    Looking around here https://wiki.archlinux.org/index.php/Fstab_(Espa%C3%B1ol) I found this way to connect a FAT32 partition with "fstab".
    / dev / sda5 / media / Volume13GB vfat user, rw, umask = 111, dmask = 000 0 0

    No problem on my Linux Mint

  21.   AnonymousWebHacker said

    I am an old linux user and now I was interested hahahhaa, greetings and good article