Unfortunately no one can be told what fun_plug is - you have to see it for yourself.
You are not logged in.
Attached you will find 2 scripts for mounting USB devices. Some of you may have noticed that if you do not always have your USB devices plugged into the same port in your hub, it will be given a different /dev/sd*. Also, I have had it happen a couple of time where it still does not load in the correct order even when I do not change what port they are plugged into. It also changes if you install or remove an internal hard drive.
Anyway, the first script (part_table.sh) creates a file named part.conf in the /mnt/HD_a/ffp/start/conf directory. It populates this file with current partition and mounting information, along with the serial number of each USB device. This script only needs to be run once, after you have your system running with all your USB devices mounted where you want them. (Run this only after a reboot, as "hot swapping" usb devices will change the USB sequence.) You can also manually edit the file if you wish to change something (especially for a device that is not connected at the time).
The second script (usbmount.sh) can be run directly from the fun_plug or manually. It replaces the usbdisk.sh script. It first installs the usb-storage.ko module, then waits for USB devices to be ready. It looks at the USB devices currently installed and matches their serial numbers to those in the part.conf file. It will then mount the USB devie to the correct location.
This was written for fonz fun_plug 0.5, but with minor modification can be used with any fun_plug.
This has been tested with USB flash drives, but not with US hard drives, as I still have to run out and get a powered hub.
Please look it over. I'm sure there is probably an easier / shorter way to do this, so feel free to comment.
I'm currently working doing the same thing with Samba.
Last edited by bq041 (2008-03-31 20:02:54)
Offline
I've solved the same problem by using e2label to label the partitions and placing a 5 second "sleep" after loading the kernel module.
Just my 0.02$.
Offline
I chose to do it this way so it was simple for new people to the fun_plug. I originally did it very simply with the device capacity, but if you have 2 identical devices, it won't work. I figured, the odds of hitting 2 identical serial numbers were very low.
Offline
Updated second file
This removes the delay when running the program except at start.
Offline
Updated file locations for .conf files. to the /ffp/etc directory
edit - 15 April -- changed gawk command to awk for those who have not yet installed gawk. Also found issue that lines 23-24 may need to swapped depending on your system. One is commented out. I found on one of my dns323s it needs to be ^13 and the other one needs to be ^14. I will investigate this further when I have both units in front of me and will try to automate this.
## grep -n '' /proc/scsi/mvSata/${file_name}|grep '^14'|grep -w '0' >/dev/null 2>/dev/null
grep -n '' /proc/scsi/mvSata/${file_name}|grep '^13'|grep -w '0' >/dev/null 2>/dev/null
Last edited by bq041 (2008-04-15 19:54:53)
Offline
Updated file locations for .conf files. to the /ffp/etc directory
edit - 15 April -- changed gawk command to awk for those who have not yet installed gawk. Also found issue that lines 38-39 may need to swapped depending on your system. One is commented out. I found on one of my dns323s it needs to be ^13 and the other one needs to be ^14.
## grep -n '' /proc/scsi/mvSata/${file_name}|grep '^14'|grep -w '0' >/dev/null 2>/dev/null
grep -n '' /proc/scsi/mvSata/${file_name}|grep '^13'|grep -w '0' >/dev/null 2>/dev/null
Last edited by bq041 (2008-04-15 19:25:11)
Offline
Got the answer. In hardware revision A1, the SATA controller is on the PCI bus, which is why I needed the grep command to look at line 14 in /proc/scsi/mvSata/..., and in hardware B1, the SATA controller is integrated, so there is no PCI Bus reference in the /proc/scsi.mvSata/..., resulting in having to have grep look at line 13.
Last edited by bq041 (2008-04-15 23:42:48)
Offline
I fixed up some bugs and added options during mounting
- 1.1.2 umount /mnt/HD_a4 with 1 hdd (because it only looks for 1 partition)
- added the -o option during mounting (retains options because I have a FAT thumbdrive and I need to mount with fmask,dmask)
- I don't know what to do with status, so for the mean time i just print the mount table
- do not need to edit lines 38-39 as I use another method to search
added a fun_plug which will mount all usb drives first before ffp is linked, thus allows you to put ffp on your thumbdrive. Just replace fun_plug_usb to your /mnt/HD_a2/fun_plug, and edit the FFP_USB_PATH path. The script will try to use ffp on the FFP_USB_PATH, and if it does not exist it'll fail back to ffp on FFP_PATH
Offline
Hi,
I am trying to get this script to work, but have had no luck. Can it be that the there is a failure to read the usbstick's serial no?
here is the part.conf
8 0 244198584 sda None
8 1 530113 sda1
8 2 242228070 sda2
8 16 244198584 sdb
8 17 530113 sdb1
8 18 242228070 sdb2
8 32 64591 sdc
8 33 64228 sdc1 /mnt/HD_a2/sdc1 rw
and /proc/scsi/usb-storage/4
Host scsi4: usb-storage
Vendor: Unknown
Product: Unknown
Serial Number: None
Protocol: Transparent SCSI
Transport: Bulk
Quirks:
I am trying to get this working with ffp 0.5. I did have an error something like: 'recorder usb-storage.ko has no provider' in ffp.log, so I changed "# REQUIRES: usb-storage.ko" to "## REQUIRES: usb-storage.ko" in usbmount.sh
thanks
lu
Offline
I don't have either unit in fromt of me right now, but it appears that the serial number (None) got placed in the wrond spot (sda) instead of sdc1. I will have to look at it when I get home.
Offline
great thanks. One other thing, why the path /mnt/HD_a2/sdc1 and not /mnt/sdc1 ?
lu
Offline
luusac wrote:
great thanks. One other thing, why the path /mnt/HD_a2/sdc1 and not /mnt/sdc1 ?
lu
that's where you mounted to
Offline
oh dear, so it is :-)
Offline
luusac wrote:
Hi,
I am trying to get this script to work, but have had no luck. Can it be that the there is a failure to read the usbstick's serial no?
I am trying to get this working with ffp 0.5. I did have an error something like: 'recorder usb-storage.ko has no provider' in ffp.log, so I changed "# REQUIRES: usb-storage.ko" to "## REQUIRES: usb-storage.ko" in usbmount.sh
thanks
lu
I think you are using revision A1, so the part_table.sh didn't get the correct hdd count.
Use this instead. Only part_table.sh is updated
I didn't know fonz had change his script, I'm still with the old 0.5
Offline
ok, thanks for that. this is what ffp.log shows now.
**** fun_plug script for DNS-323 (2008-04-13 tp@fonz.de) ****
Tue Jul 15 11:08:51 GMT 2008
mounting usb...
mount -t auto /dev/sdc1 /mnt/sdc1 -o rw
ln -snf /mnt/HD_a2/ffp /ffp
* Running /ffp/etc/rc ...
* /ffp/start/usbmount.sh inactive
* /ffp/start/rcS.sh ...
utmp:x:22:
* /ffp/start/adjtimex.sh ...
mode: 16384
-o offset: 0
-f frequency: 0
maxerror: 16384000
esterror: 16384000
status: 64 (UNSYNC)
-p timeconstant: 2
precision: 1
tolerance: 33554432
-t tick: 9965
time.tv_sec: 1216148942
time.tv_usec: 646255
return value: 5 (clock not synchronized)
sntp: using NTP server uk.pool.ntp.org (89.16.173.64)
NTP Server connected successfully!!!
System time: 2008/7/15 Tue 20:9:3
* /ffp/start/passwd.sh ...
Saving /etc/passwd to /etc/passwd.orig ...
Changing shells: /bin/sh -> /ffp/bin/sh ...
Updating /etc/shadow ...
* /ffp/start/shells.sh ...
* /ffp/start/syslogd.sh inactive
* /ffp/start/SERVERS.sh inactive
* /ffp/start/usbdisk.sh ...
Mounting /dev/sdc1 on /mnt/sdc1
Failed
mount: mounting /dev/sdc1 on /mnt/sdc1 failed: Device or resource busy
* /ffp/start/portmap.sh inactive
* /ffp/start/unfsd.sh inactive
* /ffp/start/cleanboot.sh inactive
* /ffp/start/nfsd.sh inactive
* /ffp/start/ntpd.sh ...
Starting /ffp/bin/ntpd -g -f /ffp/etc/ntp.drift
* /ffp/start/LOGIN.sh inactive
* /ffp/start/telnetd.sh ...
Starting /ffp/sbin/telnetd
* /ffp/start/sshd.sh ...
Starting /ffp/sbin/sshd
* /ffp/start/rsyncd.sh inactive
* /ffp/start/mediatomb.sh inactive
* /ffp/start/kickwebs.sh inactive
* /ffp/start/lighttpd.sh inactive
* /ffp/start/inetd.sh inactive
* /ffp/start/bootcmds.sh ...
* OK
dmesg shows:
Initializing USB Mass Storage driver...
scsi4 : SCSI emulation for USB Mass Storage devices
usb-storage: device found at 2
usb-storage: waiting for device to settle before scanning
usbcore: registered new driver usb-storage
USB Mass Storage support registered.
Vendor: ChipsBnk Model: Flash Disk Rev: 2.00
Type: Direct-Access ANSI SCSI revision: 02
SCSI device sdc: 129183 512-byte hdwr sectors (66 MB)
sdc: Write Protect is off
sdc: Mode Sense: 0b 00 00 08
sdc: assuming drive cache: write through
SCSI device sdc: 129183 512-byte hdwr sectors (66 MB)
sdc: Write Protect is off
sdc: Mode Sense: 0b 00 00 08
sdc: assuming drive cache: write through
sdc: sdc1
Attached scsi removable disk sdc at scsi4, channel 0, id 0, lun 0
Attached scsi generic sg2 at scsi4, channel 0, id 0, lun 0, type 0
usb-storage: device scan complete
lu
Offline
luusac wrote:
...
mount -t auto /dev/sdc1 /mnt/sdc1 -o rw
...
* /ffp/start/usbdisk.sh ...
Mounting /dev/sdc1 on /mnt/sdc1
Failed
mount: mounting /dev/sdc1 on /mnt/sdc1 failed: Device or resource busy
...
Why are you mounting twice? Seems you're mixing things up.
Offline
fonz wrote:
Why are you mounting twice? Seems you're mixing things up.
hmm, I can't account for this. I did notice this morning that a path change that I had made to the f/p hadn't saved. I think that I was swapping f/p files and cp'ed the wrong one. It works fine now, thanks. Fonz, did you see http://dns323.kood.org/forum/t2581-usin … ecked.html post #19. Perhaps you might consider adding that code to http://www.inreto.de/dns323/fsck/README.txt
or include a script to do so? It is for raid1, I am not sure about raid0.
thanks
lu
Offline
luusac wrote:
Fonz, did you see http://dns323.kood.org/forum/t2581-usin … ecked.html post #19. Perhaps you might consider adding that code to http://www.inreto.de/dns323/fsck/README.txt
I updated the README, but still my understanding of RAID is quite shallow.
Offline
fonz wrote:
I updated the README, but still my understanding of RAID is quite shallow.
Great. Mine too :-)
Offline
The assemble cammand I left in the thread you are talking about will assemble any mdadm array on /dev/md0. It can be raid1, raid0, linear (JBOD), and so on. Just substitute the correct md and sd's that the array(s) are comprised of. For example, a raid 1 setup with extra space as jbod would be (to assemble both of them):
mdadm -A /dev/md0 /dev/sd[ab]2 mdadm -A /dev/md1 /dev/sd[ab]3
The /dev/sd[ab]2 is the funtional equivilant of:
/dev/sda2 /dev/sdb2
Last edited by bq041 (2008-07-18 07:06:21)
Offline