Unfortunately no one can be told what fun_plug is - you have to see it for yourself.
You are not logged in.
Hi All,
Newby trying to get USB mounts working reliably for use with net cams for security recording. I just can't get the sticks to mount using UUID with Telnet or fstab. I'm not at all familure with Linux, just figuring this out as I go along from the DNS323 wiki.
I am having trouble maintaining the mount on 4 usb sticks. Using ffp to run the below (first attempt) from the start folder I can mount the disks and have them visable on the network. They work perfectly (3 cameras record any detected motion to the sticks - 1 each and a spare) , however after some time (varies, usually only a few hours) the mounts change to sdg1, sdh1 etc. and are no longer mounted to the folders I'm using.
Is it possible to mount using the UUIDs of the 4 sticks? I've tried using telnet and tried modifying fstab adding in:
UUID=dd02-5647 /mnt/USB_1 vfat defaults 0 0
UUID=8043-15a7 /mnt/USB_2 vfat defaults 0 0
UUID=46fd-4d52 /mnt/USB_3 vfat defaults 0 0
UUID=da69-2d76 /mnt/USB_4 vfat defaults 0 0
mount-external.sh in ffp/start
First attempt (without UUID, worked but does not persist):
#!/bin/sh
insmod /mnt/HD_a2/lnx_bin/usb-storage.ko
sleep 15
mkdir /mnt/USB_1
sleep 10
mount -t vfat -o umask=0000 /dev/sdc1 /mnt/USB_1
sleep 10
mkdir /mnt/USB_2
sleep 10
mount -t vfat -o umask=0000 /dev/sdd1 /mnt/USB_2
sleep 10
mkdir /mnt/USB_3
sleep 10
mount -t vfat -o umask=0000 /dev/sde1 /mnt/USB_3
sleep 10
mkdir /mnt/USB_4
sleep 10
mount -t vfat -o umask=0000 /dev/sdf1 /mnt/USB_4
sleep 10
/usr/bin/smb stop
sleep 10
cp /mnt/HD_a2/External_Mount_Files/smb.conf /etc/samba/smb.conf
sleep 10
/usr/bin/smb start
Second attempt using modified fstab with UUID to try to keep the mounts fixed:
#!/bin/sh
insmod /mnt/HD_a2/lnx_bin/usb-storage.ko
sleep 15
mkdir /mnt/USB_1
sleep 10
mkdir /mnt/USB_2
sleep 10
mkdir /mnt/USB_3
sleep 10
mkdir /mnt/USB_4
sleep 10
cp /mnt/HD_a2/External_Mount_Files/fstab /etc/fstab
sleep 10
mount -a
sleep 10
/usr/bin/smb stop
sleep 10
cp /mnt/HD_a2/External_Mount_Files/smb.conf /etc/samba/smb.conf
sleep 10
/usr/bin/smb start
I think UUID mounts will sort the moving position issue but I can't find a way to mount using UUID, just wont work, is it possible?
Offline
Here is an extact of my fun_plug I got it from somewhere. It uses blkid to find the device from UUID, then it mounts. Hope it helps.
#!/bin/sh
# variables
USB_MOUNTP=/mnt/USB
USB_DEV_UUID=8bb30a6a-d40b-47ad-8953-dffd76157ccc
FFP_HD=/mnt/HD_a2/ffp
FFP_USB=$USB_MOUNTP/ffp
HD_MOUNTP=/mnt/HD_a2
PROPER_MOUNTP=$HD_MOUNTP
HD_PREFIX=/hd
USB_PREFIX=/usb
PROPER_PREFIX=/data
FFP_PATH=$FFP_HD
FFP_PREFIX=/ffp
FFP_BB=$FFP_HD/bin/busybox
FFP_TARBALL=$HD_MOUNTP/fun_plug.tgz
FFP_RC=$FFP_PREFIX/etc/rc
# write a log, in case sth goes wrong
FFP_LOG=$HD_MOUNTP/ffp.log
exec >>$FFP_LOG 2>&1
#exec >>/dev/null 1>/dev/null 2>/dev/null
echo "**** fun_plug script for DNS-323 (2010-05-07 with USB load) ****"
date
uname -r
# install tarball
if [ -r $FFP_TARBALL ]; then
echo "* Installing $FFP_TARBALL ..."
mkdir -p $FFP_PATH && tar xzvf $FFP_TARBALL -C $FFP_PATH
if [ $? -eq 0 ]; then
echo "* OK"
fi
rm $FFP_TARBALL
fi
# suid busybox on HDD
if [ -x $FFP_HD/bin/busybox ]; then
chown root.root $FFP_HD/bin/busybox
chmod 0755 $FFP_HD/bin/busybox
chmod u+s $FFP_HD/bin/busybox
fi
usbmod_loaded=no
#copy usb-storage module
if [ -e $FFP_HD/lib/modules/$(uname -r)/usb-storage.ko ]; then
echo "Found usb-storage.ko module. Copying..."
mkdir -p /lib/modules/$(uname -r)/
cp $FFP_HD/lib/modules/$(uname -r)/usb-storage.ko /lib/modules/$(uname -r)/
#load usb-storage module
insmod /lib/modules/$(uname -r)/usb-storage.ko
echo "insmod usb-storage.ko"
sleep 2
usbmod_loaded=yes
fi
# create FFP_PREFIX link
echo "ln -snf $FFP_PATH $FFP_PREFIX"
ln -snf $FFP_PATH $FFP_PREFIX
if test $usbmod_loaded = yes; then
# find usb device
usb_found=no
$FFP_HD/sbin/blkid -t UUID="$USB_DEV_UUID"
if [ $? -ne 0 ]; then
# wait for disk...
let timeout=30
echo "Waiting for $USB_DEV_UUID (up to $timeout seconds) ..."
while [ $timeout -gt 0 ]; do
$FFP_HD/sbin/blkid -t UUID="$USB_DEV_UUID" #>/dev/null 2>/dev/null
[ $? -eq 0 ] && break
sleep 3
let timeout=${timeout}-5
done
$FFP_HD/sbin/blkid -t UUID="$USB_DEV_UUID" #>/dev/null 2>/dev/null
if [ $? -ne 0 ]; then
echo "Failed. Did not find $USB_DEV_UUID."
usb_found=no
else
echo "Success. Found $USB_DEV_UUID."
usb_found=yes
fi
else
echo "Success. Found $USB_DEV_UUID."
usb_found=yes
fi
# mount usb device
if test usb_found=yes; then
#USB_DEV=`$FFP_HD/sbin/blkid -t UUID="$USB_DEV_UUID" 2>&1 | cut -d ":" -f 1`
$FFP_HD/sbin/blkid -t UUID="$USB_DEV_UUID" >/tmp/blkid 2>&1 #2>/dev/null
USB_DEV=`$FFP_BB cut -d ":" -f 1 </tmp/blkid`
mkdir -p $USB_MOUNTP
chmod 777 $USB_MOUNTP
echo "Mounting $USB_DEV on $USB_MOUNTP"
mount -t auto $USB_DEV $USB_MOUNTP >$USB_MOUNTP/mount-error.txt 2>&1
if [ $? -ne 0 ]; then
echo "Failed"
cat $USB_MOUNTP/mount-error.txt
else
echo "USB stick mounted"
fi
fi
fi
...Offline
RenderJM wrote:
UUID=dd02-5647 /mnt/USB_1 vfat defaults 0 0
UUID=8043-15a7 /mnt/USB_2 vfat defaults 0 0
UUID=46fd-4d52 /mnt/USB_3 vfat defaults 0 0
UUID=da69-2d76 /mnt/USB_4 vfat defaults 0 0
I think UUID mounts will sort the moving position issue but I can't find a way to mount using UUID, just wont work, is it possible?
such a syntax does not exist.
use
e2label /dev/sdb something
and in fstab:
LABEL=something
Offline
Such syntax does exist in newer ubuntu versions at least. Not sure how dns 323 likes it, though
Example ubuntu fstab on SD card.
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc nodev,noexec,nosuid 0 0
# / was on /dev/sdb1 during installation
UUID=f4693efb-ecdc-42e3-b833-0e8240fdc9e9 / ext4 errors=remount-ro 0 1
Offline
Thanks bjby, it's something to work from.
I tried it with USB_MOUNTP and USB_DEV_UUID tweaked to suit my system, it seems fairly robust in that it can handle different situations but it did not work, might be my usb-storage.ko which resides in /mnt/HD_a2/lnx_bin/usb-storage.ko, I don't quite understand how this addresses it.
At least I know it is possible to mount using UUID on the DNS323 with ffp. From first principles would one mount using telnet with the command "mount -t vfat -o umask=0000 UUID=DD02-5647 /mnt/USB_1" (perhaps not as this is not working for me) or is it more involved?
I see the script above finds the device first and then mounts it, I've already got the UUID's using blkid so I thought I could just issue a command to mount referring to the UUID.
Offline
Hi Oxygen,
If UUID is not an option at all I could create unique labels (currently all the same "transcend") and insert them into fstab e.g.
LABEL=transcend /mnt/USB_1 vfat defaults 0 0
Forgive the syntax if wrong, all I know about linux code is what I have picked up here trying to figure this out.
Offline
Maybe the dns323 kernel is so old it doesnt support UUID mount syntax.
I dont think it matters where usb-storage.ko is located as long as it is loaded.
Anyhow, a tip:
write a 'set -x' first in your script i.e.
#!/bin/sh
set -x
...
Makes it so much easier to figure out whats goes right and what goes wrong. You will figure it out.
Offline
Maybe a simpler approach is to do a minor change to what you had working.
old
mount -t vfat -o umask=0000 /dev/sdc1 /mnt/USB_1
new
mount -t vfat -o umask=0000 $(blkid | grep dd02-5647 | sed 's/:.*//g') /mnt/USB_1
Offline
Hi bjby,
Tried the grep approch:
I'm starting to think the DNS does not like UUID, I think I'll have a go at unique labels. I did not find much info on UUID in the wiki, could be it's not a runner. Thanks for the help, I think I'll hit the sack now and come at it with a fresh mind tomorrow.
Log without modified fstab:
**** fun_plug script for DNS-323 (2008-08-11 tp@fonz.de) ****
Mon Dec 27 23:26:36 GMT 2010
ln -snf /mnt/HD_a2/ffp /ffp
* Running /ffp/etc/fun_plug.init ...
* Running /ffp/etc/rc ...
* /ffp/start/syslogd.sh inactive
* /ffp/start/SERVERS.sh inactive
* /ffp/start/portmap.sh inactive
* /ffp/start/unfsd.sh inactive
* /ffp/start/nfsd.sh inactive
* /ffp/start/ntpd.sh inactive
* /ffp/start/LOGIN.sh inactive
* /ffp/start/telnetd.sh ...
Starting /ffp/sbin/telnetd -l /ffp/bin/sh
* /ffp/start/sshd.sh inactive
* /ffp/start/rsyncd.sh inactive
* /ffp/start/mount-external.sh ...
+ insmod /mnt/HD_a2/lnx_bin/usb-storage.ko
+ sleep 15
+ mkdir /mnt/USB_1
+ sleep 10
+ blkid
+ grep dd02-5647
+ sed s/:.*//g
+ mount -t vfat -o umask=0000 /mnt/USB_1
mount: can't find /mnt/USB_1 in /etc/fstab
+ sleep 10
+ mkdir /mnt/USB_2
+ sleep 10
+ blkid
+ sed s/:.*//g
+ grep 8043-15a7
+ mount -t vfat -o umask=0000 /mnt/USB_2
mount: can't find /mnt/USB_2 in /etc/fstab
+ sleep 10
+ mkdir /mnt/USB_3
+ sleep 10
+ blkid
+ grep 46fd-4d52
+ sed s/:.*//g
+ mount -t vfat -o umask=0000 /mnt/USB_3
mount: can't find /mnt/USB_3 in /etc/fstab
+ sleep 10
+ mkdir /mnt/USB_4
+ sleep 10
+ blkid
+ grep da69-2d76
+ sed s/:.*//g
+ mount -t vfat -o umask=0000 /mnt/USB_4
mount: can't find /mnt/USB_4 in /etc/fstab
+ sleep 10
+ /usr/bin/smb stop
$Shutting down SMB services:
$Shutting down NMB services:
+ sleep 10
+ cp /mnt/HD_a2/External_Mount_Files/smb.conf /etc/samba/smb.conf
+ sleep 10
+ /usr/bin/smb start
$Starting SMB services:
$Starting NMB services:
* /ffp/start/mediatomb.sh inactive
* /ffp/start/kickwebs.sh inactive
* /ffp/start/lighttpd.sh inactive
* /ffp/start/inetd.sh inactive
* OK
Log with modified fstab (UUID=dd02-5647 /mnt/USB_1 vfat defaults 0 0) etc.:
**** fun_plug script for DNS-323 (2008-08-11 tp@fonz.de) ****
Mon Dec 27 23:43:56 GMT 2010
ln -snf /mnt/HD_a2/ffp /ffp
* Running /ffp/etc/fun_plug.init ...
* Running /ffp/etc/rc ...
* /ffp/start/syslogd.sh inactive
* /ffp/start/SERVERS.sh inactive
* /ffp/start/portmap.sh inactive
* /ffp/start/unfsd.sh inactive
* /ffp/start/nfsd.sh inactive
* /ffp/start/ntpd.sh inactive
* /ffp/start/LOGIN.sh inactive
* /ffp/start/telnetd.sh ...
Starting /ffp/sbin/telnetd -l /ffp/bin/sh
* /ffp/start/sshd.sh inactive
* /ffp/start/rsyncd.sh inactive
* /ffp/start/mount-external.sh ...
+ insmod /mnt/HD_a2/lnx_bin/usb-storage.ko
+ sleep 15
+ mkdir /mnt/USB_1
+ sleep 5
+ mkdir /mnt/USB_2
+ sleep 5
+ mkdir /mnt/USB_3
+ sleep 5
+ mkdir /mnt/USB_4
+ sleep 10
+ cp /mnt/HD_a2/External_Mount_Files/fstab /etc/fstab
+ sleep 10
+ blkid
+ grep dd02-5647
+ sed s/:.*//g
+ mount -t vfat -o umask=0000 /mnt/USB_1
mount: mounting UUID=dd02-5647 on /mnt/USB_1 failed: No such file or directory
+ sleep 10
+ blkid
+ grep 8043-15a7
+ sed s/:.*//g
+ mount -t vfat -o umask=0000 /mnt/USB_2
mount: mounting UUID=8043-15a7 on /mnt/USB_2 failed: No such file or directory
+ sleep 10
+ blkid
+ grep 46fd-4d52
+ sed s/:.*//g
+ mount -t vfat -o umask=0000 /mnt/USB_3
mount: mounting UUID=46fd-4d52 on /mnt/USB_3 failed: No such file or directory
+ sleep 10
+ blkid
+ grep da69-2d76
+ sed s/:.*//g
+ mount -t vfat -o umask=0000 /mnt/USB_4
mount: mounting UUID=da69-2d76 on /mnt/USB_4 failed: No such file or directory
+ sleep 10
+ /usr/bin/smb stop
$Shutting down SMB services:
$Shutting down NMB services:
+ sleep 10
+ cp /mnt/HD_a2/External_Mount_Files/smb.conf /etc/samba/smb.conf
+ sleep 10
+ /usr/bin/smb start
$Starting SMB services:
$Starting NMB services:
* /ffp/start/mediatomb.sh inactive
* /ffp/start/kickwebs.sh inactive
* /ffp/start/lighttpd.sh inactive
* /ffp/start/inetd.sh inactive
* OK
Offline
well it seems the blkid/grep thingy missis. It is supuse to give the device e.g. /dev/sdc1 when fed with an UUID, thats the trick. But I'm kind of blindfolded from where I am sitting.
I suggest you put more debug output into the log. for example it would be intresting to se what the blkid command actually returns when executed from fun_plug.
Some explination on the ancient greek.
blkid, you alread now what it does.
grep, searches for a specific UUID entry.
sed, removes everything from the firts ':' to the end of the line. i..e converts
'/dev/sdc1: UUID="8bb30a6a-d40b-47ad-8953-dffd76157ccc" TYPE="ext2"'
to
'/dev/sdc1'
I think you are pretty close to getting this to work.
Offline
I re-ran my origial script to mount the sticks overnight to see if they are still getting lost in the morning. Two of the sticks had the same UUID and I reformated one of them to generate a new one, it's not likely but I wanted to see if that fixed the issue.
I ran blkid from telnet with the disks mounted correctly (for now) and got:
/ # blkid
/dev/loop0: TYPE="squashfs"
/dev/mtdblock0: TYPE="minix"
/dev/mtdblock1: TYPE="minix"
/dev/sda1: TYPE="swap"
/dev/sda2: UUID="45d79d20-1908-446d-9114-ed99fd55f32a" TYPE="ext2"
/dev/sda4: UUID="0a2493cd-ee1f-4657-aa3b-34156a6dbcbc" TYPE="ext2"
/dev/sdb1: TYPE="swap"
/dev/sdb2: UUID="34ac19af-0f95-4bf8-a9ad-31725d4b3fee" TYPE="ext2"
/dev/sdb4: UUID="238ba5d9-2c6a-42d5-ad20-5139bcbe0870" TYPE="ext2"
/dev/sdc1: LABEL="TRANSCEND" UUID="DA69-2D76" TYPE="vfat"
/dev/sdd1: LABEL="Transcend" UUID="DD02-5647" TYPE="vfat"
/dev/sde1: LABEL="Transcend" UUID="46FD-4D52" TYPE="vfat"
/dev/sdf1: LABEL="Transcend" UUID="8043-15A7" TYPE="vfat"
The uppercase TRANSCEND is the one I reformatted to change the UUID
I take it you have not written off the notion of UUID mounting?
When I saw the grep approach looking in fstab I thought we were on to something but when I changed the fstab to include
UUID=dd02-5647 /mnt/USB_1 vfat defaults 0 0
UUID=8043-15a7 /mnt/USB_2 vfat defaults 0 0
UUID=46fd-4d52 /mnt/USB_3 vfat defaults 0 0
UUID=da69-2d76 /mnt/USB_4 vfat defaults 0 0
and the second run returned
mount: mounting UUID=da69-2d76 on /mnt/USB_4 failed: No such file or directory
It looks like the mount command is working (I think) with grep but it's as if it can't see the stick even though blkid shows the correct value?!
It's being flustratingly unhelpful in it's response to UUID based mount instructions, I'm not sure if it is using them and not finding the device or just not working because it simply wont work on the DNS323. That said I don't have much of a backround in this sort of thing, just some C++ and Pascal in college. I find it more interesting now than then but that might just be because the alternative is do the Christmas thing!
Offline
Hi bjby,
Success (I think)!
I changed the fstab and the .sh file I created and added in your grep lines to use exclusively upper case to match the blkid output and the 4 mounted correctly on restart.
From the log below it looks like the grep lines are mounting locations sdc1 etc. Am I right in saying grep works with fstab so that even if the hub looses the connection when it reconnects the sticks will remain mapped to the folders USB_1 etc?
If this persists and the drives stay connected I think I'll post the modified fstab, smb.conf and my .sh file so anyone like me who has limited understanding of linux can use some fairly simple scripts to get a reliable hub mount to work. I'll give it 24 hours of camera recording traffic first to make sure.
Thanks for the help, you were very paitent. I fixated on lowercase UUID letters after reading a post somewhere that suggested lowercase was the way to go! I might also tweak my sleep times between comands, It is probably not nescessary to dwell so much but I wanted to avoid failure simply because of timing.
**** fun_plug script for DNS-323 (2008-08-11 tp@fonz.de) ****
Tue Dec 28 12:02:22 GMT 2010
ln -snf /mnt/HD_a2/ffp /ffp
* Running /ffp/etc/fun_plug.init ...
* Running /ffp/etc/rc ...
* /ffp/start/syslogd.sh inactive
* /ffp/start/SERVERS.sh inactive
* /ffp/start/portmap.sh inactive
* /ffp/start/unfsd.sh inactive
* /ffp/start/nfsd.sh inactive
* /ffp/start/ntpd.sh inactive
* /ffp/start/LOGIN.sh inactive
* /ffp/start/telnetd.sh ...
Starting /ffp/sbin/telnetd -l /ffp/bin/sh
* /ffp/start/sshd.sh inactive
* /ffp/start/rsyncd.sh inactive
* /ffp/start/mount-external.sh ...
+ insmod /mnt/HD_a2/lnx_bin/usb-storage.ko
+ sleep 15
+ mkdir /mnt/USB_1
+ sleep 5
+ mkdir /mnt/USB_2
+ sleep 5
+ mkdir /mnt/USB_3
+ sleep 5
+ mkdir /mnt/USB_4
+ sleep 10
+ cp /mnt/HD_a2/External_Mount_Files/fstab /etc/fstab
+ sleep 10
+ grep DD02-5647
+ sed s/:.*//g
+ blkid
+ mount -t vfat -o umask=0000 /dev/sde1 /mnt/USB_1
+ sleep 10
+ blkid
+ grep DA69-2D76
+ sed s/:.*//g
+ mount -t vfat -o umask=0000 /dev/sdc1 /mnt/USB_2
+ sleep 10
+ blkid
+ grep 46FD-4D52
+ sed s/:.*//g
+ mount -t vfat -o umask=0000 /dev/sdd1 /mnt/USB_3
+ sleep 10
+ blkid
+ grep 8043-15A7
+ sed s/:.*//g
+ mount -t vfat -o umask=0000 /dev/sdf1 /mnt/USB_4
+ sleep 10
+ /usr/bin/smb stop
$Shutting down SMB services:
$Shutting down NMB services:
+ sleep 10
+ cp /mnt/HD_a2/External_Mount_Files/smb.conf /etc/samba/smb.conf
+ sleep 10
+ /usr/bin/smb start
$Starting SMB services:
$Starting NMB services:
* /ffp/start/mediatomb.sh inactive
* /ffp/start/kickwebs.sh inactive
* /ffp/start/lighttpd.sh inactive
* /ffp/start/inetd.sh inactive
* OK
Offline
OK, now I know it can work I'm playing around with options (I should leave it alone to be sure it continues working).
Tried modified fstab (with UUIDs) followed by mount -a <- does not work
As you suggested tried stripped down .sh start file with just the grep lines and the samba tweak and it works perfectly, as you said fstab is redundant.
I've stripped out some of the sleeps and this seems to work:
#!/bin/sh
set -x
insmod /mnt/HD_a2/lnx_bin/usb-storage.ko
sleep 15
mkdir /mnt/USB_1
mkdir /mnt/USB_2
mkdir /mnt/USB_3
mkdir /mnt/USB_4
mount -t vfat -o umask=0000 $(blkid | grep DD02-5647 | sed 's/:.*//g') /mnt/USB_1
mount -t vfat -o umask=0000 $(blkid | grep DA69-2D76 | sed 's/:.*//g') /mnt/USB_2
mount -t vfat -o umask=0000 $(blkid | grep 46FD-4D52 | sed 's/:.*//g') /mnt/USB_3
mount -t vfat -o umask=0000 $(blkid | grep 8043-15A7 | sed 's/:.*//g') /mnt/USB_4
sleep 5
/usr/bin/smb stop
sleep 10
cp /mnt/HD_a2/External_Mount_Files/smb.conf /etc/samba/smb.conf
sleep 10
/usr/bin/smb start
I'll leave it now and see if it continues working, if so I'll post the final scripts.
The only thing I'm worried about is that if I understand grep correctly it searches for the UUID then mounts using the location it finds it at. I believe the original issue arose because the hub occasionally lost the connection and when it reconnected it could not use the original points sdc1, sdd1, sde1 and sdf1 (because they were reserved? how, I'm not sure) so that when I rechecked the mounts they appeared as sdg1 etc. and were not connected to the folders usb_1 etc.
I'll see how this holds now. Funny that the system seems to be able to find the devices from the UUID with your grep statments but I can't seem to directly issue mount commands using UUID instead of location. I went with fstab UUID lines originally to try to fix the devices to folders so it would not matter if the mount point changed.
Offline
According to this doc http://linux.die.net/man/8/mount the -U switch specifies mount via UUID. This works easy as a feasy on my ubuntu laptop. On the 323 it does not. 323 does not understand the syntax.
Last edited by bjby (2010-12-28 23:35:24)
Offline
Yes, I had a go at mount -U when I was trying to directly mount using UUID but I just got back a short list of options:
mount: invalid option -- U
BusyBox v1.12.1 (2008-09-29 20:38:04 CEST) multi-call binary
Usage: mount [flags] DEVICE NODE [-o options,more-options]
Mount a filesystem. Filesystem autodetection requires /proc be mounted.
Options:
-a Mount all filesystems in fstab
-f don't mount
-r Read-only mount
-t fs-type Filesystem type
-w Read-write mount (default)
-o option:
loop Ignored (loop devices are autodetected)
[a]sync Writes are asynchronous / synchronous
[no]atime Disable / enable updates to inode access times
[no]diratime Disable / enable atime updates to directories
[no]relatime Disable / enable atime updates relative to modification time
[no]dev Allow use of special device files / disallow them
[no]exec Allow use of executable files / disallow them
[no]suid Allow set-user-id-root programs / disallow them
[r]shared Convert [recursively] to a shared subtree
[r]slave Convert [recursively] to a slave subtree
[r]private Convert [recursively] to a private subtree
[un]bindable Make mount point [un]able to be bind mounted
bind Bind a directory to an additional location
move Relocate an existing mount point
remount Remount a mounted filesystem, changing its flags
ro/rw Mount for read-only / read-write
There are EVEN MORE flags that are specific to each filesystem
You'll have to see the written documentation for those filesystems
If this is it for the DNS323 it seems mount label is also not an option.
So far so good on the mounts using your grep sed approach, fingers crossed.
I'm just supprised that the log returned the below when using your script to mount, I've read up on grep and sed but I don't fully understand them, especially the syntax used with sed. I gather from the below that grep the UUID did get a hit and the result was used in sed (to strip out the UUID portion and return a useable location based mount command?)and it worked which (if I'm reading this right) suggests the DNS is not averse to using a UUID which makes it odd that it would recognise it but then not be able to use it for one of its more useful purposes, mounting a device! Of course the grep may just be looking for text and it is not a reflection of how the DND323 feels about UUID!
Even if it is an older version of linux I would have thought there was some useable device ID or label (or some unique identifier) based means of mounting, I mean how did our primitive ancestors (I'm obviously a throwback) get by without one?
+ grep DD02-5647
+ sed s/:.*//g
+ blkid
+ mount -t vfat -o umask=0000 /dev/sde1 /mnt/USB_1
Offline
Looking arround for mount info. I found:
http://linux.die.net/man/8/mount
Specifically:
-L label
Mount the partition that has the specified label.
-U uuid
Mount the partition that has the specified uuid. These two options require the file /proc/partitions (present since Linux 2.1.116) to exist.
From the wiki start page:
Kernel Linux-2.6.6 Linux-2.6.12.6
It sounds like it should support these mount commands (although if it does not support -U seems clear it won't support -L either). Could it be the version on the DNS has been stripped down by D-Link a bit? That said compared to a Thecus N299 I have the DNS is a pleasure to use, so moddable. The N299 does not support spindown and no one has been able to get in to make it (needless to say the DNS is in constant use and the N299 is in storage).
Interestingly entering
cp /proc/partitions /mnt/HD_a2/partitions
did return a file which suggests -U or -L should work
partitions contained:
major minor #blocks name
7 0 5712 loop0
31 0 64 mtdblock0
31 1 64 mtdblock1
31 2 1536 mtdblock2
31 3 6336 mtdblock3
31 4 192 mtdblock4
8 0 976762584 sda
8 1 530113 sda1
8 2 975715807 sda2
8 4 514080 sda4
8 16 488386584 sdb
8 17 530113 sdb1
8 18 487339807 sdb2
8 20 514080 sdb4
8 32 7913472 sdc
8 33 7910484 sdc1
8 48 7913472 sdd
8 49 7910484 sdd1
8 64 7913472 sde
8 65 7910484 sde1
8 80 7913472 sdf
8 81 7910484 sdf1
I wonder is this the file that was reserving locations c to f before when I was getting the lost mounts (still working at this point using grep sed approach)
Offline
I found a similiar thread. https://forum.openwrt.org/viewtopic.php?id=13856
According to it, it may be possible to rebuild busybox to support this.
If you feel you want to kill some time fiddling with you little box then this may be the thing for you.
Here is a tutorial for howto build.
http://nas-tweaks.net/106/compiling-sof … -fun_plug/
Offline
Hi bjby,
Looks like I'll have to, after leaving it alone overnight:
/ # mount
rootfs on / type rootfs (rw)
/dev/root on / type ext2 (rw)
proc on /proc type proc (rw,nodiratime)
/dev/loop0 on /sys/crfs type squashfs (ro)
/dev/sda2 on /mnt/HD_a2 type ext2 (rw)
/dev/sdb2 on /mnt/HD_b2 type ext2 (rw)
/dev/sda4 on /mnt/HD_a4 type ext2 (rw)
/dev/sdb4 on /mnt/HD_b4 type ext2 (rw)
none on /proc/bus/usb type usbfs (rw)
devpts on /dev/pts type devpts (rw)
/dev/sdd1 on /mnt/USB_1 type vfat (rw,nodiratime,fmask=0000,dmask=0000,codepage=cp850,iocharset=iso8859-1)
/dev/sdc1 on /mnt/USB_2 type vfat (rw,nodiratime,fmask=0000,dmask=0000,codepage=cp850,iocharset=iso8859-1)
/dev/sde1 on /mnt/USB_3 type vfat (rw,nodiratime,fmask=0000,dmask=0000,codepage=cp850,iocharset=iso8859-1)
/dev/sdf1 on /mnt/USB_4 type vfat (rw,nodiratime,fmask=0000,dmask=0000,codepage=cp850,iocharset=iso8859-1)
/ # blkid
/dev/loop0: TYPE="squashfs"
/dev/mtdblock0: TYPE="minix"
/dev/mtdblock1: TYPE="minix"
/dev/sda1: TYPE="swap"
/dev/sda2: UUID="45d79d20-1908-446d-9114-ed99fd55f32a" TYPE="ext2"
/dev/sda4: UUID="0a2493cd-ee1f-4657-aa3b-34156a6dbcbc" TYPE="ext2"
/dev/sdb1: TYPE="swap"
/dev/sdb2: UUID="34ac19af-0f95-4bf8-a9ad-31725d4b3fee" TYPE="ext2"
/dev/sdb4: UUID="238ba5d9-2c6a-42d5-ad20-5139bcbe0870" TYPE="ext2"
/dev/sdg1: LABEL="TRANSCEND" UUID="DA69-2D76" TYPE="vfat"
/dev/sdh1: LABEL="Transcend" UUID="DD02-5647" TYPE="vfat"
/dev/sdi1: LABEL="Transcend" UUID="46FD-4D52" TYPE="vfat"
/dev/sdj1: LABEL="Transcend" UUID="8043-15A7" TYPE="vfat"
As you can see the hub has lost the mounts and tried to reconnect only to be forced to use sdg1, sdh1 etc. while the folders are still linked to sdc1 etc. which are gone now.
The only other option I can think of other than using UUID is to identify how the DNS is reserving the initial 4 positions and making them available if the hub tries to reconnect.
Phisically a powered hub might also prevent the loss of connection which I think causes this but while it might work it I'd rather create the option of mounting devices instead of locations, seems a more robust approach.
Thanks for your help, I'll look into the busybox thread you found it does seem to be the core of the issue.
Incidentally I found a handy command to return the version of linux the DNS uses: 'uname -r' in a thread on how to move ffp to a usb stick http://bfg100k.blogspot.com/2008/06/mov … stick.html
Offline
Kind of understand your problem. I dont think UUID mount will solve it. I think disconnected is disconnected nomatter (but I may be wrong). I think your best options are.
Get a powered hub see if problem resolvs
and or
Put some sort of watchdog script on 323 which detects the usb disconnects and in such case does unmount followed by mount.
Offline
OK had a look at options involving tweaked busybox, I think I've reached the limit if what I can do with what I know or can figure out!
That leaves:
Hardware fix (possibly):
1 Powered hub
2 Single large usb stick (no hub no problem possibly
3 hardware mod, one of the wiki mods involves attaching an extra usb port via an unused soldered cnnection on the DNS board
I think I'll try using one stick (8 gig) I have and se how it persists, if i works then I might try 3 or possibly just go the simplest option 2. I don't like 1 not just because it involves buying another hub but because it involves plugging in another power supply to my already extensive list of devices using more power 24-7 365.
Software fixes:
Other avenues of solution
1 prevent the DNS 323 reserving sdc1, sdd1, sde1 and sdf1 (don't know if this is possible)
2 add a script to correct the issue when it occurs as you suggest
3 avoid the full compile nightmare that is make busybox support UUID (I still think if the system could reserve by UUID rather than sdc1 etc. it would fix the problem) and possibly add modified busybox files that could be called from a specific loaction when needed (here I am speculation, I don't know if this is possible).
If 2 were an option I have been lucky enough to just get a dmesg output which I think shows the specific point at which it all goes wrong:
Is it here that transfers stop working?
sdj1
Attached scsi removable disk sdj at scsi11, channel 0, id 0, lun 0
Attached scsi generic sg5 at scsi11, channel 0, id 0, lun 0, type 0
dmesg output:
usb-storage: usb_stor_bulk_transfer_buf: xfer 31 bytes
usb-storage: Status code 0; transferred 31/31
usb-storage: -- transfer complete
usb-storage: Bulk command transfer result=0
usb-storage: usb_stor_bulk_transfer_buf: xfer 8 bytes
usb-storage: Status code 0; transferred 8/8
usb-storage: -- transfer complete
usb-storage: Bulk data transfer result 0x0
usb-storage: Attempting to get CSW...
usb-storage: usb_stor_bulk_transfer_buf: xfer 13 bytes
usb-storage: Status code 0; transferred 13/13
usb-storage: -- transfer complete
usb-storage: Bulk status result = 0
usb-storage: Bulk Status S 0x53425355 T 0x3 R 0 Stat 0x0
usb-storage: scsi cmd done, result=0x0
usb-storage: *** thread sleeping.
SCSI device sdj: 15826944 512-byte hdwr sectors (8103 MB)
usb-storage: queuecommand called
usb-storage: *** thread awakened.
usb-storage: Command MODE_SENSE (6 bytes)
usb-storage: 1a 00 3f 00 c0 00
usb-storage: Bulk Command S 0x43425355 T 0x4 L 192 F 128 Trg 0 LUN 0 CL 6
usb-storage: usb_stor_bulk_transfer_buf: xfer 31 bytes
usb-storage: Status code 0; transferred 31/31
usb-storage: -- transfer complete
usb-storage: Bulk command transfer result=0
usb-storage: usb_stor_bulk_transfer_buf: xfer 192 bytes
usb-storage: Status code 0; transferred 68/192
usb-storage: -- short transfer
usb-storage: Bulk data transfer result 0x1
usb-storage: Attempting to get CSW...
usb-storage: usb_stor_bulk_transfer_buf: xfer 13 bytes
usb-storage: Status code 0; transferred 13/13
usb-storage: -- transfer complete
usb-storage: Bulk status result = 0
usb-storage: Bulk Status S 0x53425355 T 0x4 R 0 Stat 0x0
usb-storage: scsi cmd done, result=0x0
usb-storage: *** thread sleeping.
sdj: Write Protect is off
sdj: Mode Sense: 43 00 00 00
sdj: assuming drive cache: write through
usb-storage: queuecommand called
usb-storage: *** thread awakened.
usb-storage: Command TEST_UNIT_READY (6 bytes)
usb-storage: 00 00 00 00 00 00
usb-storage: Bulk Command S 0x43425355 T 0x5 L 0 F 0 Trg 0 LUN 0 CL 6
usb-storage: usb_stor_bulk_transfer_buf: xfer 31 bytes
usb-storage: Status code 0; transferred 31/31
usb-storage: -- transfer complete
usb-storage: Bulk command transfer result=0
usb-storage: Attempting to get CSW...
usb-storage: usb_stor_bulk_transfer_buf: xfer 13 bytes
usb-storage: Status code 0; transferred 13/13
usb-storage: -- transfer complete
usb-storage: Bulk status result = 0
usb-storage: Bulk Status S 0x53425355 T 0x5 R 0 Stat 0x0
usb-storage: scsi cmd done, result=0x0
usb-storage: *** thread sleeping.
usb-storage: queuecommand called
usb-storage: *** thread awakened.
usb-storage: Command ALLOW_MEDIUM_REMOVAL (6 bytes)
usb-storage: 1e 00 00 00 01 00
usb-storage: Bulk Command S 0x43425355 T 0x6 L 0 F 0 Trg 0 LUN 0 CL 6
usb-storage: usb_stor_bulk_transfer_buf: xfer 31 bytes
usb-storage: Status code 0; transferred 31/31
usb-storage: -- transfer complete
usb-storage: Bulk command transfer result=0
usb-storage: Attempting to get CSW...
usb-storage: usb_stor_bulk_transfer_buf: xfer 13 bytes
usb-storage: Status code 0; transferred 13/13
usb-storage: -- transfer complete
usb-storage: Bulk status result = 0
usb-storage: Bulk Status S 0x53425355 T 0x6 R 0 Stat 0x1
usb-storage: -- transport indicates command failure
usb-storage: Issuing auto-REQUEST_SENSE
usb-storage: Bulk Command S 0x43425355 T 0x80000006 L 18 F 128 Trg 0 LUN 0 CL 6
usb-storage: usb_stor_bulk_transfer_buf: xfer 31 bytes
usb-storage: Status code 0; transferred 31/31
usb-storage: -- transfer complete
usb-storage: Bulk command transfer result=0
usb-storage: usb_stor_bulk_transfer_buf: xfer 18 bytes
usb-storage: Status code 0; transferred 18/18
usb-storage: -- transfer complete
usb-storage: Bulk data transfer result 0x0
usb-storage: Attempting to get CSW...
usb-storage: usb_stor_bulk_transfer_buf: xfer 13 bytes
usb-storage: Status code 0; transferred 13/13
usb-storage: -- transfer complete
usb-storage: Bulk status result = 0
usb-storage: Bulk Status S 0x53425355 T 0x80000006 R 0 Stat 0x0
usb-storage: -- Result from auto-sense is 0
usb-storage: -- code: 0x70, key: 0x5, ASC: 0x24, ASCQ: 0x0
usb-storage: (Unknown Key): (unknown ASC/ASCQ)
usb-storage: scsi cmd done, result=0x2
usb-storage: *** thread sleeping.
usb-storage: queuecommand called
usb-storage: *** thread awakened.
usb-storage: Command TEST_UNIT_READY (6 bytes)
usb-storage: 00 00 00 00 00 00
usb-storage: Bulk Command S 0x43425355 T 0x7 L 0 F 0 Trg 0 LUN 0 CL 6
usb-storage: usb_stor_bulk_transfer_buf: xfer 31 bytes
usb-storage: Status code 0; transferred 31/31
usb-storage: -- transfer complete
usb-storage: Bulk command transfer result=0
usb-storage: Attempting to get CSW...
usb-storage: usb_stor_bulk_transfer_buf: xfer 13 bytes
usb-storage: Status code 0; transferred 13/13
usb-storage: -- transfer complete
usb-storage: Bulk status result = 0
usb-storage: Bulk Status S 0x53425355 T 0x7 R 0 Stat 0x0
usb-storage: scsi cmd done, result=0x0
usb-storage: *** thread sleeping.
usb-storage: queuecommand called
usb-storage: *** thread awakened.
usb-storage: Command READ_CAPACITY (10 bytes)
usb-storage: 25 00 00 00 00 00 00 00 00 00
usb-storage: Bulk Command S 0x43425355 T 0x8 L 8 F 128 Trg 0 LUN 0 CL 10
usb-storage: usb_stor_bulk_transfer_buf: xfer 31 bytes
usb-storage: Status code 0; transferred 31/31
usb-storage: -- transfer complete
usb-storage: Bulk command transfer result=0
usb-storage: usb_stor_bulk_transfer_buf: xfer 8 bytes
usb-storage: Status code 0; transferred 8/8
usb-storage: -- transfer complete
usb-storage: Bulk data transfer result 0x0
usb-storage: Attempting to get CSW...
usb-storage: usb_stor_bulk_transfer_buf: xfer 13 bytes
usb-storage: Status code 0; transferred 13/13
usb-storage: -- transfer complete
usb-storage: Bulk status result = 0
usb-storage: Bulk Status S 0x53425355 T 0x8 R 0 Stat 0x0
usb-storage: scsi cmd done, result=0x0
usb-storage: *** thread sleeping.
SCSI device sdj: 15826944 512-byte hdwr sectors (8103 MB)
usb-storage: queuecommand called
usb-storage: *** thread awakened.
usb-storage: Command MODE_SENSE (6 bytes)
usb-storage: 1a 00 3f 00 c0 00
usb-storage: Bulk Command S 0x43425355 T 0x9 L 192 F 128 Trg 0 LUN 0 CL 6
usb-storage: usb_stor_bulk_transfer_buf: xfer 31 bytes
usb-storage: Status code 0; transferred 31/31
usb-storage: -- transfer complete
usb-storage: Bulk command transfer result=0
usb-storage: usb_stor_bulk_transfer_buf: xfer 192 bytes
usb-storage: Status code 0; transferred 68/192
usb-storage: -- short transfer
usb-storage: Bulk data transfer result 0x1
usb-storage: Attempting to get CSW...
usb-storage: usb_stor_bulk_transfer_buf: xfer 13 bytes
usb-storage: Status code 0; transferred 13/13
usb-storage: -- transfer complete
usb-storage: Bulk status result = 0
usb-storage: Bulk Status S 0x53425355 T 0x9 R 0 Stat 0x0
usb-storage: scsi cmd done, result=0x0
usb-storage: *** thread sleeping.
sdj: Write Protect is off
sdj: Mode Sense: 43 00 00 00
sdj: assuming drive cache: write through
sdj:<7>usb-storage: queuecommand called
usb-storage: *** thread awakened.
usb-storage: Command READ_10 (10 bytes)
usb-storage: 28 00 00 00 00 00 00 00 08 00
usb-storage: Bulk Command S 0x43425355 T 0xa L 4096 F 128 Trg 0 LUN 0 CL 10
usb-storage: usb_stor_bulk_transfer_buf: xfer 31 bytes
usb-storage: Status code 0; transferred 31/31
usb-storage: -- transfer complete
usb-storage: Bulk command transfer result=0
usb-storage: usb_stor_bulk_transfer_sglist: xfer 4096 bytes, 1 entries
usb-storage: Status code 0; transferred 4096/4096
usb-storage: -- transfer complete
usb-storage: Bulk data transfer result 0x0
usb-storage: Attempting to get CSW...
usb-storage: usb_stor_bulk_transfer_buf: xfer 13 bytes
usb-storage: Status code 0; transferred 13/13
usb-storage: -- transfer complete
usb-storage: Bulk status result = 0
usb-storage: Bulk Status S 0x53425355 T 0xa R 0 Stat 0x0
usb-storage: scsi cmd done, result=0x0
usb-storage: *** thread sleeping.
sdj1
Attached scsi removable disk sdj at scsi11, channel 0, id 0, lun 0
Attached scsi generic sg5 at scsi11, channel 0, id 0, lun 0, type 0
usb-storage: queuecommand called
usb-storage: *** thread awakened.
usb-storage: Bad LUN (0:1)
usb-storage: scsi cmd done, result=0x40000
usb-storage: *** thread sleeping.
usb-storage: queuecommand called
usb-storage: *** thread awakened.
usb-storage: Bad target number (1:0)
usb-storage: scsi cmd done, result=0x40000
usb-storage: *** thread sleeping.
usb-storage: queuecommand called
usb-storage: *** thread awakened.
usb-storage: Bad target number (2:0)
usb-storage: scsi cmd done, result=0x40000
usb-storage: *** thread sleeping.
usb-storage: queuecommand called
usb-storage: *** thread awakened.
usb-storage: Bad target number (3:0)
usb-storage: scsi cmd done, result=0x40000
usb-storage: *** thread sleeping.
usb-storage: queuecommand called
usb-storage: *** thread awakened.
usb-storage: Bad target number (4:0)
usb-storage: scsi cmd done, result=0x40000
usb-storage: *** thread sleeping.
usb-storage: queuecommand called
usb-storage: *** thread awakened.
usb-storage: Bad target number (5:0)
usb-storage: scsi cmd done, result=0x40000
usb-storage: *** thread sleeping.
usb-storage: queuecommand called
usb-storage: *** thread awakened.
usb-storage: Bad target number (6:0)
usb-storage: scsi cmd done, result=0x40000
usb-storage: *** thread sleeping.
usb-storage: queuecommand called
usb-storage: *** thread awakened.
usb-storage: Bad target number (7:0)
usb-storage: scsi cmd done, result=0x40000
usb-storage: *** thread sleeping.
usb-storage: device scan complete
Offline
well if you want to try building a watchdog. There are many ways. I would do something like this.
Put a file on root on usb 'yesiammounted.txt'.
Test if the file yesiammounted.txt is there.
If its not there then unmount the folder then mount it again
Try it manually first see that it works. When you are somewhat confident then create a cronjob which runs it every 5 minutes or so.
Offline
I think I'll try to work the hardware angle first, I'll mount one directly (no hub) and see how it goes, if this works then I might try adding a port with the hardware mod and try that. 1 stick = about 3 weeks storage typically (depends on activity in front of the cameras), 2 would provide 6 which would be more than enough for security purposes.
One thing to note, your grep sed mount remains very useful as before the sticks mounted randomly with different sticks appearing in different usb folders on each restart (not good for finding files for specific cameras) since using your script the sticks stay glued to the correct folder (when it stays mounted!).
I'd reccomend this approach for anyone trying a hub even without UUID being within reach of mere mortals. And I think If I was doing this cold I'd probably simply go for a larger capacity single stick or a powered hub. That said I have yet to prove either will work consistantly, watch this space.
I'll leave the hub overnight, I've added a different usb-storage.ko file that I think produces less log info. that might make it easier to see the problem from dmesg
Offline
Well, you do have a harddisk in you 323. I am assuming you avoid using it due to disk spinup.
Is this only a usb capacity problem? May I suggest you move your films, pictures or whatever it is, to your harddrive daily. Setup a cronjob for it. I think you can live with one diskspinup per day.
Offline