USB Storage = No USB disks connected

If your problem doesn't fall into one of the other categories, report it here.

Moderator: Moderators

Post Reply
doritos
Posts: 45
Joined: Mon May 02, 2011 2:02 pm

USB Storage = No USB disks connected

Post by doritos »

Hi,

I've a 1.5Tb Seagate disk connected to the USB port that is correctly recognized by stock firmware or dd-wrt, but not with Gargoyle

dmesg shows the following messages

Code: Select all

scsi 0:0:0:0: Direct-Access     ST315003 41AS                  PQ: 0 ANSI: 2 CCS
usb-storage: device scan complete
sd 0:0:0:0: [sda] 2930277168 512-byte logical blocks: (1.50 TB/1.36 TiB)
sd 0:0:0:0: [sda] Write Protect is off
sd 0:0:0:0: [sda] Mode Sense: 34 00 00 00
sd 0:0:0:0: [sda] Assuming drive cache: write through
sd 0:0:0:0: [sda] Assuming drive cache: write through
 sda: sda1 sda2 sda3 sda4
sd 0:0:0:0: [sda] Assuming drive cache: write through
sd 0:0:0:0: [sda] Attached SCSI disk
But the webif shows "No USB disks connected". Any idea?

doritos
Posts: 45
Joined: Mon May 02, 2011 2:02 pm

Re: USB Storage = No USB disks connected

Post by doritos »

This bug has already been reported on http://www.gargoyle-router.com/phpbb/vi ... f=6&t=1130 thread

doritos
Posts: 45
Joined: Mon May 02, 2011 2:02 pm

Re: USB Storage = No USB disks connected

Post by doritos »

I like to solve my own problems ;)

The problem happens when you have partitions in your harddrive/usb stick wich filesystem is not FAT/NTFS or ext. I my case, I have a swap partition and this causes the script to die abnormally (tries to calculate the size) and never removes the lock files.

My suggestion is to add a better handling for the type detection in /etc/init.d/usb_storage. What I did was:

Before:

Code: Select all

                if [ "$type" = "FAT32" ] || [ "$type" = "FAT16" ] ; then
                        mkdir -p "/tmp/usb_mount/$id"
                        chmod 777 "/tmp/usb_mount/$id"
                        umount "/tmp/usb_mount/$id" 2>/dev/null
                        err=$(mount -t vfat -o umask=0,dmask=0 "$d" "/tmp/usb_mount/$id")
                elif [ "$type" = "NTFS" ] ; then
                        mkdir -p "/tmp/usb_mount/$id"
                        chmod 777 "/tmp/usb_mount/$id"
                        umount "/tmp/usb_mount/$id" 2>/dev/null
                        err=$(ntfs-3g "$d" "/tmp/usb_mount/$id")
                elif  [ -n "$type" ] ; then
                        mkdir -p "/tmp/usb_mount/$id"
                        chmod 777 "/tmp/usb_mount/$id"
                        umount "/tmp/usb_mount/$id" 2>/dev/null
                        err="tmp"
                        ext_num=4
                        while [ -n "$err" ] && [ $ext_num -ge 2 ] ; do
                                type="ext$ext_num"
                                err=$(mount -t $type -o noatime "$d" "/tmp/usb_mount/$id" 2>&1)
                                ext_num=$(($ext_num-1))
                        done
                fi
After

Code: Select all

                if [ "$type" = "FAT32" ] || [ "$type" = "FAT16" ] ; then
                        mkdir -p "/tmp/usb_mount/$id"
                        chmod 777 "/tmp/usb_mount/$id"
                        umount "/tmp/usb_mount/$id" 2>/dev/null
                        err=$(mount -t vfat -o umask=0,dmask=0 "$d" "/tmp/usb_mount/$id")
                elif [ "$type" = "NTFS" ] ; then
                        mkdir -p "/tmp/usb_mount/$id"
                        chmod 777 "/tmp/usb_mount/$id"
                        umount "/tmp/usb_mount/$id" 2>/dev/null
                        err=$(ntfs-3g "$d" "/tmp/usb_mount/$id")
                elif  [ -n "$type" ] ; then
                        mkdir -p "/tmp/usb_mount/$id"
                        chmod 777 "/tmp/usb_mount/$id"
                        umount "/tmp/usb_mount/$id" 2>/dev/null
                        err="tmp"
                        ext_num=4
                        while [ -n "$err" ] && [ $ext_num -ge 2 ] ; do
                                type="ext$ext_num"
                                err=$(mount -t $type -o noatime "$d" "/tmp/usb_mount/$id" 2>&1)
                                ext_num=$(($ext_num-1))
                        done
                else
                        err="not mountable partition"
                fi
Note the else/err= assignment, this will cause the next if to not try to do any calculation with such useless partitions.

hope this helps someone

Eric
Site Admin
Posts: 1443
Joined: Sat Jun 14, 2008 1:14 pm

Re: USB Storage = No USB disks connected

Post by Eric »

I just added your fix, it will be included in the next release. Thanks!

Post Reply