Reply
Thread Tools
Posts: 20 | Thanked: 0 times | Joined on Nov 2007
#1
I am trying to add a script to mount my hd without having to go through root everytime. I have been using thoughfix's scripts, but I cannot figure out how to add the lines to /etc/sudoers. Also, I am not sure what to do with the scripts that start with "echo". I have VIM installed, but not sure what to do. Please help me out.
 
Johnx's Avatar
Posts: 643 | Thanked: 628 times | Joined on Mar 2007 @ Seattle (or thereabouts)
#2
If you don't know how to use vim (and really, no one would blame you) I suggest installing nano (apt-get install nano). then just become root and run:
Code:
nano /etc/sudoers
Nano is pretty self explanatory. Just remember that when it says "^G = Get Help" it means hit Ctrl-G.

Good luck!

-John
 
Posts: 20 | Thanked: 0 times | Joined on Nov 2007
#3
Ok I figured out how to add the lines. But what do I do with the "echo" lines?
 
Posts: 264 | Thanked: 28 times | Joined on May 2006
#4
You want to add a line to /etc/fstab that includes the users keyword so that a normal user can mount the drive. The syntax of the line is six fields separated by whitespace (spaces or tabs and it doesn't matter how many) The fields are:
  1. The device i.e /dev/sdb3 or /dev/mmcblk0p1
  2. The mountpoint - The directory where you want to mount your device.
    It must exist. i.e. /mnt/fat1 or /media/mmc1
  3. The filesystem on the device i.e. vfat or ext3 or whatever.
  4. A comma separated list of keyword options. Some useful options are:
    rw - mount the device read/write
    auto / noauto Mount the device automatically with "mount -a" (which is done at boottime.
    users - allow normal users to mount the device
    exec - allow programs to be executed (run) from the device.
  5. fs_freq - Is used by the dump command. Just set it to zero
  6. fs_passno - Is used by fsck to determine the order in which filesystems are checked at reboot time. Again, just set it to zero.

A few examples:
On my linux box there is a line in /etc/fstab like this

/dev/sdb3 /mnt/fat1 vfat auto,users,rw,exec,umask=000 0 0

which mounts the third partition on my second harddrive to the /mnt/fat1 directory.

On my 770, the mmc card has several partitions. The first one is a FAT32 partition and is automatically mounted at boottime with this line in /etc/fstab:

/dev/mmcblk0p1 /media/mmc1 vfat rw,noauto,nodev,nosuid,utf8,uid=29999 0 0

More info on the fstab file and the mount command can be found by Googling for their manpages.

Once you have the proper line in /etc/fstab, you can mount the device by referring to the mountpoint i.e. "mount /mnt/fat1"

Last edited by BanditRider; 2007-12-21 at 00:12.
 
Posts: 20 | Thanked: 0 times | Joined on Nov 2007
#5
So if I add a line to the fstab like this it should work?
/dev/sda1 /media/mmc1/hd vfat rw,auto
I am not sure what the nodev and the nosuid are or should be. I would like it to automount on boot, if that is possible. I had read posts earlier about not being able to auto detect unlike the mc. Thanks for the help so far.
 
Posts: 20 | Thanked: 0 times | Joined on Nov 2007
#6
Ok I was just doing some more reading, if I use this line will it work
/dev/sda1 /media/mmc1/hd vfat rw,auto 0 0
the hd is sda1 it will be mounted at media/mmc1/hd and I want it to auto mount on boot.
 
Posts: 56 | Thanked: 8 times | Joined on Nov 2007
#7
If you don't know how to use vim (and really, no one would blame you)

Wanna bet? ;-)

I took the bait and climbed the learning curve to learn vim and I've never been able to find an editor that I like better since. I write code, articles, email, you name it... all in vim. A few times a year I try whatever is new, but find myself wanting, no *yearning*, for my modal editor, my super-helpful, ultra-fast, very productive, vim.

Those who press ESC in a web text box or hjkl or $ or ESC shift a before realizing that they don't have the power of vi(m) at hand ... well, you know what I mean.

More seriously though, a basic understanding of vi(m) is useful; you can edit on any *nix box regardless of what might/might not be installed, vi almost always is. You don't have to drink all the koolaid to be productive enough for the odd task that comes along.

Last edited by wetcoast; 2007-12-21 at 02:06.
 
Posts: 264 | Thanked: 28 times | Joined on May 2006
#8
I would use /media/hd instead of /media/mmc1/hd because your mmc card gets mounted at mmc1. But it might work. Also add users to the option list to allow non-root users to mount the device. As far as auto mounting at boot time, that depends on whether or not the usb host mode stuff is up and running before the mount -a happens. If it doesn't automount, just run mount -a.

/dev/sda1 /media/hd vfat rw,auto,users 0 0

should work.
 

The Following User Says Thank You to BanditRider For This Useful Post:
Posts: 20 | Thanked: 0 times | Joined on Nov 2007
#9
Thanks alot, I will try that and let you know. Do I have to do anything else to view the hd after it boots?
 
Posts: 20 | Thanked: 0 times | Joined on Nov 2007
#10
when I type mount -a it tells me that it failed:invalid argument
 
Reply


 
Forum Jump


All times are GMT. The time now is 05:59.