Port-sandpoint archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Automount USB disks on your NAS



Hi,

while setting up a sandpoint NAS for a friend (with Samba, NFS,
web-server, etc.) I had to find a way to mount USB disks automatically,
because I cannot expect him to login with SSH and type some mount
commands.

On the netbsd-users mailing list I found this nice solution by
Stephen Borrill, using amd(8), which worked fine for me:

http://mail-index.netbsd.org/netbsd-users/2008/10/07/msg002136.html

I changed the script to mount /dev/sd0e instead of /dev/sd0d and
added some code to use the USB LED of the NAS to indicate that the
USB device is currently mounted.

For most sandpoint NAS the LEDs can be controlled by writing one or
more characters to /dev/satmgr. Examples:

                USB LED on  USB LED off
---------------------------------------
QNAP            `           b
Synology        @           B
DLink           MMF\n       MMC\n       (yellow, green is MMK)
Kurobox         WW          VV          (using the Disk-Full LED)

For NH230/231 you can use gpioctl(8) to turn on USB LED 1 (pin 6) or
2 (pin 7). The pins are active-low:
# /usr/sbin/gpioctl gpio0 6 0
# /usr/sbin/gpioctl gpio0 7 0


Besides amd.conf, amd.local and devmount, which you have to put into
/etc, you have to create the directory /amd as root and enable rpcbind
and amd in /etc/rc.conf:
rpcbind=YES
amd=YES

# ls -l /mnt/usb/
...will mount and list your USB device with FAT. It is unmounted after 5
seconds, indicated by the USB LED. When you have a lock on the USB
filesystem, e.g. by entering the directory with cd(1), the filesystem
stays mounted.

Attached /etc/devmount is for QNAP. Change it to match your needs.

Have fun!

-- 
Frank Wille

Attachment: amd.conf
Description: Binary data

Attachment: amd.local
Description: Binary data

Attachment: devmount
Description: Binary data



Home | Main Index | Thread Index | Old Index