Click to See Complete Forum and Search --> : Editing fstab.


raid517
06-13-2003, 06:20 PM
Hi I have two fat32 partitions and 2 NTFS partitions.

I would very much like these partitions to be automatically mounted when RedHat starts (baring in mind that I will have to load ntfs support in RH).

However after messing about with the fstab file, I have to admit I don't have a clue what I'm doing. After searching google I got some answers, but nothing worked - or I misunderstood what was being said.

my partitions are
hda1 NTFS
hdb5 FAT32
hdb6 FAT32
sda (which I assume means special device, for my USB2 NTFS harddrive).

More than anything it would be pretty much a revolution to me to have these devices available to me when RH starts up. It would certainly be a first.

Can anyone kindly show me an example line for both fat32 and NTFS that would be guaranteed to allow me to do this?

All advice is extremely welcome.

Q

trilarian
06-13-2003, 06:40 PM
You need to create directories for each of them, then fstab goes something like this(any RH users correct me if different from debian fstab)

device mount point fs type options dump pass

device = /dev/partition you specified those already, each needs it's own line.

mount point is full path to dir you want drive mounted to(ex/ /home/foo/dir)

fs type - "vfat" for fat32 and "ntfs" for ntfs

options "gid=1000,umask=0000" where gid equals the value of the group you are in. find by typing "id" as regular user.

set both dump and pass to 0.

Then reboot.

Example where gid=1000 and mount point /home/foo/dir

/dev/hda1 /home/foo/dir gid=1000,umask=0000 0 0

raid517
06-13-2003, 07:43 PM
Yeah I understand the theory. Sadly the practice still appears to be somewhat different. Based on what I have read, hear is what I did:

First a look at my partition table:
/dev/hda1 Primary NTFS 117222
/dev/hdb1 Primary Boot 203
/dev/hdb2 Primary Linux Swap 517.72
/dev/hdb3 Primary Linux 30341.52
/dev/hdb5 Logical Win95 FAT32 (LBA) 43417.86
/dev/hdb6 Logical Win95 FAT32 (LBA) 43315.89

Now based on this my fstab file:

proc /proc proc defaults 0 0
/dev/fd0 /mnt/auto/floppy auto user,noauto,exec,umask=000 0 0
/dev/cdrom /mnt/auto/cdrom auto user,noauto,exec,rw 0 0
/dev/sda5 /mnt/sda5 ntfs noauto,users,exec,ro 0 0
/dev/hda1 /mnt/hda1 ntfs noauto,users,exec,ro 0 0
/dev/hdb1 /boot ext3 noauto,users,exec 0 0
/dev/hdb2 none swap defaults 0 0
/dev/hdb3 / ext3 noauto,users,exec 0 0
/dev/hdb5 /mnt/hdb5 auto noauto,users,exec 0 0
/dev/hdb6 /mnt/hdb6 auto noauto,users,exec 0 0

The question is, spot the mistake I've done my best with the information I had, unfortunately its just not working. All I want (and it doesn't seem much) is to have all my drives avaiable all the time to all users wiyjout restrictions (though I might not want to mount the /boot partition as I've been told this isn't wise...

If you can spot any mistakes, please let me know.

Q

trilarian
06-13-2003, 09:24 PM
You have auto and noauto in the same line....this is conflicting information, pick one or the other. Then fat32 fs don't have file permissions. So you need to set the group id and umask at mount time or only root will be able to read it. So if you have multiple people logging in, make a group and make everyone a member of that group. Then take the id of that group and put it in gid like I suggested before. You also need umask=0000. NTFS fs is only readable. There is "expieremental" write for ntfs. I wouldn't suggest it unless whatever is on the drive is unimportant. Also after editing fstab, try mounting the drive as root by "mount /mountpoint" to see if there are any errors. If there are any errors post them.

raid517
06-13-2003, 10:11 PM
I figured it out. This is what I did:

LABEL=/ / ext3 defaults 1 1
LABEL=/boot /boot ext3 defaults 1 2
none /dev/pts devpts gid=5,mode=620 0 0
proc /proc proc defaults 0 0
/dev/fd0 /mnt/auto/floppy auto user,noauto,exec,umask=000 0 0
/dev/cdrom /mnt/auto/cdrom auto user,noauto,exec,rw 0 0
/dev/sda5 /mnt/sda5 ntfs noauto,users,exec,ro 0 0
/dev/hda1 /mnt/hda1 ntfs noauto,users,exec,ro 0 0
/dev/hdb1 /boot ext3 noauto,users,exec 0 0
/dev/hdb2 none swap defaults 0 0
/dev/hdb3 / ext3 noauto,users,exec 0 0
/dev/hdb5 /mnt/hdb5 auto noauto,users,exec 0 0
/dev/hdb6 /mnt/hdb6 auto noauto,users,exec 0 0

However as you said I can no longer see or use the drives when in user mode. Maybe I'm dim or something but I'm not to clear to me from what you said how to get an automount set for users other than the administrator. (still a n00b).

Of course I'm always learning, though I seem to learn better by example. So if you give it to me straight, I won't mind at all.

I'm really not keen on running in root mode permanantly just to access my disks.

All advice is welcome.

Q

trilarian
06-13-2003, 10:41 PM
As the user type id and record gid. Assuming gid=1000, then:


proc /proc proc defaults 0 0
/dev/fd0 /mnt/auto/floppy user,noauto,exec,umask=000 0 0
/dev/cdrom /mnt/auto/cdrom auto user,noauto,exec,rw 0 0
/dev/sda5 /mnt/sda5 ntfs noauto,users,exec,ro,gid=1000,umask=0000 0 0
/dev/hda1 /mnt/hda1 ntfs noauto,users,exec,ro,gid=1000,umask=0000 0 0
/dev/hdb2 none swap defaults 0 0
/dev/hdb3 / ext3 noauto,users,exec,gid=1000,umask=0000 0 0
/dev/hdb5 /mnt/hdb5 noauto,users,exec,gid=1000,umask=0000 0 0
/dev/hdb6 /mnt/hdb6 noauto,users,exec,gid=1000,umask=0000 0 0

raid517
06-18-2003, 06:59 PM
Thanks man...

Q

sharth
06-18-2003, 07:26 PM
sda would actually be a scsi device. I believe that usb mass storage devices go through a scsi layer for compatiblitiy and stuffs :)

raid517
06-19-2003, 01:24 PM
Mmm, I've just recompiled gentoo again and have tried this. Its not quite what I'm trying to do. This seems to only made my drives available to specific users. Since I want several people to have access to this machine, (some of whom I do not personalIy know/will access the system randomly) I would like to make all my drives avaiable to all users at all times - although only with root retaining root prividges. Does anyone know how to do this? Setting the GID for each user every time is a pain in the butt.

Q

sharth
06-19-2003, 01:53 PM
add umask=022 in the options to allow all users read access.

raid517
06-19-2003, 01:56 PM
Once again, thank you very much. :)

Q

motub
06-19-2003, 02:24 PM
You could also put all the relevant users in a newly-created, special 'sharing' group, then put the gid of the new group in the fstab settings. The users would all need to have profiles on the machine, though-- if you're using guest accounts, I don't know what to tell you.

So my fstab line (FAT32 drive) looks like this:

/dev/hda1 /mnt/whatever vfat iocharset=utf8,gid='shared'GID,umask=007 0 0

umask=007 gives the owner and the group full permissions ('Others' have no permissions).

Speaking of which, does anybody know where I could find a breakdown of what umask settings do what? man umask just brings me something about bash builtin settings.

raid517
06-19-2003, 02:26 PM
Just one other small point. Does that make the gid irrelevant? Do I just delete the GID entry, since there is no longer aspecific user for these devices...

Q

raid517
06-19-2003, 02:33 PM
Speaking of which, does anybody know where I could find a breakdown of what umask settings do what? man umask just brings me something about bash builtin settings. .

Yeah there must be a break down of what these unmask settings do somewhere. There are drives on this system I want to give all users full access to, including read/write and others I wish to restrict, such as drives and partitions containing system folders.

How is that done? And btw my last comment was for sharth. If I do unmask =022, does that mean I still need to give a GID for that drive?

Q

trilarian
06-19-2003, 02:36 PM
GID sets the owner, but umask 022 allows all user to access, so it doesn't really matter either way. If you take out gid, then root will be the owner.

raid517
06-19-2003, 03:04 PM
Ok well given everything that's been said so far. This is where I'm at now. My concern is that given my above partition table that I simply want to get it finally and conclusively right. What I have attempted to do here is assign all ownership of my drives to root, but ensure all users have access to them. I want to give users access to partitions hdb5, and hdb6 with full read write acess and read write acess to the user home directory, while allowing access to the ntfs drives and ensuring they are read only. CDRoms and floppy disks should be accessible to everyone.

So given this and the details of my partition table printed above, does this look correct?

proc /proc proc defaults 0 0
/dev/fd0 /mnt/auto/floppy user,noauto,exec,umask=022 0 0
/dev/cdrom /mnt/auto/cdrom auto user,noauto,exec,rw 0 0
/dev/sda5 /mnt/sda5 ntfs noauto,users,exec,ro,umask=022 0 0
/dev/hda1 /mnt/hda1 ntfs noauto,users,exec,ro,umask=022 0 0
/dev/hdb2 none swap defaults 0 0
/dev/hdb3 reiserfs noauto,users,exec,umask=022 0 0
/dev/hdb5 /mnt/hdb5 noauto,users,exec,rw,umask=022 0 0
/dev/hdb6 /mnt/hdb6 noauto,users,exec,rw,umask=022 0 0

sharth
06-19-2003, 03:34 PM
the uid and gid default to 0, or root. So, if you only want root to have write access, then its irrelevant. Otherwise, set the gid to something, add yourself to that group, and then you can change the umask to give group write access, and then they would. However, for what its worth, a uid=022 is all you really need, and leave write access to root i guess :)

raid517
06-19-2003, 03:42 PM
So I'm good to go with the above??? Its just that the advice seems a little conflicting; gid no gid...

Will what I have done allow me to do what I am trying to do, finally or not?

Q

trilarian
06-19-2003, 11:46 PM
It looks good to me. You don't have gid, but have umask set to 022, so everyone should be able to read and write all drives. Then you have ro(read-only) on the ntfs drives so no one will be able to use the experimental write. As with everything, it is best to test it while the problem is fresh in everyone's mind, but I think you are done.

motub
06-22-2003, 12:17 PM
Originally posted by raid517
.There are drives on this system I want to give all users full access to, including read/write and others I wish to restrict, such as drives and partitions containing system folders.

How is that done?

If root owns the drives/partitions in question, either log in as root (if you're addicted to file managers with icons), or su to root and open mc or gnome-commander or whatever not-so-graphical file manager you like (just type the filename in the root prompt you get after su-ing), and select the relevent folder, right click, go to either Properties, or Change Permissions or whatever seems appropriate and check and uncheck boxes as you will.

That's the whole point of root owning the folders, or of changing the uid of the owner to you, so that root doesn't have to get involved in the process. Just take care that the fstab settings don't change the permissions back if you should need to reboot-- some tools that should write changes to fstab don't, always.