2007
03.11

As you might already know, thanks to NTFS-3g, it’s already possible to write into NTFS partitions (they used to be read-only partitions). Until now, the easiest (and safest) way to exchange data with Windows (for those of us who have a dual boot system) was using a FAT partition for read-write exchange.

Following one (among the many) tutorials I’ve seen, it’s rather easy to mount NTFS windows partitions and read & write on them with no problem at all.

However, I have an external USB 500Gb hard drive I’d like to access both from Linux and Windows. So I formatted it to NTFS to read and write lot of info on it (mostly multimedia). On Windows I had no problem (NTFS is windows native). But in Linux (Kubuntu), by default, the drive was mounted using the old (read-only) NTFS driver.

Every time I plugged in the drive, it was mounted OK, but I couldn’t store anything on it. So, investigating a bit, I realized where the problem was: Every site I looked through talked about mounting the drive as superuser (root), or using de sudo command. Kubuntu (my distro) is an Ubuntu Linux using KDE as the default Windows Manager. The “Removable Media Manager” here is the KwikDisk (System >> My Apps >> Removable Media Tools).

First thing one has to do is to create a new entry in the /etc/fstab as told in the previous links, and make sure it works, with the command sudo mount /media/your_drive. Check you can read & write to it. In my case, I mounted it at /media/iomega.

Next thing I did was to change that entry in etc/fstab to:

/dev/sdb1 /media/iomega ntfs-3g user,allow_other,rw,locales=es_ES.utf8,nosuid 0 0

This will allow me to mount it as user (in fact, that solved the problem). But not everything is done yet: You’ll have to edit the file /etc/fuse.conf (or create it, if it doesn’t exist yet) and add the a line user_allow_other and save it (you can do this, for instance, with sudo kate /etc/fuse.conf).

Then you have to add your user to the fuse group, with the adduser command. My username is boriel (Of course! ;)):
sudo adduser boriel fuse

For your user to get the new permissions you have just added, it’s mondatory that you close your session and enter again (user permissions are always assigned at the session login, this is common to almost every operating system).

Now, try to mount the drive, as a normal user (that is, without using the sudo command):
mount /media/iomega

You should have no problem and be able to read and write to the drive. If everything is ok, unmount it.
Now, unplug the USB cord and plug it again. It should be automounted as a read&write ready drive. Otherwise, you’ll have to setup Kwikdisk and configure the mount point for this drive (should be needless, since Kwikdisk read the /etc/fstab file entries to make its operations).

Update: [2007/04/01] Since each time you plug/unplug your USB disk, it can be assigned a different device (in the example above, it was /dev/sdb1), this might fail. Your /etc/fstab must match your device.

Fortunately, there comes udev. Udev allows you to assign always the same /dev/ device to the same disk. This is accomplishes by writing udev rules. But, yet again, this is already done with (K)ubuntu: It creates a symbolic link pointing to your physical device, in the form /dev/disk/by-uuid/XXXXX-XXX-XX, where XXXX is a UUID. This “device” always identifies your USB disk regardless the order or the place it was plugged in. Simply locate this device, and put it in your /etc/fstab.

In my case, fstab resulted in something like:

/dev/disk/by-uuid/XXXXX-XXX-XX /media/iomega ntfs-3g user,allow_other,rw,locales=es_ES.utf8,nosuid 0 0

Update: [2007/04/21] For Ubuntu Feisty, ntfs-3g didn’t allow me to umount the device as normal user, and shows the error Only root is allowed to umount… in the console. Solution: Replace ntfs-3g by ntfs-fuse, so the above line should be:

/dev/disk/by-uuid/XXXXX-XXX-XX /media/iomega ntfs-fuse user,allow_other,rw,locales=es_ES.utf8,nosuid 0 0

Share
  1. MD: Gracias por tu interesante comentario.
    Lo cierto es que yo sólo pongo a mano los discos USB “grandes” (no los pendrives ni SD), y son sólo 2.

    Para las memorias flash, etc. las monto directamente desde el escritorio (al menos en KDE aparece así).

    Pero sí tienes razón de que debería haber una manera más sencilla de poder dejar unidades “fijas” a una carpeta. 😐

    Like or Dislike: Thumb up 0 Thumb down 0

  2. Yo ando con un problema parecido, me comprado un flamante disco duro de 1TB (sin canon que me ha costado encontrarlo) y su cajita para que sea externo, tambien para almacenar multimedia.

    Yo estoy con ubuntu+gnome, la preparación no ha sido dificil, lo he formateado visualmente con el gparted en EXT3. Pero ahora estoy buscando una manera de que monte el disco duro automáticamente con permisos de escritura.

    Me ha servido de ayuda lo que comentaste, pero sigue sin placerme como solución porque quiero que el puñetero linux (es que me cabrea que hagan las cosas tan dificiles…y son años trasteando con el y viendo como evoluciona, pero algo que asumi a la primera que iba a funcionar…cachis) monte cualquier disco usb como lectura y escritura y no quiero andar metiendo por cada uuid, ya que el fstab es para cosas estaticas.

    Voy a seguir investigando, a ver si puedo dar otro comentario con el truco, yo creo que los tiros estan entre el /etc/mtab que lo llena el udev o el fuse, y en algun perdido sitio se tiene que poder configurar que los monte como lectura y escritura, porque un pendrive que tengo por aqui si lo hace (aunque es fat32 uhmm uhmm).

    Gracias, saludos.

    Like or Dislike: Thumb up 0 Thumb down 0

  3. […] El Rincón de Boriel » Blog Archive » Lectura y escritura de discos extraíbles con NTFS en Kubunt… Como montar un disco externo USB con formato NTFS con permisos de lectura y escritura (tags: kubuntu linux tutorial tools) […]

    Like or Dislike: Thumb up 0 Thumb down 0

  4. Thanks, Matt 🙂

    It’s nice to see people likes it.
    I guess next Linux releases will do this by default, since NTFS is popularizing more and more as it’s now writable and disk becomes larger and larger.

    Like or Dislike: Thumb up 0 Thumb down 0

  5. ¡Muchas gracias! I came across this by a Google search; I was having the very same issues mentioned here. Thanks to this article, I can use my external HDD in Linux! God bless!

    Like or Dislike: Thumb up 0 Thumb down 0

  6. Gracias Manuel por tus observaciones. 🙂

    Tienes razón en lo del chmod. Otra posible solución es hacer:

    chown fuser /media/iomega

    Lo cierto es que no recuerdo cómo lo hice yo y ahora no lo puedo mirar. 🙁

    Like or Dislike: Thumb up 0 Thumb down 0

  7. Después de varias pruebas, he visto que tu método funciona, pero he tenido que asignar permisos en el directorio de montaje, así:

    $sudo chmod 0777 /media/iomega

    (Cambiando en mi caso iomega por mi directorio de montaje) De este modo sí que todo ya me funciona. Sin esos permisos, al intentar montarlo o desmontarlo daba este error:

    $ mount /dev/disk/by-uuid/F0840C88840C540E
    fusermount: user has no write access to mountpoint /media/iomega
    Retrying mount …
    fusermount: user has no write access to mountpoint /media/iomega
    Failed to mount NTFSUnmounting /dev/disk/by-uuid/F0840C88840C540E (NTFS)

    Like or Dislike: Thumb up 0 Thumb down 0

  8. He encontrado en Internet esta instrucción para ver ese dato que te pregunté:

    $/bin/ls -lF /dev/disk/by-uuid/

    Se puede ver en esta página:

    http://manual.sidux.com/es/part-uuid-es.htm

    Apartado “1. Nombramientos persistentes por ‘UUID'”

    Espero que le sirva a alguien más.

    Like or Dislike: Thumb up 0 Thumb down 0

  9. Un post muy bueno, mientras lo empezaba a leer pensaba en el problema que mencionas al final. Sin embargo, no me queda claro de dónde sale el UUID, ¿cómo lo has obtenido tú?

    Like or Dislike: Thumb up 0 Thumb down 0

  10. Where’s your captcha protection?

    Like or Dislike: Thumb up 0 Thumb down 0

  11. Gracias, May 🙂

    Siempre es bueno recibir comentarios positivos. Ayuda más de lo que la gente cree. 😉

    Like or Dislike: Thumb up 0 Thumb down 0

  12. Buen blog 🙂

    Like or Dislike: Thumb up 0 Thumb down 0