Difference between revisions of "Debian usbmount"

From NAS-Central Buffalo - The Linkstation Wiki
Jump to: navigation, search
 
 
(4 intermediate revisions by 3 users not shown)
Line 2: Line 2:
 
There is nothing special here, you will also need module-init-tools for automatic kernel modules loading
 
There is nothing special here, you will also need module-init-tools for automatic kernel modules loading
 
  apt-get install usbmount module-init-tools
 
  apt-get install usbmount module-init-tools
then reboot
+
then update module list and reboot
 +
depmod -ae && reboot
  
 
== configuration ==
 
== configuration ==
Line 16: Line 17:
 
               /media/usb4 /media/usb5 /media/usb6 /media/usb7"
 
               /media/usb4 /media/usb5 /media/usb6 /media/usb7"
 
with what you want (do not forget to create the directories)
 
with what you want (do not forget to create the directories)
 +
 +
== dynamic symlinks ==
 +
If you want a symlink to appear in the Samba share when a device is automatically mounted you will need to edit the scripts in /etc/usbmount/mount.d and /etc/usbmount/umount.d.  Note, use the path to your shared directory, it may be different from mine.
 +
 +
Edit the mount.d script:
 +
nano /etc/usbmount/mount.d/00_create_model_symlink
 +
 +
Add the following to the symlink creation section of the script:
 +
test -e "/mnt/disk1/share/$name" || ln -sf "$UM_MOUNTPOINT" "/mnt/disk1/share/$name"
 +
 +
Edit the umount.d script:
 +
nano /etc/usbmount/umount.d/00_remove_model_symlink
 +
 +
Add the following section:
 +
ls /mnt/disk1/share | while read name; do
 +
    if test "`readlink \"/mnt/disk1/share/$name\" || :`" = "$UM_MOUNTPOINT"; then
 +
        rm -f "/mnt/disk1/share/$name"
 +
        break
 +
    fi
 +
done
 +
 +
{{Template:Articles|Kurobox|Debian}}

Latest revision as of 13:33, 17 March 2011

Install usbmount

There is nothing special here, you will also need module-init-tools for automatic kernel modules loading

apt-get install usbmount module-init-tools

then update module list and reboot

depmod -ae && reboot

configuration

If you want to automount vfat devices, edit usbmount configuration :

nano /etc/usbmount/usbmount.conf
// replace
FILESYSTEMS="ext2 ext3"
// with
FILESYSTEMS="ext2 ext3 vfat"

By default, usb disks will be mounted to /media/usb0 to usb7, if you want to change that replace :

MOUNTPOINTS="/media/usb0 /media/usb1 /media/usb2 /media/usb3
             /media/usb4 /media/usb5 /media/usb6 /media/usb7"

with what you want (do not forget to create the directories)

dynamic symlinks

If you want a symlink to appear in the Samba share when a device is automatically mounted you will need to edit the scripts in /etc/usbmount/mount.d and /etc/usbmount/umount.d. Note, use the path to your shared directory, it may be different from mine.

Edit the mount.d script:

nano /etc/usbmount/mount.d/00_create_model_symlink

Add the following to the symlink creation section of the script:

test -e "/mnt/disk1/share/$name" || ln -sf "$UM_MOUNTPOINT" "/mnt/disk1/share/$name"

Edit the umount.d script:

nano /etc/usbmount/umount.d/00_remove_model_symlink

Add the following section:

ls /mnt/disk1/share | while read name; do
   if test "`readlink \"/mnt/disk1/share/$name\" || :`" = "$UM_MOUNTPOINT"; then
       rm -f "/mnt/disk1/share/$name"
       break
   fi
done