wiki'd

by JoKeru

OpenWRT USB Storage

$ opkg update

$ opkg install kmod-usb-core kmod-scsi-core kmod-usb-storage kmod-usb2 kmod-fs-ext2

$ opkg install e2fsprogs
$ dmesg | grep 'scsi'
$ mkfs.ext2 /dev/scsi/host0/bus0/target0/lun0/part1

$ mkdir /backup-usb
$ mount -t ext2 -o noatime /dev/scsi/host0/bus0/target0/lun0/part1 /backup-usb

$ vi /etc/init.d/usb-mount
$ chmod +x /etc/init.d/usb-mount
$ /etc/init.d/usb-mount enable

/etc/init.d/usb-mount

#!/bin/sh /etc/rc.common
START=80
STOP=40

start() {
 echo -n "Testing USB Partition: "
 e2fsck -p /dev/scsi/host0/bus0/target0/lun0/part1 &
 sleep 5
 echo -n "Mounting USB drive: "
 mount -t ext2 -o noatime /dev/scsi/host0/bus0/target0/lun0/part1 /backup-usb
 echo "Done."
 #/usr/bin/rsync --daemon
}

stop() {
 echo -n "UnMounting USB drive: "
 umount /dev/scsi/host0/bus0/target0/lun0/part1
 echo "Done."
 #/bin/kill -9 `cat /var/run/rsyncd.pid`
 #/bin/rm /var/run/rsyncd.pid
}

restart() {
 stop
 start
}

Comments