WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Mount NTFS partitions without specifying '-t ntfs-3g'?  (Read 9977 times)

Offline samedirection

  • Jr. Member
  • **
  • Posts: 64
Mount NTFS partitions without specifying '-t ntfs-3g'?
« on: August 14, 2009, 12:57:16 PM »
I want to mount NTFS partitions read-write using ntfs-3g.  Is there a way to do this which:

(1) still takes advangate of TC's nice auto-partition-detection facilities (putting the relevant partitions in /etc/fstab), and
(2) lets me mount with a simple "mount /mnt/hda1" instead of what I presently do, which is considerably longer:

   mount /mnt/hda1
      (rats!, I forgot I can't do that)
   sudo mount -t ntfs-3g /dev/hda1 /mnt/hda1

You can say I'm lazy, but in the words of J. Lennon, maybe "I'm not the only one."
« Last Edit: August 14, 2009, 02:09:00 PM by ^thehatsrule^ »

Offline ^thehatsrule^

  • Retired Admins
  • Hero Member
  • *****
  • Posts: 1726
Re: Mount NTFS partitions without specifying '-t ntfs-3g'?
« Reply #1 on: August 14, 2009, 02:12:00 PM »
[removed whitespace]

(2) will come from (1) automatically

For (1), one of the following could be done:
- remaster
- call rebuildfstab after loading ntfs-3g

Offline samedirection

  • Jr. Member
  • **
  • Posts: 64
Re: Mount NTFS partitions without specifying '-t ntfs-3g'?
« Reply #2 on: August 17, 2009, 03:04:41 PM »
Thanks.

Offline samedirection

  • Jr. Member
  • **
  • Posts: 64
Re: Mount NTFS partitions without specifying '-t ntfs-3g'?
« Reply #3 on: August 17, 2009, 03:36:24 PM »
If I call 'su rebuildfstab' after loading ntfs-3g, my /etc/fstab still lists my ntfs partitions as type 'ntfs' (not 'ntfs-3g,' which is what it would take to mount them with a simple 'mount /mnt/hda1').  Any ideas?

 


Offline roberts

  • Retired Admins
  • Hero Member
  • *****
  • Posts: 7361
  • Founder Emeritus
Re: Mount NTFS partitions without specifying '-t ntfs-3g'?
« Reply #4 on: August 17, 2009, 03:57:09 PM »
fstype is determined from blkid. What does blkid display on this device?
Perhaps trying to load the blkid extension update?
Since nfts-3g is a userspace file system type maybe not.
10+ Years Contributing to Linux Open Source Projects.

Offline ^thehatsrule^

  • Retired Admins
  • Hero Member
  • *****
  • Posts: 1726
Re: Mount NTFS partitions without specifying '-t ntfs-3g'?
« Reply #5 on: August 17, 2009, 03:59:20 PM »
Also, did you mean 'sudo' and not 'su'?

Offline samedirection

  • Jr. Member
  • **
  • Posts: 64
Re: Mount NTFS partitions without specifying '-t ntfs-3g'?
« Reply #6 on: August 18, 2009, 11:38:41 AM »
Right, I did mean 'sudo'.  And blkid displays 'ntfs'.  I didn't realize that ntfs-3g was a userspace filesystem.  So perhaps I won't ever be able to mount ntrfs volumes using ntfs-3g without specifying the -t type.  Or?

Offline ^thehatsrule^

  • Retired Admins
  • Hero Member
  • *****
  • Posts: 1726
Re: Mount NTFS partitions without specifying '-t ntfs-3g'?
« Reply #7 on: August 18, 2009, 04:39:23 PM »
Some options: could modify rebuildfstab or create something that modifies fstab after calling rebuildfstab

On their site, there's a suggestion for automount: link mount.ntfs to mount.ntfs-3g (I'm not sure if this is applicable or not)

Offline alu

  • Sr. Member
  • ****
  • Posts: 429
Re: Mount NTFS partitions without specifying '-t ntfs-3g'?
« Reply #8 on: August 18, 2009, 07:00:06 PM »
i have no ntfs-3g and i wonder if i can mount ntfs partitions simply so (using mc 2.2); i have noticed that no module was present for it

Offline roberts

  • Retired Admins
  • Hero Member
  • *****
  • Posts: 7361
  • Founder Emeritus
Re: Mount NTFS partitions without specifying '-t ntfs-3g'?
« Reply #9 on: August 18, 2009, 08:40:57 PM »
@samedirection

Does performing a stream edit in /opt/bootlocal.sh help? Example:

sed -i 's/ntfs/ntfs-3g/g' /etc/fstab

Of course it will only be usful for after boot mounting.
10+ Years Contributing to Linux Open Source Projects.

Offline roberts

  • Retired Admins
  • Hero Member
  • *****
  • Posts: 7361
  • Founder Emeritus
Re: Mount NTFS partitions without specifying '-t ntfs-3g'?
« Reply #10 on: August 18, 2009, 08:45:25 PM »
i have no ntfs-3g and i wonder if i can mount ntfs partitions simply so (using mc 2.2); i have noticed that no module was present for it
No ntfs support is in core. For read only see:
http://distro.ibiblio.org/pub/linux/distributions/tinycorelinux/2.x/tce/filesystems-2.6.29.1-tinycore.tcem.info

For read/write see the ntfs-3g extension(s) .info files.
10+ Years Contributing to Linux Open Source Projects.

Offline samedirection

  • Jr. Member
  • **
  • Posts: 64
Re: Mount NTFS partitions without specifying '-t ntfs-3g'?
« Reply #11 on: August 20, 2009, 11:29:22 AM »
Quote
Does performing a stream edit in /opt/bootlocal.sh help? Example:

sed -i 's/ntfs/ntfs-3g/g' /etc/fstab

No.  I get insufficient permissions errors.  It appears that you can only get ntfs-3g to be used by unprivilidged users under specific conditions (one of them is that the ntfs-3g binary is run as setuid root).  From the ntfs-3g FAQ:

Quote
Why can't unprivileged users mount block devices?

Unprivileged block device mounts work only if all the below requirements are met:
 
ntfs-3g is compiled with integrated FUSE support
the ntfs-3g binary is at least version 1.2506
the ntfs-3g binary is set to setuid-root
the user has access right to the volume
the user has access right to the mount point
More here:
http://ntfs-3g.org/support.html#unprivileged

So it looks like one could go down this route, but ntfs-3g would have to be compiled with FUSE support, and run setuid root. 

For me, I think I'll just do:

alias hda1mount='sudo mount -t ntfs-3g /dev/hda1 /mnt/hda1'

Thanks for your help. 

Offline clach04

  • Newbie
  • *
  • Posts: 31
Re: Mount NTFS partitions without specifying '-t ntfs-3g'?
« Reply #12 on: October 13, 2009, 10:39:37 PM »
Let me sprinkle some voodoo powder over this dead thread and revive it  :) (also see http://forum.tinycorelinux.net/index.php?topic=2808.0 )

@samedirection - you probably need a sudo in there.

@roberts, would you be interested in accepting patches against either rebuildfstab or blkid to report ntfs-3g (if and only) if ntfs-3g is installed? This would partially resolve the request for read/write mounting (without shelling out to a terminal).

For example something like:

Code: [Select]
tc@box:~$ diff /usr/sbin/rebuildfstab usr/sbin/rebuildfstab
--- /usr/sbin/rebuildfstab      Mon Sep 14 21:17:09 2009
+++ usr/sbin/rebuildfstab       Tue Oct 13 18:51:43 2009
@@ -18,6 +18,8 @@
  rm -f /var/run/rebuildfstab.pid
 fi
 echo "$$" >/var/run/rebuildfstab.pid
+ntfs3g=`which ntfs-3g` ## doesn't work (not in path, see set path above)
+ntfs3g=`ls /usr/local/bin/ntfs-3g 2>/dev/null` # path used in ntfs-3g.tczl extension
 
 
 # Go through fstab and grab a list of previous entries
@@ -60,8 +62,14 @@
   [ -z "$FSTYPE" ] && FSTYPE="auto"
   MOUNTPOINT="/mnt/$DEVNAME"
   OPTIONS="noauto,users,exec"
+  # If ntfs-3g was installed, assume we want to use it
+  if [ ! -z "${ntfs3g}" -a "$FSTYPE" = "ntfs" ]
+  then
+       FSTYPE=ntfs-3g
+  fi
   case "$FSTYPE" in
     ntfs) OPTIONS="$OPTIONS,ro,umask=000" ;;
+    ntfs-3g) OPTIONS="$OPTIONS,umask=000" ;;
     vfat|msdos) OPTIONS="${OPTIONS},umask=000" ;;
     ext2|ext3) OPTIONS="${OPTIONS},relatime" ;;
     swap) OPTIONS="defaults"; MOUNTPOINT="none" ;;

If you have ntfs-3g installed this will set new mount points to use ntfs-3g in rw mode. E.g. boot up TC, then once booted insert USB drive with NTFS on it. It will NOT set the mode for connected at boot time devices as the user extensions aren't loaded at the time this takes place.

I went ahead and hacked rebuildfstab (and added it to my backupfile list), blkid could be modified instead/as-well.

One idea I've had is to make a new boot flag, ntfs=ntfs-3g, ntfs3g, etc. and then pick that up in blkid or rebuildfstab as in indicator to replace ntfs with ntfs-3g.

Yet another option would be to create two mount points, once readonly (as is done now) and another one using ntfs-3g with "_rw" appended to the mount point. E.g.

Code: [Select]
/mnt/hda1
/mnt/hda1_rw

Comments?

Chris


Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11635
Re: Mount NTFS partitions without specifying '-t ntfs-3g'?
« Reply #13 on: January 13, 2011, 03:18:24 AM »
Maybe I'm missing something but I just created a link in /usr/local/sbin to mount.ntfs-3g called
mount.ntfs. I can mount from the command line with "sudo mount /mnt/hda1" just fine. The
MountTool app can now also mount my drive.

Offline clach04

  • Newbie
  • *
  • Posts: 31
Re: Mount NTFS partitions without specifying '-t ntfs-3g'?
« Reply #14 on: January 13, 2011, 11:26:56 AM »
Maybe I'm missing something but I just created a link in /usr/local/sbin to mount.ntfs-3g called
mount.ntfs. I can mount from the command line with "sudo mount /mnt/hda1" just fine. The
MountTool app can now also mount my drive.

For the original poster that may be fine, for me it wouldn't do everything I want. I basically want the option of RW, so I need to modify the fstab anyway to change the RO to RW.