LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   fstab entry to manually mount ntfs partitions (https://www.linuxquestions.org/questions/linux-newbie-8/fstab-entry-to-manually-mount-ntfs-partitions-690579/)

james2b 12-14-2008 05:20 PM

fstab entry to manually mount ntfs partitions
 
What is the correct fstab entry to manually mount a Windows XP ntfs type partition? All my Linux and other partitions were auto-mounting, then I did edit the /etc/fstab file to change from "defaults", to "noauto,user" options, and changed the mount point folders from; /media/disk-1 (and so on numbers), to; /sda1, and so on for all 10 partitions. Now I can mount all the Linux partitions fine, but not any NTFS, so what is the secret?
Should I use; auto, or ntfs, or does ntfs-3g work to manually mount these type partitions ?

current fstab file is here;
UUID=50b5fde3-f83e-4666-a1d4-76f206f58685 / ext3 defaults 1 1
UUID=c4c807c6-563f-4f41-9c07-24d90bf7a271 /boot ext3 defaults 1 2
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
UUID=233f1695-1a4e-4179-bb8a-68eb1de30719 swap swap defaults 0 0
UUID=1929e259-7dfd-4c92-9b20-609c74b5c935 swap swap defaults 0 0
/dev/sdb7 /sdb7 ext3 noauto,user 0 0
/dev/sda9 /sda9 ext2 noauto,user 0 0
/dev/sda5 /sda5 ext3 noauto,user 0 0
/dev/sda8 /sda8 ext2 noauto,user 0 0
/dev/sdb2 /sdb2 ext2 noauto,user 0 0
/dev/sda2 /sda2 ext3 noauto,user 0 0
/dev/sda6 /sda6 ntfs-3g noauto,user 0 0
/dev/sdb3 /sdb3 ext3 noauto,user 0 0
/dev/sdb1 /sdb1 ntfs-3g noauto,user 0 0
/dev/sdb6 /sdb6 ext2 noauto,user 0 0

Simon Bridge 12-14-2008 06:30 PM

ntfs-3g will manually mount the partition... (did you RTFM?) use it in place of your usual mount command.

You have neglected to tell us what it is that you are having trouble with when mounting. What command are you using? Do you get any errors? In what way does the mount not procede as expected?

Your mounting scheme is not a good idea - you should not have user-writable files right off root. The organisation with /media /mnt etc is done for a reason and is kept because the reasons remain valid. You will have fewer problems in the long run if you stick with it.

OTOH, changing /media/disk-1 to something descriptive like /media/windows is a good idea.

jay73 12-14-2008 07:42 PM

I think this should do:
/dev/sda6 /home/username/windows ntfs-3g rw,noauto,exec,dev,suid,uid=1000,gid=1000,umask=0011 0 0
(you need to create a windows folder in your home directory first)

Simon Bridge 12-14-2008 08:20 PM

Will the uid and gid entries allow any user to mount, or just the first user?

This is something I missed earlier - but the user flag instead aught to do the trick.
It is usual, though, just to automount the fs to allow users to access it.

james2b 12-14-2008 08:36 PM

simon bridge; What is RTFM, and how is that used. I have sda6 as a NTFS storage partition, and sdb1 is windows XP formatted also as NTFS. What I do is in gnome Fedora 9, I open the "Disk Management", (the mount tool), and select a partition and click the mount button. Then for a ntfs there is no result, (it does nothing at all), and no error message either. But for any Linux it does mount and unmount just fine. I am not doing this in a terminal by command line, just by edit of the; /etc/fstab file, thanks.

jay73; What do those numbers refer to? (uid=1000,gid=1000,umask=0011),and why can we not use auto, or ntfs as the file system type,? thanks.

jay73 12-14-2008 08:49 PM

uid = user ID
gid = group ID

Who says ntfs cannot automount? I only used noauto because you mentioned mounting manually. There is little point in mounting anything manually if it has been mounted automatically at boot time. Here are the options I use for automounting:

rw,uid=1000,gid=1000,umask=0011 (if you use, say, Fedora, you will need to use 500 instead of 1000).

@Simon Bridge
Frankly, I don't know. It seems to me that the gid and uid only emulate Linux file permissions and that they are unrelated to the mounting operation.
EDIT: I have just tried mounting NTFS as a regular user and I get this:
Unprivileged user can not mount NTFS block devices using the external FUSE
library. Either mount the volume as root, or rebuild NTFS-3G with integrated
FUSE support and make it setuid root. Please see more information at
http://ntfs-3g.org/support.html#unprivileged

Simon Bridge 12-14-2008 09:15 PM

Quote:

Originally Posted by james2b (Post 3375640)
simon bridge; What is RTFM, and how is that used.

The acronym is referring you to the unix manual pages - which means the solution you asked for is spelled out there. If you do not know how to access these pages, enter

man man

in a terminal.

However, I may have misunderstood your request - you want any user to be able to mount, is this correct?

Quote:

I have sda6 as a NTFS storage partition, and sdb1 is windows XP formatted also as NTFS. What I do is in gnome Fedora 9, I open the "Disk Management", (the mount tool), and select a partition and click the mount button. Then for a ntfs there is no result, (it does nothing at all), and no error message either. But for any Linux it does mount and unmount just fine. I am not doing this in a terminal by command line, just by edit of the; /etc/fstab file, thanks.
Ahah! Perhaps the mount tool is not smart enough to use ntfs-3g instead of mount?

man ntfs-3g
man mount

for more information. info <command> also works.

Try with CLI - this will provide more information

Simon Bridge 12-14-2008 09:33 PM

Quote:

Originally Posted by jay73 (Post 3375652)
@Simon Bridge
Frankly, I don't know. It seems to me that the gid and uid only emulate Linux file permissions and that they are unrelated to the mounting operation.

From ntfs-3g(8)
Code:

      uid=value and gid=value
              Set the owner and the group of files and directories. The values
              are  numerical.  The defaults are the uid and gid of the current
              process.

      umask=value
              Set the  bitmask of the file and directory permissions that  are
              not present. The value is given in octal. The default value is 0
              which means full access to everybody.

Looks like setting uid and gid means that anyone not of the right user or group will have ro access only. I have usually just set the bitmask to 0000 (default) for single-user machines. Then it doesn't matter.

Quote:

EDIT: I have just tried mounting NTFS as a regular user and I get this:
Unprivileged user can not mount NTFS block devices using the external FUSE
library. Either mount the volume as root, or rebuild NTFS-3G with integrated
FUSE support and make it setuid root. Please see more information at
http://ntfs-3g.org/support.html#unprivileged
Yes - that is correct behavior. Like mount, you have to be root to use ntfs-38.

Wait! Do you mean that you set fstab to allow user mounting (need "user" option) yet this did not work?

Have you tried:

mount -t ntfs-3g /dev/sda1 /mnt/windows

instead?

Note: from mount(8)
Code:

            user  Allow an ordinary user to mount  the  file  system.  The
                    name  of  the mounting user is written to mtab so that he
                    can unmount the file system again.  This  option  implies
                    the  options noexec, nosuid, and nodev (unless overridden
                    by  subsequent  options,  as  in  the  option  line
                    user,exec,dev,suid).

Also owner and group for different control. But you don't want suid if any old mounting user needs rw access.

The line would be something like

/dev/sda1 /mnt/windows ntfs-3g rw,user,umask=0000 0 0

@OP: we do not want to set the fs to ntfs because that needs the ntfs driver, which you don't have. ntfs-3g is the program which handles MSs proprietary FS for linux. Similar for setting the fs to auto.

jay73 12-14-2008 10:03 PM

Quote:

Wait! Do you mean that you set fstab to allow user mounting (need "user" option) yet this did not work?
Yes.

From my fstab:
Quote:

LABEL=XP_home /home/jurgen/Data/NTFS ntfs-3g rw,uid=1000,gid=1000,umask=0011,noauto,user
Response from the system:
Quote:

jurgen@Selena:~/Data/C$ mount -t ntfs-3g /dev/sdb2 /mnt/ubu
mount: only root can do that

jurgen@Selena:~/Data/C$ ntfs-3g /dev/sdb2 /mnt/ubu/
Unprivileged user can not mount NTFS block devices using the external FUSE
library. Either mount the volume as root, or rebuild NTFS-3G with integrated
FUSE support and make it setuid root. Please see more information at
http://ntfs-3g.org/support.html#unprivileged


james2b 12-14-2008 10:18 PM

Thanks for all the help, I think I will just allow the auto mount of all my NTFS partitions (only 2), and that is the simple and easy way. And here is a good ntfs-3g site; http://ntfs-3g.org/index.html

matrix13 12-14-2008 11:40 PM

add this line to your fstab. This is mounting by force.

Quote:

# mount -t ntfs-3g /dev/sda1 /media/Windows -o force

Simon Bridge 12-17-2008 05:09 AM

@jay27 - that is a useful discovery - thanks. Sadly I cannot duplicate this as my own ntfs partitions have been erased long ago. But it appears that ntfs-3g does not behave just as mount does. It is inadvisable to let users have access to anything setuid root.

@james2B: that's what I did.

@matrix13: isn't that line a comment? Anyway, the idea is not merely to mount the partition but to allow non-root users to mount and unmount it.


All times are GMT -5. The time now is 07:23 AM.