LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 12-14-2008, 05:20 PM   #1
james2b
Member
 
Registered: Feb 2007
Location: Washington state, USA
Distribution: Fedora 13, SUSE 11, Ubuntu 10.04, Mandriva 2010, Mint 8
Posts: 336

Rep: Reputation: 34
Question 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
 
Old 12-14-2008, 06:30 PM   #2
Simon Bridge
Guru
 
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu
Posts: 9,211

Rep: Reputation: 197Reputation: 197
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.
 
Old 12-14-2008, 07:42 PM   #3
jay73
Guru
 
Registered: Nov 2006
Location: Belgium
Distribution: Ubuntu 11.04, Debian testing
Posts: 5,019

Rep: Reputation: 130Reputation: 130
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)

Last edited by jay73; 12-14-2008 at 07:45 PM.
 
Old 12-14-2008, 08:20 PM   #4
Simon Bridge
Guru
 
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu
Posts: 9,211

Rep: Reputation: 197Reputation: 197
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.
 
Old 12-14-2008, 08:36 PM   #5
james2b
Member
 
Registered: Feb 2007
Location: Washington state, USA
Distribution: Fedora 13, SUSE 11, Ubuntu 10.04, Mandriva 2010, Mint 8
Posts: 336

Original Poster
Rep: Reputation: 34
Smile

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.
 
Old 12-14-2008, 08:49 PM   #6
jay73
Guru
 
Registered: Nov 2006
Location: Belgium
Distribution: Ubuntu 11.04, Debian testing
Posts: 5,019

Rep: Reputation: 130Reputation: 130
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
 
Old 12-14-2008, 09:15 PM   #7
Simon Bridge
Guru
 
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu
Posts: 9,211

Rep: Reputation: 197Reputation: 197
Quote:
Originally Posted by james2b View Post
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
 
Old 12-14-2008, 09:33 PM   #8
Simon Bridge
Guru
 
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu
Posts: 9,211

Rep: Reputation: 197Reputation: 197
Quote:
Originally Posted by jay73 View Post
@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.
 
Old 12-14-2008, 10:03 PM   #9
jay73
Guru
 
Registered: Nov 2006
Location: Belgium
Distribution: Ubuntu 11.04, Debian testing
Posts: 5,019

Rep: Reputation: 130Reputation: 130
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
 
Old 12-14-2008, 10:18 PM   #10
james2b
Member
 
Registered: Feb 2007
Location: Washington state, USA
Distribution: Fedora 13, SUSE 11, Ubuntu 10.04, Mandriva 2010, Mint 8
Posts: 336

Original Poster
Rep: Reputation: 34
Thumbs up

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
 
Old 12-14-2008, 11:40 PM   #11
matrix13
Member
 
Registered: Nov 2006
Location: Kerala, India
Distribution: Arch Linux
Posts: 134

Rep: Reputation: 25
add this line to your fstab. This is mounting by force.

Quote:
# mount -t ntfs-3g /dev/sda1 /media/Windows -o force
 
Old 12-17-2008, 05:09 AM   #12
Simon Bridge
Guru
 
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu
Posts: 9,211

Rep: Reputation: 197Reputation: 197
@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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't mount nfs share from fstab but can mount it manually - help Mountain Linux - Networking 1 03-30-2008 08:34 PM
Fstab Entry To Mount Vista stratcat Linux - Desktop 5 05-15-2007 07:36 PM
NTFS FSTAB Entry Campy19 Mandriva 2 11-02-2004 07:37 PM
usb fstab entry won't mount r/w Kilka Linux - Hardware 4 07-27-2004 11:05 AM
Why a FSTAB entry will mount using -a switch but will not mount automatically at boot mjen Linux - Newbie 3 05-19-2004 07:45 AM


All times are GMT -5. The time now is 12:00 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration