LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   *BSD (https://www.linuxquestions.org/questions/%2Absd-17/)
-   -   how can i configure FreeBSD to auto mount USB devices? (https://www.linuxquestions.org/questions/%2Absd-17/how-can-i-configure-freebsd-to-auto-mount-usb-devices-432843/)

asilentmurmur 04-07-2006 07:06 PM

how can i configure FreeBSD to auto mount USB devices?
 
Hey everyone

I need help on mounting my USB connected external DVD burner to my FreeBSD 6.0 box. I want to set up the configuration of FreeBSD so that it will automatically recognize and mount an USB device during boot up or during the time the operating system is working. So basically i want it to run like plug and play on Windows XP. How would I go about doing that? All help will be GREATLY appreciated.

frob23 04-08-2006 03:23 PM

You will need to manually edit /etc/devd.conf

Just create/edit the attach entry for the device it shows up on to do what you would do manually.

I would recommend creating a shell script to do the actual mounting as your code should test for certain things and be prepared for failure.

So, for example, your code would be something like:
Code:

# The entry below starts moused when a mouse is plugged in. Moused
# stops automatically (actually it bombs :) when the device disappears.
attach 100 {
        device-name "ums[0-9]+";
        action "/etc/rc.d/moused start $device-name";
};

This is the usb mouse code right here. You would replace the part after action with the shell script command to mount the device.

Note automatic unmounting is another issue. I have never got that working perfectly. You see, the unmount should happen before the device is unplugged... and you won't get the detach signal until you unplug the device -- so you can't use the same method.

curioso 04-24-2006 01:24 PM

I use kde/FreeBSD 6.1. and I had add this lines to /etc/devd.conf to mount and umount my 128 MB Jetflash usb:


### 0x6688 is jetflash id, see it with devd -dD and pluggin the jetflash
## to mount it
attach 20 {
device-name "umass0";
match "product" "0x6688";
action "sleep 2 ; \
sh /etc/rc.d/devfs restart ; \
/sbin/kldload msdosfs ; \
su - youruserinkde -c '/sbin/mount /dev/da0s1' ; \
su - youruserinkde -c 'konqueror /home/youruserinkde/jetflash -display :0'" ;
};

### to umount it
detach 20 {
device-name "umass0"; action "/sbin/umount /home/youruserinkde/jetflash ; \
/sbin/kldunload msdosfs ";
};


All times are GMT -5. The time now is 11:28 AM.