Darren Spruell <[EMAIL PROTECTED]> writes:

> Greetz,
> I use a USB pocket drive and am having the hardest time figuring out how to
> mount it into the filesystem. Following are what I thought to be important:
> Generally I use the command 'mount -t msdos /dev/rda0s1 /mnt' to mount this
> to my filesystem. Sometimes it works, sometimes it fails. When it does work
> I can only mount it as root. In order to be able to mount this as a regular
> user, do I have to put some flags into a line in /etc/fstab? What would be
> the best way to make this drive user mountable?
> The other question is, is there a better way to mount up the device or
> control it via a usb tool or is the way I am doing it correct?

I'll tell you what I do with a CompactFlash card, which I believe should
work for you as well. Most of the time I just need to copy over the stuff
from the memory card to local disk. So I have a script that:

1. mounts the device
2. copies everything over from the card to a directory on the local disk
3. unmounts

This script is hooked from pccardd (and in your case it'll be hooked from
usbd) so it runs as root.

I'm using the -nrp flags to cp, so it won't overwrite any existing
files. This works ok if whatever is writing to the device is always
generating fresh names for new files (which is true in my case). If there
is possible name-collision, you can change the script to put everything in
a directory with a timestamp in its name.

Now, for the times I want to directly manipulate the CF card (usually big
deletions), I use the automounter. It'll automatically mount the card when
I access /auto/localhost/cf, and unmount it after 5 minutes of no
access. You need to remember not to pull the card/usb-thingie out while
it's still mounted (if you're in a hurry, become root and umount). For more
details about this, I recommend reading

Also, for msdos mounts, it's usually most convenient to chown the directory
underneath the mount point so it's owned by the primary user of the machine
and his/her group. This way, once the files are copied over by the script,
they're still owned by "you" and you can write or delete them easily (I
found that the -u and -g flags to mount_msdos don't help you here: cp -r
will still create any intermediate directories as root/wheel).

Note you can use either the usbd/pccardd hook or the automount method, or
both - neither depends on the other to work.


  Dan Pelleg

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-questions" in the body of the message

Reply via email to