LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   auto mount on rebooting (https://www.linuxquestions.org/questions/linux-newbie-8/auto-mount-on-rebooting-120924/)

black 11-29-2003 12:07 AM

auto mount on rebooting
 
Hi all~

i had 2 OSs, one is RedHat and the other is Win2k. i decide to mount win2k files to Linux so i can go on with my work on Linux, the command i typed is just like this:
Code:

mount auto -t /dev/hda5 /mnt/win2k
it works fine. but i need more, ie i need Linux mount this part automaticaly everytime it starts, my book didnt tell me much on this topic, so i hope some guys could inspire me a bit, any suggestions ? :rolleyes:

thanx in advance~

Demonbane 11-29-2003 12:33 AM

take a look at /etc/fstab

/bin/bash 11-29-2003 01:17 AM

Put this in /etc/fstab
/dev/hda5 /mnt/win2k auto auto,defaults 0 0

If you want to give all users access put users, before the last auto or you can use uid/gid to control access.

black 11-29-2003 09:07 PM

Quote:

Originally posted by /bin/bash
Put this in /etc/fstab
/dev/hda5 /mnt/win2k auto auto,defaults 0 0

If you want to give all users access put users, before the last auto or you can use uid/gid to control access.

thanx bin/bash, can you explain a bit more of this line ?

/dev/hda5 /mnt/win2k auto auto,defaults 0 0

aaa 11-29-2003 09:27 PM

Quote:

/dev/hda5 /mnt/win2k auto auto,defaults 0 0
/dev/hda5 is your Win partition. In fstab, the device usaully goes first. '/mnt/win2k' is the mount point, a folder where the stuff will be mounted. 'auto' is the filesytem type. The FS-type is automatically detected f this is used. It can also be 'vfat' (for FAT32) or 'ntfs'. NTFS should also be set as read-only, because ntfs write isn't supported well. The second 'auto' is the first of a list of options. 'auto' mounts automatically on startup. 'defaults' is the default options. You can add 'ro' here to make the device read-only. Do not leave spaces between options, only commas. The last two 0's are for whether the FS will be checked or not (pass), and whether the FS will be backed up (dump). Put this line at the top of your fstab for reference:
#<-Note the hash, this renders the line ignored
#device mnt-point fs-type options dump pass

aaa 11-29-2003 09:33 PM

What /bin/bash meant by using uid/gid is that these are options. Windows does not support some Linux attributes. They must be set in the fstab instead of the normal way. The 'umask=[number]' option sets permissions. 'umask=0' will set rwxrwxrwx permissions on all the stuff in your Win drive. 'uid=' and 'gid=' set ownership. Putting 'uid=black' will set all files as being owned by black. 'gid=users' will set the files' group to 'users'. Remember that options are seperated by commas, not spaces.

/bin/bash 11-29-2003 11:34 PM

Thats an excellent explanation by aaa. I just wanted to add an example or two.

You can get as complicated as you want with fstab entries. Or you can keep them simple.

/dev/hda1 /win/c vfat auto,umask=027,uid=501,gid=100 1 0
The above will automatically mount /dev/hda1 at /win/c using vfat filesystem. The files will owned by the user with uid=501 and will be in the group with gid=100. The mask 027 makes the files writable only by owner (drwxr-x---) but group can browse the directories and read the files.


/dev/hda1 /win/c vfat user,auto 1 0
This will automatically mount /dev/hda1 at /win/c using vfat filesystem. It doesn't matter who owns the files because they will be writable by anyone.


All times are GMT -5. The time now is 10:54 AM.