DSM-G600, DNS-3xx and NSA-220 Hack Forum

Unfortunately no one can be told what fun_plug is - you have to see it for yourself.

You are not logged in.

Announcement

#1 2007-07-21 10:31:39

noodle
Member
Registered: 2007-07-13
Posts: 62

Suggestion on USB flash driver?

Hi Forum,

I'm planning to use a USB flash driver on my DNS-323 for etch and fun_plud and so on. Of cause, fun_plug file still under /mnt/HD_a2, but all the others will moved to USB flash driver. So I can umount /mnt/HD_a2 and /mnt/HD_b2 for e2fsck anytime.

So that means this USB flash driver will attached and up to run 24/7. I need some advice on USB flash driver for this purpose.

1. DNS-323 can recognize it. Which one are you using and DNS-323 can recognize it?
2. capability: should 512M or 1G enough?
3. speed: I saw some cheap USB flash driver got pretty slow write speed, but since this one is mostly read-only (I'm thinking to mount it as read only, just like /boot, /usr in a regular *nix system), is write speed slow fine? Does it require to write any thing (Of cause, I can always change the script to avoid writing on it)
4. temperate: I saw some user complain that USB flash driver become to warm when they use it (either write, or read and write). Is the one you are using warm?
5. I'm using 1.04beta (yes, it's a little risky, but unicode support in samba 3.x is impotent to me), I saw from uname -a, it's kernel 2.6.12.6-arm1. Is the one from http://dev.skcserver.de/dns323/modules_ … storage.ko good for it?
6. Is it possible to format USB flash driver into ext2? or it's had to be FAT32 or NTFS?

Thanks for your advice

Noodle

Offline

 

#2 2007-07-23 10:19:31

noodle
Member
Registered: 2007-07-13
Posts: 62

Re: Suggestion on USB flash driver?

After some research, finally, I have a 1G USB flash drive installed, and I made Fonz's fun_plug (0.3) installed on USB flash drive. This way, I can easily umount /dev/md0 and /dev/md1 to do e2fsck. also, using telnet and such services will not force Hard disk wake up.

Here is what I did.

Create a file mount-sys (755) under /mnt/HD_a2/fun_plug.d to mount USB flash drive, modify file fun_plug to call mount-sys to mount /mnt/sys, and then use /mnt/sys/fun_plug.d as FUNPLUGDIR if /mnt/sys mounted successfully, otherwise, back to /mnt/HD_a2/fun_plug.d

modify Fonz's fun_plug file to mount USB flash drive first:

Code:

#!/bin/sh

VOL1=/mnt/HD_a2
VOL2=/mnt/HD_b2
VOL3=/mnt/sys
export VOL1
export VOL2
export VOL3

umask 022

# mount sys (/dev/sdc1) first
if [ -x "${VOL1}/fun_plug.d/mount-sys" ]; then
    ${VOL1}/fun_plug.d/mount-sys start 1>>/dev/null 2>&1
fi

# check if mount success
# if mounted, use /mnt/sys as root of fun_plug
# else use /mnt/HD_a2
mount | grep ${VOL3} 1>/dev/null 2>/dev/null
if [ $? -eq 0 ]; then
    FUNPLUGDIR=${VOL3}/fun_plug.d
else
    FUNPLUGDIR=${VOL1}/fun_plug.d
fi
FUNPLUGTAR=${VOL1}/fun_plug.tar
ETCDIR=${FUNPLUGDIR}/etc
BINDIR=${FUNPLUGDIR}/bin
SBINDIR=${FUNPLUGDIR}/bin
LIBDIR=${FUNPLUGDIR}/lib
LOGDIR=${FUNPLUGDIR}/log
LOGFILE=${LOGDIR}/fun_plug.log
PATH=${BINDIR}:${PATH}
LD_LIBRARY_PATH=${LIBDIR}

export FUNPLUGDIR
export ETCDIR
export BINDIR
export LIBDIR
export LOGDIR
export LOGFILE
export PATH
export LD_LIBRARY_PATH

mkdir -p ${FUNPLUGDIR} ${LOGDIR}
echo "**** fun_plug script for DNS-323 (2007-07-22 tp@fonz.de) ****" >>${LOGFILE}
date >>${LOGFILE}

if [ -r "${FUNPLUGTAR}" ]; then
    echo "* Extracting ${FUNPLUGTAR}..." >>${LOGFILE}
    /bin/tar -xv -f ${FUNPLUGTAR} -C ${FUNPLUGDIR} 1>>${LOGFILE} 2>&1
    echo "* Deleting ${FUNPLUGTAR}..." >>${LOGFILE}
    rm -f ${FUNPLUGTAR}
fi

# suid busybox
if [ -e ${BINDIR}/busybox ]; then
    chown root.root ${BINDIR}/busybox
    chmod 0755 ${BINDIR}/busybox
    chmod u+s ${BINDIR}/busybox
fi

echo "${LIBDIR}" >>/etc/ld.so.conf
ldconfig

if [ -d "${FUNPLUGDIR}/start" ]; then
    for fun_plug_script in ${FUNPLUGDIR}/start/*.sh; do
        if [ -x "${fun_plug_script}" ]; then
            echo "* Running ${fun_plug_script} start ..." >>${LOGFILE}
            ${fun_plug_script} start 1>>${LOGFILE} 2>&1
        else
            echo "* ${fun_plug_script} not executable..." >>${LOGFILE}
        fi
    done
else
    echo "* ${FUNPLUGDIR}/start: Directory not found"
fi

echo "* Done" >>${LOGFILE}

And /mnt/HD_a2/fun_plug.d/mount-sys was modified from mount-disk.sh:

Code:

#!/bin/sh

# see
# "Attaching USB Storage to the DNS-323 for Linux Newbies & Dummies"
# http://dns323.kood.org/forum/viewtopic.php?pid=3221#p3221

options="-t auto"
#options="-t auto -o umask=0"
disk=sdc1

mount_disk_start() {
    insmod ${VOL1}/fun_plug.d/bin/modules/$(uname -r)/usb-storage.ko 2>/dev/null
    #insmod ${VOL1}/fun_plug.d/bin/modules/$(uname -r)/ntfs.ko        2>/dev/null
    
    # wait for disk...
    let timeout=60
    while [ ${timeout} -gt 0 ]; do
        grep ${disk} /proc/partitions >/dev/null 2>/dev/null
        [ $? -eq 0 ] && break
        sleep 2
        let timeout=${timeout}-2
    done
    
    mkdir -p ${VOL3}
    mount ${options} /dev/${disk} ${VOL3} >${VOL3}/mount-error.txt 2>&1
}

mount_disk_stop() {
    umount ${VOL3}
}

mount_disk_status() {
    mount | grep ${VOL3} 1>/dev/null 2>/dev/null
    if [ $? -eq 0 ]; then
        echo "running"
    else
        echo "stopped"
    fi
}

case "$1" in
    stop)
        mount_disk_stop
        ;;
    restart)
        mount_disk_stop
        sleep 10 # unplug'ging a disk takes time
        mount_disk_start
        ;;
    status)
        mount_disk_status
        ;;
    start|'')
        mount_disk_start
        ;;
    *)
        echo "Usage: $0 start|stop|restart|status"
        ;;
esac

Offline

 

#3 2007-07-23 19:57:51

dickeywang
Member
Registered: 2007-06-29
Posts: 59

Re: Suggestion on USB flash driver?

Nice work Noodle!
I thought the USB port on DNS-323 could only be used for USB printer. It is really useful to be able to connect a USB drive to the DNS-323, especially when you want to backup your important data before doing something like firmware update. smile
Thanks!

Offline

 

#4 2007-07-23 22:21:18

noodle
Member
Registered: 2007-07-13
Posts: 62

Re: Suggestion on USB flash driver?

Thanks should go to some other guys, especially Fonz and the forum, I just modified their scripts.

Offline

 

#5 2008-04-06 15:36:44

dweezil
Member
Registered: 2008-01-26
Posts: 18

Re: Suggestion on USB flash driver?

Hi,

I'm trying to use a flash drive to run fun_plug, but I am fighting off an annoying problem:

I used a modified usbdisk.sh script to mount the usb drive.  It worked well when the
device is all booted up, but when I try to start it thru the fun plug, it times out (60sec. !)
and fall back to my hd fun_plug installation.  It seems the usb-storage.ko driver is not
ready yet and when the script look like the sdc entry in /proc/partitions, it's not showing
up before the timeout.

Any suggestion?

Thanks


---------------------------------------------------------------
I have a message to deliver to the cute people of the world...if you're
cute, or maybe you're beautiful...there's MORE OF US UGLY MOTHERFUCKERS
OUT THERE THAN YOU ARE!! So watch out.  -- Frank Zappa

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2010 PunBB