Help - Search - Members - Calendar
Full Version: Changing Permission Of External Usb Hard Disk
Linuxhelp > Support > Technical Support
I have 2 questions to ask, pardon me if they sound stupid for i am a linux newbie. I am using Red Hat Linux, kernel 2.4.20-28 and everything is working perfectly. Except...

(1) I tried to mount my external USB 20G hard disk onto my system by first creating a dir called USB_HDD. Then as root, I mounted the hard disk with the following command:

mount -t vfat /dev/sda1 /home/koksung/USB_HDD/

the funny thing is when i cat my /etc/fstab file, I don't see it being listed or is it? the following is my fstab file when the hard disk has been mounted.

LABEL=/ / ext3 defaults 1 1
LABEL=/boot /boot ext3 defaults 1 2
none /dev/pts devpts gid=5,mode=620 0 0
none /proc proc defaults 0 0
none /dev/shm tmpfs defaults 0 0
/dev/hda3 swap swap defaults 0 0
/dev/cdrom /mnt/cdrom udf,iso9660 noauto,owner,kudzu,ro 0 0
/dev/fd0 /mnt/floppy auto noauto,owner,kudzu 0 0

But i have access to the files in the hard disk though, just that for a normal user (i.e. not root) the permission is only read and executable. I cannot write into any files from the hard disk. Even when i tried to chmod 777 to the entire folder (/USB_HDD/) as root, i cannot do it. How should I change the permission setting? I believe we must edit the /etc/fstab file but how, can you please tell me. thanks.

(2) Currently my sound module is not complied into the kernel during bootup, and everytime i log in, i need to insert the trident.o module into my kernel. How should i get it to complie into my kernel everytime during bootup? I tried searching the internet and I know i need to issue commands like xconfig, make dep and make clean... but these are not stated very clearly and I'm afraid i screw up the kernel, (I already had a kernel panic once) so if you don't mind can you tell me the exact step by step procedure.

Thank you in advance.
The /etc/fstab file is where you put things that you want to have automounted on system startup ... if you mount a drive by hand, it will not be in your /etc/fstab file ... if you want to mount this drive every boot up (and if it is going to remain installed) then you can manaully edit and update the fstab file. I would recommend that you just create a mount script and run it when you want to mount the drive.
Mount your drive with this command instead:

mount -t vfat -o umask=777 /dev/sda1 /home/koksung/USB_HDD/
You say you are manually adding the module to the kernel ... what commands are you using?

(maybe modprobe trident)

If all you are doing is modprobe, edit the file /etc/modules.conf and find the line (if it exists)
alias sound-slot-0 ... and either edit it or add it so there is one line and it says:

alias sound-slot-0 trident

Save the file and reboot....see if your sound works.
This script should mount and unmount when you start and stop the machine .. if the usb device is present.

edit a file named /etc/init.d/mnt_usb and paste in this code:

# mnt_usb:        Mounts USB device /dev/sda
# chkconfig: 345 99 01
# description:  This Program will mount the device /dev/sda
#               to the directory /home/koksung/USB_HDD/
#               on startup and unmount it on shutdown
# processname: mnt_usb


IS_SDA_MNT=`fdisk -l /dev/sda`
if [ "IS_SDA_MNT"x == x ]; then
 #there is no /dev/sda
 exit 0

# Source function library.
. /etc/rc.d/init.d/functions


start() {
   echo -n $"Mounting USB_HDD: "
   mount -t vfat -o umask=777 /dev/sda1 /home/koksung/USB_HDD/
   [ $RETVAL -eq 0 ] && touch /var/lock/subsys/mnt_usb

stop() {
   echo -n $"Unmounting USB_HDD: "
   umount /home/koksung/USB_HDD/
   if [ $RETVAL -eq 0 ]; then
       rm -f /var/lock/subsys/mnt_usb

case "$1" in
       echo $"Usage: $0 {start|stop|restart}"
exit $RETVAL

Now save the file ... chmod it to 755:

chmod 755 /etc/init.d/mnt_usb

Now ... if you want to mount or unmount at a different time, let's make a link from /usr/bin to the new file:

ln -s /etc/init.d/mnt_usb /usr/bin/mnt_usb

If you want to mount or unmount the drive at a time other than startup or shutdown of the machine, use the command (as root):

mnt_usb start
(to mount)


mnt_usb stop
(to unmount)

To actually make this mount and unmount on startup and shutdown ... do these commands (at this point, all the files are in place but you have to manually mount the drive).

chkconfig --level 345 mnt_usb on
chkconfig --level 016 mnt_usb off

now just for a check ... do the command:

ls /etc/rc0.d | grep mnt_usb

You should see:

and then do:

ls /etc/rc3.d | grep mnt_usb

you should see
Thanks for the advise...
I can now read and write to my external HDD as a normal user (not root).
I edited the /etc/fstab file with the following line:

/dev/sda1 /home/koksung/USB_HDD vfat users,rw,noauto 0 0

not sure if this is the technically correct way but it works for me. Maybe you would like to suggest a better configuration?

And yes you're correct i should be looking under the file /etc/mtab if i would like to see if my USB HDD has been mounted.

I tried looking for the line: "alias sound-slot-0 trident" in my flie /etc/modules.conf and amazingly it was there. So why is it I still have to /sbin/modprobe trident everything i bootup to have sound. what should i do to have sound immediately after bootup?

thank you very much again.
I managed to get the trident module to be loaded during bootup by the following inelegant manner, and i have sound on start up now:

i inserted the line: "/sbin/modprobe trident" into the file /etc/rc.d/rc.local.

any better suggestions?

QUOTE (wonks @ Jan 27 2004, 03:52 AM)
I managed to get the trident module to be loaded during bootup by the following inelegant manner, and i have sound on start up now:

i inserted the line: "/sbin/modprobe trident" into the file /etc/rc.d/rc.local.

any better suggestions?


That should work OK...and shouldn't cause you any problems.

I looked at the /etc/rc.d/rc.sysinit file (on my RH9 system) and if there is a line in /etc/modules that says:

alias sound-slot-0 trident

(without a # in front of it, which would remark it out) then it should load the module named trident with modprobe....if it doesn't then your doing a modprobe later via your script is exactly the same thing...except you may also have to load some sound restore scripts after the sound module is loaded (sometimes there are scripts that load the old mixer settings vice the default startup settings).
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2018 Invision Power Services, Inc.