PDA

Bekijk de volledige versie : Firmware to spin-down HDD?



scuby
07-01-2007, 00:38
After days of messing, i've finally got my WL-500gP doing pretty much what I want. However, the one remaining annoyance is that the USB hard drive won't spin down, and to remove it I need to login to the web interface just to say "eject"... which isn't particularly helpful.

So, i'm looking for a new firmware with that implemented. I'm currently using the standard Asus FW and happy enough with that - i need to keep the ability for it to operate as a router (share the WAN connection with several wifi devices), to share a printer, to share a hard drive, and for a wired network device to be on the network too. Other than that, i'll happily lose all the other features.

Are there any firmwares out there that can do that, and that are suitable for a linux-novice (i've played a teeny bit with Linux, and can get a friend to explain bits of it over the phone, but not experienced myself).

I have read around this and other forums about the problem, and it does seem to be possible, but I can't do anything with the standard firmware, and the most common Oleg one doesn't seem to include sharing the USB drive. Also, I only have a laptop so can't directly connect the drive to an IDE interface to change the HDPARAM settings.

Any suggestions very gratefully received! :)

David

Xander
07-01-2007, 18:20
Here's the possible solution:
1. Download http://oleg.wl500g.info/bin/scsi-stop - this binary is able to spin-down your disk immediately after execution.
2. Place it somewhere on your router (you should be able to reach it via PATH environment variable) and make it executable.
3. You can use the script I've written which works in background and spins down disk after some period of inactivity:
http://wl500g.info/showpost.php?p=47135&postcount=10
I use it this way (I named the script scsi-stop.sh):

./scsi-stop.sh /dev/scsi/host0/bus0/target0/lun0/disc &
It automatically writes some log messages to scsi-stop.log.
It works for me. You can change it as you wish.

scuby
07-01-2007, 18:45
Thanks a lot for that.

Is it possible to do that on the standard firmware, or will I need Oleg's (or similar) to do it? I'm a little apprehensive to put the Oleg firmware on as the documentation suggests it doesn't support the USB hard drives.

I noticed I couldn't telnet into the box with the standard firmware, how would I go about putting that file on it, and your script?

Cheers

David

Xander
07-01-2007, 19:37
Thanks a lot for that.

Is it possible to do that on the standard firmware, or will I need Oleg's (or similar) to do it? I'm a little apprehensive to put the Oleg firmware on as the documentation suggests it doesn't support the USB hard drives.

Well, this is definitely untrue.


I noticed I couldn't telnet into the box with the standard firmware, how would I go about putting that file on it, and your script?

Cheers

David
I don't know whether my solution can work with standard firmware. I really don't think so. I recommend you to replace it.
I didn't said that the most appropriate place for scsi-stop and scsi-stop.sh is in the router's flash so you should place it somewhere in /usr/local and then do:

flashfs save
flashfs commit
flashfs enable

I don't think that this feature is implemented in the Asus firmware.

SuperB
20-01-2007, 22:30
I am impressed that someone finally managed to find a way to spin down HDDs. I understand that Oleg was the hero (again).
Because I did not know of this solution at the time, I have bought an Western Digital MyBook Essential 250GB. This drive spins down by itself.

britnet
22-01-2007, 10:07
hi Xander,

great that you managed it!!!

I'm using your script and it works really nice.

Can you write a complete HOW-TO for the beginners?

Xander
22-01-2007, 15:04
hi Xander,

great that you managed it!!!

I'm using your script and it works really nice.

Can you write a complete HOW-TO for the beginners?

Well, Ok, I'll write it soon. I must tell everybody that this binary is not working with several hard drives. This was reported in the similar topic in the Russian forum.
Oleg said also that this tool is a part of scsi-idle package, so you can compile it yourself. Just grab sources here: http://lost-habit.com/scsi.html

greengreen
22-01-2007, 21:21
Hi,
is possible to use this for wl-500gx too?
But I will wait for tutorial to beginners ;)

greengreen
27-01-2007, 15:44
HI Xander
something new about the tutorial of spining-down disc?
Can you write here which kind of disc isn't suported?(My knowledges of Russia language are nothing :( )

THX very much

Xander
28-01-2007, 22:54
Tutorial. :)

If you want to spindown your external HDD, scsi-stop (http://oleg.wl500g.info/bin/scsi-stop) tool may help you. This tool is a part of scsi-idle (http://lost-habit.com/scsi.html) package. If you don't want to build the tool from sources, just use the first link to get a prebuilt binary provided by Oleg.

Since you want to spindown your disk it is not very sensible to place the binary on it. So the appropriate place is the router's flash.

Steps:
1.

cd /usr/local/sbin
wget http://oleg.wl500g.info/bin/scsi-stop
chmod a+x scsi-stop
2. Now you can test your disk for compatibility. Please, ensure your login shell is /bin/sh and you run scsi-stop in it. cat /etc/passwd will help you to find out.


/usr/local/sbin/scsi-stop /dev/scsi/host0/bus0/target0/lun0/disc
If your disk continues to spin then scsi-stop most likely doesn't support your ide->usb (or sata->usb) box. :(
Please, post your results and your hardware here. Let other people know whether it is supported or not. And please add the output of

cat /proc/scsi/usb-storage-0/0
and search for corresponding VendorID&ProductID in the output of

cat /proc/bus/usb/devices
3. If you were successful you maybe would want to use my script for automatic spindown:


#!/bin/sh
if /usr/bin/[ $# -ne 1 ]; then
/bin/echo 1>&2 "Usage: $0 <device>"
exit 1
fi

PERIOD=30
BOUNDARY=1200
SCSISTOP=/usr/local/sbin/scsi-stop
LOGFILE=/tmp/scsi-stop.log

searchstr="disk_io:"
devaddr="(`/bin/ls -l $1 | /usr/bin/awk '{print($5 int($6/16))}'`)"

str=`/bin/grep "$searchstr" /proc/stat | devaddr="$devaddr" /usr/bin/awk -v 'RS= |\n' -F : '{ if($1==ENVIRON["devaddr"]) print($2) }'`
cooltime=0
stopped=0

while /bin/true; do
/bin/sleep $PERIOD
newstr=`/bin/grep "$searchstr" /proc/stat | devaddr="$devaddr" /usr/bin/awk -v 'RS= |\n' -F : '{ if($1==ENVIRON["devaddr"]) print($2) }'`
if /usr/bin/[ "$newstr" = "$str" ]; then
cooltime=$(($cooltime + $PERIOD))
if /usr/bin/[ $cooltime -ge $BOUNDARY -a $stopped -eq 0 ]; then
$SCSISTOP $1
time=`/bin/date '+%b %e %H:%M:%S'`
/bin/echo "$time: Cooled down..." >> $LOGFILE
stopped=1
fi
else
if /usr/bin/[ $cooltime -ne 0 ]; then
time=`/bin/date '+%b %e %H:%M:%S'`
/bin/echo "$time: Disk first used after $cooltime seconds" >> $LOGFILE
fi
cooltime=0
str=$newstr
stopped=0
fi
done

You can change "period" and "boundary" variables. They are in seconds. With the current settings script will wake up every 30 seconds to gather information and after 20 minutes of inactivity it will stop disk.
Do:


cd /usr/local/sbin
cat > scsi-stop.sh
<copy and paste the script>
<press Ctrl-C>
chmod a+x scsi-stop.sh

To run script in background do, for example:

./scsi-stop.sh /dev/scsi/host0/bus0/target0/lun0/disc &
Notice that the script writes some log messages to /tmp/scsi-stop.log .

4. Don't forget to do


flashfs save
flashfs commit
flashfs enable
to save all the things in the router's flash.

The most important: Hardware Compatibility List.
Working:

1.
HDD: Samsung SP2504C (sata)
Box: Vantec NexStar3 NST-360SU-BK
Bridge vendor: Sunplus Technology Inc.
cat /proc/scsi/usb-storage-0/0:

Host scsi0: usb-storage
Vendor: Sunplus Technology Inc.
Product: USB to Serial-ATA bridge
Serial Number: SAMSUNG SPS09QJ1NL805434
Protocol: Transparent SCSI
Transport: Bulk
GUID: 04fc0c15317ffffffffffff9
Attached: Yes
From /proc/bus/usb/devices: Vendor=04fc ProdID=0c15 Rev=c6.83

Not working:

1.
HDD: Seagate Barracuda 7200.9 (ide)
Bridge vendor: Cypress Semiconductor
Bridge chip: CY7C68300A-56PVC

2.
Bridge vendor: Cypress Semiconductor
cat /proc/scsi/usb-storage-0/0:

Host scsi0: usb-storage
Vendor: Cypress Semiconductor
Product: USB2.0 Storage Device
Serial Number: DEF10C9308EE
Protocol: Transparent SCSI
Transport: Bulk
GUID: 04b468300000def10c9308ee
Attached: Yes

3.
HDD: WD1600SD
Box: Vizo Luxon
Bridge vendor: JMicron
cat /proc/scsi/usb-storage-0/0:

Host scsi0: usb-storage
Vendor: JMicron
Product: JM20338 SATA, USB Combo
Serial Number: 8D88CA892915
Protocol: Transparent SCSI
Transport: Bulk
GUID: 152d233800008d88ca892915

4.
HDD: WD400VE
Box: Sarotech Cutie OTG FHD-254UM
cat /proc/scsi/usb-storage-0/0:

Host scsi3: usb-storage
Vendor: Unknown
Product: USB 2.0 Storage Device
Serial Number: 00000000000123456789
Protocol: Transparent SCSI
Transport: Bulk
GUID: 040256370000000123456789
I think this box has actually this chip:
Vendor: ALi Corp.
Product: M5637 IDE Controller

Update:
I tried to summarize all the gathered information in this post:
http://wl500g.info/showpost.php?p=52360&postcount=20
I'll keep it up to date.

DawMatt
29-01-2007, 10:14
Hi All,

Xander, thanks for the great tutorial! Worked perfectly. My results:

Working
HDD: Seagate 320Gb IDE
Box: Ritmo CE-3515 (generic 3.5in IDE enclosure, @ $25 AUD)

cat /proc/scsi/usb-storage-0/0

Host scsi0: usb-storage
Vendor: Prolific Technology Inc.
Product: Mass Storage Device
Serial Number: 0
Protocol: Transparent SCSI
Transport: Bulk
GUID: 067b25070000000000000000
Attached: Yes
From cat /proc/bus/usb/devices : Vendor=067b ProdID=2507 Rev= 1.00

I was actually surprised that such a cheap/generic HDD box would support HDD idling!

Thanks,
Matt

mistraller
06-02-2007, 21:45
As stated; my box doesn't work.
Inside a Hitachi Travelstar, which might be spindown by itself, according to another topic...

Box: 2,5 inch, Sweex
Host scsi2: usb-storage
Vendor: Unknown
Product: Cypress AT2LP RC7
Serial Number: DEF10BBF4198
Protocol: Transparent SCSI
Transport: Bulk
GUID: 04b468300000def10bbf4198
Attached: Yes

My 3,5 inch box doesn't work either:

Host scsi1: usb-storage
Vendor: Genesyslogic
Product: USB Mass Storage Device
Serial Number: 001300014118
Protocol: Transparent SCSI
Transport: Bulk
GUID: 05e307020000001300014118
Attached: Yes

greengreen
11-02-2007, 13:23
NOT WORKING

HDD: Seagate momentus 5400.3 80Gb IDE 2.5"
Box: welland 2.5" ME-940 USB

cat /proc/scsi/usb-storage-1/1
Code:
Host scsi1: usb-storage
Vendor: Myson Century, Inc.
Product: USB Mass Storage Device
Serial Number: 100
Protocol: 8070i
Transport: Bulk
GUID: 04cf88180000000000000100
Attached: Yes



Thanks,
greengreen

cyrax
12-02-2007, 17:58
Not working:



HDD:
Vendor: WDC WD13
Model: 6AA
Rev: 05.0

BOX:
Vendor=04cf ProdID=8818 Rev=b0.08

Host scsi0: usb-storage
Vendor: Myson Century, Inc.
Product: USB Mass Storage Device
Serial Number: 100
Protocol: 8070i
Transport: Bulk
GUID: 04cf88180000000000000100
Attached: Yes

REO
12-02-2007, 19:28
WORKING


HDD:
Vendor: SAMSUNG
Model: SP2014N
Rev: VC10

BOX: ICY BOX IB-350U
Vendor=0000 ProdID=0000 Rev=0.00

Host scsi0: usb-storage
Vendor: Unknown
Product: Unknown
Serial Number: 11D2
Protocol: Transparent SCSI
Transport: Bulk
GUID: 0000000000000000000011d2
Attached: Yes

Marius
27-02-2007, 18:37
NOT WORKING :mad:

Hardware: TrekStor DataStation maxi t.u 400Gb

cat /proc/scsi/usb-storage-0/0:

Host scsi0: usb-storage
Vendor:
Product:
Serial Number: D
Protocol: Transparent SCSI
Transport: Bulk
GUID: 04b46830000000000000000d
Attached: Yes


Greetings...

Zigster
28-02-2007, 18:29
Host scsi0: usb-storage
Vendor: Western Digital
Product: External HDD
-
Protocol: Transparent SCSI
Transport: Bulk
-
Attached: Yes

Jekyll
17-03-2007, 12:25
Not working :(
HDD: WD800AAJS (S-ATA)
Bridge: Delock (http://www.delock.com/produkte/gruppen/Konverter/Converter_USB_20_to_SATA_SLASH_IDE_61510.html)

Host scsi0: usb-storage
Vendor: JMicron
Product: USB to ATA/ATAPI Bridge
Serial Number: 77A091038972
Protocol: Transparent SCSI
Transport: Bulk
GUID: 152d2338000077a091038972
Attached: Yes
Vendor=152d ProdID=2338 Rev= 1.00

Sheeft
11-04-2007, 17:49
Working:
HDD: WDC WD4000
BOX: ViPower VPA-35018 (SATA -> USB)


Host scsi0: usb-storage
Vendor: Sunplus Technology Inc.
Product: USB to Serial-ATA bridge
Serial Number: WDC WD4000 WD-WCANU1268282
Protocol: Transparent SCSI
Transport: Bulk
GUID: 04fc0c15fff60cb7e1268282
Attached: Yes

Xander
15-04-2007, 15:17
I think, it is obvious that spindown capability depends on the hdd box's chipset only. So, I'll try to summarize the facts gathered:


VID PID Vendor Product Working?
0402 5637 ALi Corp. M5637 IDE Controller no
04b4 6830 Cypress Semiconductor USB-2.0 IDE Adapter no
04cf 8818 Myson Century, Inc. Fast 3.5" External Storage no
04fc 0c15 Sunplus Technology Inc. SPIF215A USB-SATA bridge yes
04fc 0c25 Sunplus Technology Inc. USB-SATA bridge yes
05e3 0702 Genesys Logic, Inc. USB 2.0 IDE Adapter no
067b 2506 Prolific Tech. Inc. Mass Storage Device yes
067b 2507 Prolific Tech. Inc. Mass Storage Device yes
067b 3507 Prolific Tech. Inc. ATAPI-6 Bridge Controller yes
07ab fcc7 Freecom Freecom Mobile Drive yes
0930 0b02 Toshiba GigaStore yes
0bc2 0501 Seagate USB Mass Storage no
0c0b b159 Trekstor DataStation maxi m.u yes
0d49 3210 Maxtor Maxtor 3200 yes
0d49 7000 Maxtor OneTouch yes
1058 0704 Western Digital External HDD yes
1058 1010 Western Digital External HDD yes
152d 2338 JMicron JM20338 SATA, USB Combo no
1652 6600 Super Top USB 2.0 IDE DEVICE no

Well, try to know which chipset is in the box before buing it. This page (http://www.qbik.ch/usb/devices/) might help.

schufti
09-05-2007, 21:52
Hi,

regarding to USB enclosures with Cypress chipset, there might be a chance with following command:

/usr/local/sbin/scsi-start 0 --pc=2 /dev/scsi/host0/bus0/target0/lun0/disc

if someone has the knowledge how to program USB access, there is a special feature in the Cypress chips to pass-through ATA commands. Details are in the AT2LP rev C datasheet (http://download.cypress.com.edgesuite.net/design_resources/datasheets/contents/cy7c68300c_8.pdf) might be only a few lines of code for a pro....

also the chip has a register for setting autom. spindown value on ATA-initialisation, but I never got it to work....

schufti

Radiator
16-05-2007, 13:29
Works perfectly for me, thanks!
Freecom 160GB bus-powered HD

Vendor=07ab
ProdID=fcc7

Host scsi0: usb-storage
Vendor: Freecom
Product: Freecom Mobile Drive
Serial Number: 02FA0D7506B0
Protocol: Transparent SCSI
Transport: Bulk
GUID: 07abfcc7000002fa0d7506b0
Attached: Yes

tuigje
20-05-2007, 19:23
I did some experimenting:

using my pc (ubuntu feisty fawn), I was not able to spin down the harddisk with the scsi-tools either (just as under kamikaze on a wl-500gP).

the lsusb output of the external HD is:
ID 04b4:6830 Cypress Semiconductor Corp. USB-2.0 IDE Adapter

Using the sg3-utils of ubuntu (http://sg.torque.net/sg/sg3_utils.html)
i did manage to make the disk spin down (but it didn't spin up until
after a reset of the drive)

I'm now trying to make a package out of it, but haven't finished yet.

tuigje
26-05-2007, 13:02
I just made an package, but sadly, it doesnīt work.

on my (ubuntu 7.04) pc, it works as expected:

sg_start --stop --pc=2 /dev/sda

On my wl-500gP however, it doesnīt:

sg_start --stop --pc=2 /dev/discs/disc1/disc
start stop unit: pass through os error: Invalid argument
START STOP UNIT command failed

I used the exact same source for both the PC and the WL-500G, both are statically build versions, so thatīs not the difference.
On http://sg.torque.net/sg/sg3_utils.html it is noted that for kernel 2.4 the /dev/sg0 interface is required. It can be made with

mknod /dev/sg0 c 21 0
But I havenīt yet figured out how to enable the support in the kernel for /dev/sgX.
I can mount and read the disk, so scsi support itself is working fine.

Iīm running kamikaze with 2.4 kernel (for wifi support) Is there anyone interested in testing this for kernel 2.6 ?
Both the makefile and (compressed) .ipk file are attached.

Hero21382
26-05-2007, 13:39
not working




Host scsi0: usb-storage
Vendor: Unknown
Product: USB TO IDE
Serial Number: None
Protocol: Transparent SCSI
Transport: Bulk
GUID: 05e307020000000000000000
Attached: Yes

tuigje
26-05-2007, 14:45
so, it was actually quite easy.

Hereīs a small patch to kamikaze, which selects the generic
scsi driver as well.
The ipkg packge (for kamikaze 2.4) is included as well.

Use this patch to make the scsi-kmod module, then do a


mknod /dev/sg0 c 21 0
mknod /dev/sg1 c 21 1
insmod sg

to make the devices and load the driver. Using:


sg_start -s -p 2 /dev/sg1

you can now spin down a scsi device. The scsi-start utility still doesnīt
work for me though.

rj.2001
02-06-2007, 00:10
NOT working:

Host scsi1: usb-storage
Vendor: Seagate
Product: USB Mass Storage
Serial Number: CBA987717156
Protocol: Transparent SCSI
Transport: Bulk
GUID: 0bc205010000cba987717156
Attached: Yes

QMax
02-06-2007, 16:25
It works ! :D

Vendor=0d49 ProdID=3210 Rev=77.f8
Manufacturer=Maxtor Corporation
Product=Maxtor 3200



Host scsi1: usb-storage
Vendor: Maxtor Corporation
Product: Maxtor 3200
Serial Number: 604010147425
Protocol: Transparent SCSI
Transport: Bulk
GUID: 0d4932100000604010147425
Attached: Yes


Max

QMax
10-06-2007, 10:56
It works with this little USB Box too !

This is a "Fake" VAIO 2.5" IDE HDD to USB2 adapter, purchased on eBay, working with an Hitachi 2.5" 80Gb IDE Disk, powered directly from the Asus:


Vendor=067b ProdID=2507 Rev= 1.00
Manufacturer=Prolific Technology Inc.
Product=Mass Storage Device


Host scsi0: usb-storage
Vendor: Prolific Technology Inc.
Product: Mass Storage Device
Serial Number: 0
Protocol: Transparent SCSI
Transport: Bulk
GUID: 067b25070000000000000000
Attached: Yes


Max

jolcese
12-06-2007, 02:19
Guys,

After issuing the scsi-stop, I see that the HDD stops spinning but it starts again inmediately.
Does it means it's not working?

Thanks
Jose

[admin@router bin]$ cat /proc/scsi/usb-storage-0/0
Host scsi0: usb-storage
Vendor: Seagate
Product: FreeAgentDesktop
Serial Number: 9QG01V0D
Protocol: Transparent SCSI
Transport: Bulk
GUID: 0bc23000fffffff99b001f0d
Attached: Yes

britnet
13-06-2007, 09:11
Guys,
After issuing the scsi-stop, I see that the HDD stops spinning but it starts again inmediately.
Does it means it's not working?


Where is your Swap located? on the HDD?
The system often reads swap data.

For me the best solution was to read all program data and swap from an usb-stick and all the other data from the hdd.

wengi
13-06-2007, 09:54
@britnet:

swap and opt on an usb stick? How long is this active until now? Any problems with the flash memory producing errors? Is it USB v1 or v2? What about performance?

background: This were my first thoughts for the WL-HDD. But i didnt do it because of USB 1.1 and the limited rw cycles of flash chips.

wengi

SpaceJazz
30-06-2007, 18:17
Working

Host scsi0: usb-storage
Vendor: Toshiba
Product: GigaStore
Serial Number: 00063A0550013BFA0
Protocol: Transparent SCSI
Transport: Bulk
GUID: 09300b020063a0550013bfa0
Attached: Yes

maradamc
31-07-2007, 17:31
Tutorial. :)

3. If you were successful you maybe would want to use my script for automatic spindown:


PERIOD=30
BOUNDARY=1200
SCSISTOP=/usr/local/sbin/scsi-stop
LOGFILE=/tmp/scsi-stop.log


Do:


cd /usr/local/sbin
cat > scsi-stop.sh
<copy and paste the script>
<press Ctrl-C>
chmod a+x scsi-stop.sh

To run script in background do, for example:

./scsi-stop.sh /dev/scsi/host0/bus0/target0/lun0/disc &


:confused: I'm a little confused. I created the scsi-stop.sh script and executed the command.
./scsi-stop.sh /dev/scsi/host0/bus0/target0/lun0/disc &

Now, how do I ensure this works properly after rebooting? Should I place this line:

./scsi-stop.sh /dev/scsi/host0/bus0/target0/lun0/disc &
into my post-boot file?

And how do I spin the drive up again? Or does a user just have to try accessing a directory via SAMBA?

Thanks. :D

hkfriends
07-08-2007, 11:20
when SAMBA is running, the box can not spin down. :mad:

super101
22-08-2007, 08:07
Doesnt work :mad:

Vendor=1652 ProdID=6600 Rev= 2.01



Host scsi0: usb-storage
Vendor: Super Top
Product: USB 2.0 IDE DEVICE
Serial Number: ST KILLER
Protocol: Transparent SCSI
Transport: Bulk
GUID: 16526600fffffffffffffff9
Attached: Yes

bakablah
25-08-2007, 13:43
I have tried to put it into post-boot, but nasty things happened when i tried to do it, my router couldn't get an IP at all after i've inserted this line into post-boot.

./scsi-stop.sh /dev/scsi/host0/bus0/target0/lun0/disc &
My router was working perfectly before with samba and print sharing going on.

At the end, i had to use the recovery mode of the router to flash the firmware again. For I had completely lost the router, it's not getting an IP (I had IP reserved for it), not replying to ping, completely blocked out from me.

Now I had everything running again, but I am afraid to put that line into post-boot again. I fear I might brick the router if i do.

Would the router support usb hubs? I want to have a usb memory stick to act as a swap memory for the router so that the HDD can stay quiet at night time.
Right now I have a printer plugged in and a HDD, it would be nice if i can put a hub in and attach the USB memory stick as well.

Edit: I have put that line of code into post-boot after the first attempt (disaster), it didn't crash this time. So I must have done something really wrong back then.
This is what I put in that works

/usr/local/sbin/scsi-stop.sh /dev/scsi/host0/bus0/target0/lun0/disc &
To view how you can see if the process is running in the background, type

ps | grep scsi

faz_matt
07-09-2007, 03:35
Working
HDD: Seagate 80Gb IDE
Box: Welland ME-740 USB & Firewire

cat /proc/scsi/usb-storage-0/0


Host scsi0: usb-storage
Vendor: Prolific Technology Inc.
Product: ATAPI-6 Bridge Controller
Serial Number: 8F7
Protocol: Transparent SCSI
Transport: Bulk
GUID: 067b350700000000000008f7
Attached: Yes


From cat /proc/bus/usb/devices : Vendor=067b ProdID=3507 Rev= 0.01

cheadude
21-10-2007, 12:48
Working

Host scsi0: usb-storage
Vendor: Prolific Technology Inc.
Product: ATAPI-6 Bridge Controller
Protocol: Transparent SCSI
Transport: Bulk
Attached: Yes

tj_spark
01-11-2007, 15:00
Not working

Host scsi0: usb-storage
Vendor: ASSMANN Electronic GmbH
Product: Unknown
Serial Number: 20040523AA603
Protocol: Transparent SCSI
Transport: Bulk
GUID: 067b350700020040523aa603
Attached: Yes

Xander
01-11-2007, 15:49
Not working

Host scsi0: usb-storage
Vendor: ASSMANN Electronic GmbH
Product: Unknown
Serial Number: 20040523AA603
Protocol: Transparent SCSI
Transport: Bulk
GUID: 067b350700020040523aa603
Attached: Yes

This is strange, could you please post the VendorID and ProductID of your device. (lsusb or cat /proc/bus/usb/devices)
According to this (http://wl500g.info/showpost.php?p=52360&postcount=20) table your device should work if the GUID corresponds to the VID and PID.

strubbl
03-11-2007, 21:30
Okay, I just bought a 3,5''-Case which is not working (.. it was even already posted here: GUID: 05e307020000000000000000)

But unfortunately in the list here, there a no prices or type names. I would like a cheap one - so can one recommend sth?
this (http://www.pollin.de/shop/shop.php?cf=detail.php&pg=Nw==&a=MjE3ODcyOTk=) one would be really cheap - but which chipset in it?

julian23
11-11-2007, 00:33
NOT WORKING !

scsi-stop does not work for my usb to ide adapter !

Host scsi0: usb-storage
Vendor: Unknown
roduct: USB TO IDE
Serial Number: None
Protocol: Transparent SCSI
Transport: Bulk
GUID: 05e307020000000000000000
Attached: Yes

Serpent
19-11-2007, 12:46
Working:

Host scsi0: usb-storage
Vendor: Prolific Technology Inc.
Product: Mass Storage Device
Serial Number: 0
Protocol: Transparent SCSI
Transport: Bulk
GUID: 067b25060000000000000000
Attached: Yes

It's a cheap box (~15 Eur), Spire GigaPod VIII - SP105SL,
http://www.spirecoolers.com/main/product_detail.asp?ProdID=601#

rj.2001
21-11-2007, 23:59
It works ! :D

Vendor=0d49 ProdID=3210 Rev=77.f8
Manufacturer=Maxtor Corporation
Product=Maxtor 3200



Host scsi1: usb-storage
Vendor: Maxtor Corporation
Product: Maxtor 3200
Serial Number: 604010147425
Protocol: Transparent SCSI
Transport: Bulk
GUID: 0d4932100000604010147425
Attached: Yes


Max

Hello,

the Maxtor Personal Storage 3200 has an build in feature:
after 1 hour the disk is spinning down, with out any scripts!
Even when the drive isn't connected to the router or any other host system! :D

Ciao

nevrax
22-12-2007, 22:46
Firmware Version WHITE RUSSIAN (0.9)
Kernel Version Linux version 2.4.30 (nbd@ds10) (gcc version 3.4.4 (OpenWrt-1.0)) #1 Sat Feb 3 13:16:08 CET 2007
Current Date/Time Sat Dec 22 22:34:23 UTC 2007

# cat /proc/scsi/usb-storage-0/0
Host scsi0: usb-storage
Vendor: Sunplus Technology Inc.
Product: USB to Serial-ATA bridge
Serial Number: SAMSUNG HDS0MUJ1NPB00489
Protocol: Transparent SCSI
Transport: Bulk
GUID: 04fc0c15317ffffffffffff9
Attached: Yes

lordu
04-03-2008, 15:10
WORKING

SEAGATE 7200.10 320Gb SATAII with NEXT STAR3 ( vantec) Hdd encosure


Host scsi0: usb-storage
Vendor: Sunplus Technology Inc.
Product: USB to Serial-ATA bridge
Serial Number: ST3320620A 6QF3KP6H
Protocol: Transparent SCSI
Transport: Bulk
GUID: 04fc0c25fffffff97af35971
Attached: Yes
Port: 1
Bus: 01:03.2-1

Bohlendach
04-03-2008, 22:17
IT WORKS
The harddisk is a Western Digital
Type: WD Elements Portable 120 GB (WDE1MS1200)


Vendor: Western Digital
Product: External HDD
Serial Number: 575845373037373036313033
Protocol: Transparent SCSI
Transport: Bulk
GUID: 105810103037373036313033

Vendor=1058 ProdID=1010 Rev= 1.02
Manufacturer=Western Digital
Product=External HDD
SerialNumber=575845373037373036313033


For using the script on a ASUS RT-N16, please see: http://wl500g.info/showpost.php?p=203696&postcount=173

nthgr
22-04-2008, 21:36
so, it was actually quite easy.

Hereīs a small patch to kamikaze, which selects the generic
scsi driver as well.
The ipkg packge (for kamikaze 2.4) is included as well.

Use this patch to make the scsi-kmod module, then do a


mknod /dev/sg0 c 21 0
mknod /dev/sg1 c 21 1
insmod sg

to make the devices and load the driver. Using:


sg_start -s -p 2 /dev/sg1

you can now spin down a scsi device. The scsi-start utility still doesnīt
work for me though.

How can I install "scsi.patch"?
I tried to install "kmod-scsi-core_2.4.34-brcm-1_mipsel.ipk" in your "scsi.tgz" and then I got an error message: ...md5sum mismatch...!
How can I countinue? Thanks

tuigje
23-05-2008, 18:36
How can I install "scsi.patch"?
I tried to install "kmod-scsi-core_2.4.34-brcm-1_mipsel.ipk" in your "scsi.tgz" and then I got an error message: ...md5sum mismatch...!
How can I countinue? Thanks

MMm, I wouldn't know were ipkg gets the md5sum from. the md5sum
in the Makefile is correct, i just checked that.

Building from source should work. I'm now running a 2.6 kernel, that
already has proper scsi support, that might work
for you also (but 2.6 still no wireless AP-mode for the wl500g).

larmoe
27-05-2008, 14:20
Western Digital WDMEW2500


Host scsi0: usb-storage
Vendor: Western Digital
Product: External HDD
Serial Number: 5758453230384B5938363434
Protocol: Transparent SCSI
Transport: Bulk
GUID: 1058070430384b5938363434

Vendor=1058 ProdID=0704 Rev= 1.05
Manufacturer=Western Digital
Product=External HDD


Thanks for a great tutorial.

Larmoe

MortenVinding
25-06-2008, 13:29
Kamikaze brcm47xx kernel 2.6 on Asus WL-500gP

USB -> SATA adapter is a very cheap one, but based on Sunplus:


# cat /proc/scsi/usb-storage/0
Host scsi0: usb-storage
Vendor: Sunplus Technology Co.,Ltd.
Product: USB to Serial-ATA bridge
Serial Number: FDF724040F000000FFFF2CFAFFFA9D
Protocol: Transparent SCSI
Transport: Bulk
Quirks:


# cat /proc/bus/usb/devices
Vendor=04fc ProdID=0c25 Rev= 1.12
Manufacturer=Sunplus Technology Co.,Ltd.
Product=USB to Serial-ATA bridge


So from all I can read it should be working, but when I run scsi-stop I get:

# /scsi-stop /dev/sda
/dev/sda is not a SCSI block device
or a different program I found here: http://www.johnkerry.plus.com/scsi-spin.html which should be compiled for Kamikaze (no version mentioned) and kernel 2.6:

# scsi-spin -d -f /dev/sda
scsi-spin [warning]: device is mounted but --force is passed
scsi-spin: /dev/sda is not a disk or generic SCSI device.


Anybody have any ideea why it is not working?

The harddrive is a Hitachi 400GB SATA U150: HDS724040KLSA80

/Morten

gromit
02-07-2008, 20:48
The TrekStor maxi m.u Disk works fine :)

Vendor=0c0b ProdID=b159 Rev= 1.03

$ cat /proc/scsi/usb-storage-1/1
Host scsi1: usb-storage
Vendor: Trekstor
Product: DataStation maxi m.u
Protocol: Transparent SCSI
Transport: Bulk
Attached: Yes

I explicitely checked the 500GB and the 750GB version.

mateysz
06-07-2008, 23:10
I'm a total Linux newbie but still I managed to spin down my HDD with scsi-stop. I also put scsi-stop.sh script in my router according to instruction provided here. However two questions come to my mind.
Is this instruction full or do I have to do something more to get this script running every time I reboot my router?
I read here that it is impossible to spin-down HDD when Samba is running. Is it true? I am using my HDD as a media disk so everyone in the house can acces it. That is why I don't want to use the switch on the enclosure to power off/on my drive (it won't be accessible). I want it to be accessible all the time but to spin-down in periods of inactivity (e.g. when everone is at work, at night) to extend life of the disk and not to make noise in the night. I use Samba to share disk in Windows.
As I'm new to Asus's router and Linux any help will be apreciated.

Tamadite
09-07-2008, 21:15
I found the following deamon:

Spindown is a system daemon that spins down idle disks [...] uses sg_start to spin the disk down. It also works with usb disks and hotswappable disks because it doesn't watch the device name (hda, sdb, ...), but the device id. This means that it doesn't matter if the disk is swapped while the deamon is running.

More info: http://linux.softpedia.com/get/System/Hardware/Spindown-37597.shtml

Devil-Strike
07-09-2008, 10:33
usb storage case not working
hdd inside maxtor daimiond 8 20GB

cat /proc/scsi/usb-storage-0/0
Host scsi0: usb-storage
Vendor: Generic
Product: USB TO IDE Bridge
Serial Number: None
Protocol: Transparent SCSI
Transport: Bulk
GUID: 058f63900000000000000000
Attached: Yes

bk043241
26-09-2008, 20:46
Searching the internet on one of the bridges, I came across this site:
http://www.hdsentinel.com/usbharddisks.php
These might all be working bridges?!
Checking the list with the known good list here, I think it doesn't give any guarantee.

Owl
02-12-2008, 13:49
WORKING

HDD: WDC WD6400AAKS-22A7B0 640Gb
BOX: i-Stor (http://www.istor.ru) iS302

Host scsi0: usb-storage
Vendor: JMicron
Product: JM20336 SATA, USB Combo
Serial Number: DA4180005888
Protocol: Transparent SCSI
Transport: Bulk
GUID: 152d23360000da4180005888
Attached: Yes
Port: 1
Bus: 01:03.2-1

P: Vendor=152d ProdID=2336 Rev= 1.00
S: Manufacturer=JMicron
S: Product=JM20336 SATA, USB Combo
S: SerialNumber=DA4180005888

Merelin
08-01-2009, 13:00
Works well:

Asus WL-500W + Oleg's latest 1.9.2.7-10 firmware + scsi-idle package

HDD: WD Caviar Black 1TB
Box: Tsunami "S-3500" (SATA-USB)



Host scsi1: usb-storage
Vendor: Sunplus Technology Inc.
Product: USB to Serial-ATA bridge
Serial Number: WDC WD1001 WD-WMATV0145969
Protocol: Transparent SCSI
Transport: Bulk
GUID: 04fc0c15fff616bdf0145969
Attached: Yes
Port: 2
Bus: 01:03.2-2




Vendor=04fc ProdID=0c15 Rev=c6.83

valenteen
24-03-2009, 19:17
Not working


$ cat /proc/scsi/usb-storage-0/0
Host scsi0: usb-storage
Vendor: JMicron
Product: USB to ATA/ATAPI Bridge
Serial Number: 22229141C800
Protocol: Transparent SCSI
Transport: Bulk
GUID: 152d2338000022229141c800
Attached: Yes
Port: 1
Bus: 00:03.1-1




$ cat /proc/bus/usb/devices
...
P: Vendor=152d ProdID=2338 Rev= 1.00
S: Manufacturer=JMicron
...

AshDyk
13-05-2009, 22:16
I would really like to spin down my HDD when it is inactive for 20 minutes. When I try
/usr/local/sbin/scsi-stop /dev/scsi/host0/bus0/target0/lun
0/disc, I get this error:
/dev/scsi/host0/bus0/target0/lun0/disc is not a SCSI block device

Am I doing something wrong, or does it just not work with my HDD. If it doesn't work, are there any other options?

s1za
25-05-2009, 13:56
I'm using two 1tb discs in RAID1 (using mdadm) and mounted as md0


$ cat /proc/mdstat
Personalities : [linear] [raid0] [raid1] [raid5] [multipath]
read_ahead 1024 sectors
md0 : active raid1 scsi/host0/bus0/target0/lun0/part1[0] scsi/host1/bus0/target0/lun0/part1[1]
976759936 blocks [2/2] [UU]


if I use the scsi-stop script (one for each disc) the discs spindown correctly but when the discs are needed again only one disc resume, breaking the RAID sync. Is there a way to stop this from happen or another script to use raid md0?


scsi-stop.sh /dev/scsi/host0/bus0/target0/lun0/disc
scsi-stop.sh /dev/scsi/host1/bus0/target0/lun0/disc

the discs:


$ cat /proc/scsi/usb-storage-0/0
Host scsi0: usb-storage
Vendor: Iomega
Product: External HD
Serial Number: 9E057FFFFFFF
Protocol: Transparent SCSI
Transport: Bulk
GUID: 059b037000009e057fffffff
Attached: Yes
Port: 1.1
Bus: 01:03.2-1.1

Wintermute
15-10-2009, 20:50
Spin-down/-up Works well on Oleg (lly.dev r655)



Host scsi1: usb-storage
Vendor: Iomega
Product: Iomega Select HDD
Serial Number: 5E23FFFFFFFF
Protocol: Transparent SCSI
Transport: Bulk
GUID: 059b047a00005e23ffffffff
Attached: Yes
Port: 2.1



P: Vendor=059b ProdID=047a Rev= 0.00
S: Manufacturer=Iomega
S: Product=Iomega Select HDD

DCX2
03-11-2009, 03:02
Hi, I'm actually using teddy_bear's USB Tomato mod (http://www.linksysinfo.org/forums/showthread.php?t=60185) on a WL-520GU (stupid 4 MB flash...), and it includes scsi-stop and scsi-start, and I wanted to share my experience with getting it working.

I used a watt-meter to verify that the disk actually did spin down or up. My setup involves an external enclosure with the following stats.


Host scsi0: usb-storage
Vendor: JMicron
Product: JM20336 SATA, USB Combo
Serial Number: DA0150217888
Protocol: Transparent SCSI
Transport: Bulk
GUID: 152d23360000da0150217888
Attached: Yes
Port: 1
Bus: 00:03.1-1

Vendor=152d ProdID=2336

This is very similar to one that doesn't work (PID=2338). But I had to do something funny to get mine to work. If I call scsi-stop, the disk spins down, and when I go to access it, the disk becomes inaccessible. If I call scsi-stop and then scsi-start before accessing the disk, it behaves correctly, staying spun down until I go to access it.

There are other Tomato-specific requirements for scsi-stop and scsi-start. You need to put the script in /jffs, and you need the build with awk. Here's the final script with the other Tomato-specific changes.


#!/bin/sh
if /usr/bin/[ $# -ne 1 ]; then
/bin/echo 1>&2 "Usage: $0 <device>"
exit 1
fi

PERIOD=30
BOUNDARY=1200
SCSISTOP=scsi-stop
SCSISTART=scsi-start
LOGFILE=/tmp/scsi-stop.log

searchstr="disk_io:"
devaddr="(`/bin/ls -l $1 | /usr/bin/awk '{print($5 int($6/16))}'`)"

str=`/bin/grep "$searchstr" /proc/stat | devaddr="$devaddr" /usr/bin/awk -v 'RS= |\n' -F : '{ if($1==ENVIRON["devaddr"]) print($2) }'`
cooltime=0
stopped=0

while true; do
/bin/sleep $PERIOD
newstr=`/bin/grep "$searchstr" /proc/stat | devaddr="$devaddr" /usr/bin/awk -v 'RS= |\n' -F : '{ if($1==ENVIRON["devaddr"]) print($2) }'`
if /usr/bin/[ "$newstr" = "$str" ]; then
cooltime=$(($cooltime + $PERIOD))
if /usr/bin/[ $cooltime -ge $BOUNDARY -a $stopped -eq 0 ]; then
$SCSISTOP $1
$SCSISTART $1
time=`/bin/date '+%b %e %H:%M:%S'`
/bin/echo "$time: Cooled down..." >> $LOGFILE
stopped=1
fi
else
if /usr/bin/[ $cooltime -ne 0 ]; then
time=`/bin/date '+%b %e %H:%M:%S'`
/bin/echo "$time: Disk first used after $cooltime seconds" >> $LOGFILE
fi
cooltime=0
str=$newstr
stopped=0
fi
done

tmsulica
16-11-2009, 19:52
Prestigio Don't works



Host scsi0: usb-storage
Vendor: Prestigio
Product: USB Storage HDD
Serial Number: 7DF88FFFFFFF
Protocol: Transparent SCSI
Transport: Bulk
GUID: 152d233900007df88fffffff
Attached: Yes
Port: 1
Bus: 01:03.2-1

KBac
03-12-2009, 07:54
Works well
Box: Transcend StoreJet 2.5 (SATA)


Host scsi1: usb-storage
Vendor: JMicron
Product: StoreJet Transcend
Serial Number: 0D0708925FFF
Protocol: Transparent SCSI
Transport: Bulk
GUID: 152d232900000d0708925fff
Attached: Yes
Port: 1.1
Bus: 01:03.2-1.1



P: Vendor=152d ProdID=2329 Rev= 0.00
S: Manufacturer=JMicron
S: Product=StoreJet Transcend

trg1
01-06-2010, 20:19
I would really like to spin down my HDD when it is inactive for 20 minutes. When I try
/usr/local/sbin/scsi-stop /dev/scsi/host0/bus0/target0/lun
0/disc, I get this error:
/dev/scsi/host0/bus0/target0/lun0/disc is not a SCSI block device

Am I doing something wrong, or does it just not work with my HDD. If it doesn't work, are there any other options?

I have the same problem, can anybody help?


Host scsi0: usb-storage
Vendor: Sunplus Technology Inc.
Product: USB to Serial-ATA bridge
Serial Number: SAMSUNG HDS1Y6J1LS806829
Protocol: Transparent SCSI
Transport: Bulk
GUID: 04fc0c25315ffffffffffff9
Attached: Yes
Port: 1
Bus: 01:03.2-1

trg1
02-06-2010, 16:59
My problem was firmware 1.9.2.7-d-r1612, with oleg 1.9.2.10 was everything ok.
Problem was only my swap (its on the same hdd).
Disc goes down, but after second it spin-up :( so nothing for me

d0s.kzn
04-12-2011, 12:33
WORKING!



Host scsi0: usb-storage
Vendor: JMicron
Product: Samsung STORY Station
Serial Number: 0000002CE09310500532
Protocol: Transparent SCSI
Transport: Bulk
GUID: 04e85f05002ce09310500532
Attached: Yes
Port: 1.1
Bus: 00:03.1-1.1


Thnks ;) But i'm not understand HowTo find VendorID&ProductID, there is a lot of code :eek:



T: Bus=02 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#= 1 Spd=480 MxCh= 2
B: Alloc= 0/800 us ( 0%), #Int= 1, #Iso= 0
D: Ver= 2.00 Cls=09(hub ) Sub=00 Prot=01 MxPS= 8 #Cfgs= 1
P: Vendor=0000 ProdID=0000 Rev= 2.04
S: Manufacturer=Linux 2.4.20 ehci_hcd
S: Product=PCI device 14e4:471a
S: SerialNumber=00:03.1
C:* #Ifs= 1 Cfg#= 1 Atr=40 MxPwr= 0mA
I: If#= 0 Alt= 0 #EPs= 1 Cls=09(hub ) Sub=00 Prot=00 Driver=hub
E: Ad=81(I) Atr=03(Int.) MxPS= 2 Ivl=256ms
T: Bus=02 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 2 Spd=480 MxCh= 2
D: Ver= 2.00 Cls=09(hub ) Sub=00 Prot=01 MxPS=64 #Cfgs= 1
P: Vendor=0424 ProdID=2502 Rev= 0.01
C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr= 2mA
I: If#= 0 Alt= 0 #EPs= 1 Cls=09(hub ) Sub=00 Prot=00 Driver=hub
E: Ad=81(I) Atr=03(Int.) MxPS= 1 Ivl=256ms
T: Bus=02 Lev=02 Prnt=02 Port=00 Cnt=01 Dev#= 3 Spd=480 MxCh= 0
D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1
P: Vendor=04e8 ProdID=5f05 Rev= 0.00
S: Manufacturer=JMicron
S: Product=Samsung STORY Station
S: SerialNumber=0000002CE09310500532
C:* #Ifs= 1 Cfg#= 1 Atr=c0 MxPwr= 2mA
I: If#= 0 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage
E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
T: Bus=01 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#= 1 Spd=12 MxCh= 2
B: Alloc= 0/900 us ( 0%), #Int= 0, #Iso= 0
D: Ver= 1.10 Cls=09(hub ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1
P: Vendor=0000 ProdID=0000 Rev= 0.00
S: Product=USB OHCI Root Hub
S: SerialNumber=b8003000
C:* #Ifs= 1 Cfg#= 1 Atr=40 MxPwr= 0mA
I: If#= 0 Alt= 0 #EPs= 1 Cls=09(hub ) Sub=00 Prot=00 Driver=hub
E: Ad=81(I) Atr=03(Int.) MxPS= 2 Ivl=255ms

tmsulica
26-12-2011, 20:37
Hy , i have a question for you guys:

How can i stop my HDD from spinning when i don't need it ?

I read this post: http://wl500g.info/showthread.php?t=7836&page=5 and i tryied xander solution:


Here's the possible solution:
1. Download http://oleg.wl500g.info/bin/scsi-stop - this binary is able to spin-down your disk immediately after execution.
2. Place it somewhere on your router (you should be able to reach it via PATH environment variable) and make it executable.
3. You can use the script I've written which works in background and spins down disk after some period of inactivity:
http://wl500g.info/showpost.php?p=47135&postcount=10
I use it this way (I named the script scsi-stop.sh):

Code:
./scsi-stop.sh /dev/scsi/host0/bus0/target0/lun0/disc &It automatically writes some log messages to scsi-stop.log.
It works for me. You can change it as you wish.


but seems that my hdd doesn't work through scsi mode because i get:


/dev/scsi/host0/bus0/target0/lun0/disc: No such file or directory


and when i try the path that i think is correct ( newbie, i know )


[admin@RouterASSUS work]$ scsi-stop /dev/discs/disca/disc


i get:


/dev/discs/disca/disc is not a SCSI block device


I have latest 1.9.2.7-rtn-r3497 firmware from http://wl500g.googlecode.com/, and installed by wengi tutorial from: http://wl500g.info/showthread.php?t=10307 (with disca changes of course)

Can anybody help ? Thank you !

rumenchooo
01-01-2012, 22:00
Hi ,

you can modify that script for you needs ,plase it somwhere and make a cron job:
It looks ugly , but worked for me.

#!/bin/bash
DISKNAME=sdd
now=`/opt/bin/date`
a=0
#check 70 times with 0.1s gaps,
#and go on adding
for i in `seq 0 70`
do
b=`awk '/$DISKNAME/ {print $12}' /proc/diskstats`
a=`expr $a + $b`
sleep 0.1s
done
echo $a
if [ $a == 0 ]
then
echo "$now /dev/sdd No Activity-->>spindown" >> /opt/var/log/syslog.log
/opt/bin/sync
/opt/bin/sdparm --flexible --command=sync /dev/$DISKNAME &>/dev/null
/opt/bin/sdparm --flexible --command=stop /dev/$DISKNAME &>/dev/null
/opt/bin/sdparm --flexible --command=stop /dev/$DISKNAME &>/dev/null
/opt/bin/sg_start --stop /dev/$DISKNAME
/opt/bin/sg_start --stop /dev/$DISKNAME
/opt/bin/sg_start 0 --pc=2 /dev/$DISKNAME
/opt/bin/sg_start 0 --pc=2 /dev/$DISKNAME
/opt/bin/sg_start 0 --pc=3 /dev/$DISKNAME
/opt/bin/sg_start 0 --pc=3 /dev/$DISKNAME
else
echo "$now /dev/sdd Active-->wait ....." >> /opt/var/log/syslog.log
fi
exit 0


Of cours you have to :
ipkg install sg3-utils
ipkg install sdparm

Regards
Rumen

tmsulica
04-01-2012, 10:05
thanks a lot, but how can i test it before because doesn't work on all hhd's ?

And btw what do i put in crontab ? what line, or can i put the script in init.d ?
And second, disk name i have to put my disk name ? and the time for waiting to idle is editable ? thank you very much!

PS: when i try a simple command

[admin@RouterASSUS root]$ /opt/bin/sg_start --stop /dev/discs/disca

i get

Error trying to open /dev/discs/disca: Is a directory

even when i enter:
[admin@RouterASSUS root]$ /opt/bin/sg_start --stop /dev/$DISKNAME

i get:

Error trying to open /dev/: Is a directory

wpte
04-01-2012, 10:37
thanks a lot, but how can i test it before because doesn't work on all hhd's ?

And btw what do i put in crontab ? what line, or can i put the script in init.d ?
And second, disk name i have to put my disk name ? and the time for waiting to idle is editable ? thank you very much!

I used the old scsi tools to do the same thing: http://wpte.kicks-ass.net/forum/showthread.php?tid=4
it's a modification of the old d script:)

tmsulica
04-01-2012, 11:06
hy, that is what i was looking for, but can i issue a command before all this to see if the hdd is stopping ? like in the old scsi-stop ?

2. that is my problem i can't find hdd name .......

wpte
04-01-2012, 11:20
hy, that is what i was looking for, but can i issue a command before all this to see if the hdd is stopping ? like in the old scsi-stop ?

2. that is my problem i can't find hdd name .......

well the harddrives are labeled like "sdx" with x as a or b or c etc.
so your first drive is called "sda" your first partition on sda is called "sda1" etc.
you can check it in /dev :

ls /dev/ | grep sd
for me it shows this:

sda
sda1
sda2
sda3
sdb
sdb1

you can try if the script will work like this:

/usr/sbin/scsi-stop /dev/sda

tmsulica
04-01-2012, 11:37
yes that was helpfull. THANK YOU

But i have a problem when i run your script, my command line freezes and i have to exit with ctrl+c and hdd won't stop spinning. how can i test this ?

and by the way thank you very much for your help !



[admin@RouterASSUS root]$ /usr/sbin/scsi-stop /dev/sda
/dev/sda is not a SCSI block device



by the way my firmware is not oleg's latest .10 , is 1.9.2.7-rtn-r3497 as i said . hdd seems that doesn't work via scsi mode or something is changed ....

wpte
04-01-2012, 11:42
yes that was helpfull. THANK YOU

But i have a problem when i run your script, my command line freezes and i have to exit with ctrl+c and hdd won't stop spinning. how can i test this ?

and by the way thank you very much for your help !

quoting:

this can be used like:

/usr/local/sbin/scsi-stop.sh sda &
/usr/local/sbin/scsi-stop.sh sdb &

don't forget the & character, it will make the script run in the background;)


by the way my firmware is not oleg's latest .10 , is 1.9.2.7-rtn-r3497 as i said . hdd seems that doesn't work via scsi mode or something is changed ....
I know I use this script on my rt-n16.
if it says "/dev/sda is not a SCSI block device" it might not be possible.
it did work on .10/d firmware for you?

tmsulica
04-01-2012, 11:43
adn yes: ........



[admin@RouterASSUS root]$ ls /dev/ | grep sd
sda
sda1
sda2
sda3



but


[admin@RouterASSUS root]$ /usr/sbin/scsi-stop /dev/sda
/dev/sda is not a SCSI block device

tmsulica
04-01-2012, 12:04
quoting:


don't forget the & character, it will make the script run in the background;)


I know I use this script on my rt-n16.
if it says "/dev/sda is not a SCSI block device" it might not be possible.
it did work on .10/d firmware for you?

Yes you'r right it was the & symbol.

in .10 firmware didn't work ( so i thought) because my hdd wasn't supported. but i didn't have those errors. is an another way to stop my hdd ? thanks for your support !

wpte
04-01-2012, 13:08
in .10 firmware didn't work ( so i thought) because my hdd wasn't supported. but i didn't have those errors. is an another way to stop my hdd ? thanks for your support !

hmmm yes, the .10 firmware trick is the same as this one... just the script to check the activity is different. so then you should probably use the sdparm version rumenchooo uses.
if that doesn't work either... no idea:p

tmsulica
04-01-2012, 17:15
OK so i tryied Rumen Code but i get :


# ./hdd-stop.sh
syntax error
syntax error
syntax error
syntax error
syntax error
syntax error
syntax error
syntax error
syntax error
syntax error
syntax error
syntax error
syntax error
syntax error
syntax error
syntax error
syntax error
syntax error
syntax error
syntax error

"ctrl+c"

[admin@RouterASSUS root]$


what is wrong ?

PS i switched hdd disk name from sdd to sda. and i saw running mc that i do not have an /date directory on /opt/bin.

tmsulica
04-01-2012, 17:55
but one more question wpte ... on .10 firmware existed path /dev/scsi/host0/bus0/target0/lun0/disc

now in this build with what is replaced ?

because /dev/sda is not an SCSI block device, so on this build where is the scsi block device ??

10x

rumenchooo
05-01-2012, 23:12
Hey tmsulica ,

so you have one HDD (sda)?

Try this one.

1.Check the paths/location of your programs

/opt/bin/sdparm
/opt/bin/sync
/opt/bin/sg_start
etc..

are they correct for you??

2.Did you install sdparm and sg3-utils??

3.Put this line in /opt/etc/crontab:
*/10 * * * * admin /opt/whatever-you-want/that_script
It will check fo activity every 10 min.

4.Are the commands worked for you by himself????
sdparm --flexible --command=stop /dev/sda &>/dev/null
sdparm --flexible --command=sync /dev/sda &>/dev/null
sg_start 0 --pc=2 /dev/sda
awk '/sda/ {print $12}' /proc/diskstats
etc.....

But even if you succeed , the disk will not remain down , because firmware need to access it.(log , swap ... etc)!!!
Even cron need to read that script from HDD!!!
So spin up again ->> spin down --> spin up --> spin down.
And that is for VERY short periond.
As you know HDD don`t like spin up/donw too much.

You have to install /opt on the flash stick and use HDD only for storage.


#!/bin/bash
DISKNAME=sda
a=0
#check 70 times with 0.1s gaps,
#and go on adding
for i in `seq 0 70`
do
b=`awk '/$DISKNAME/ {print $12}' /proc/diskstats`
a=`expr $a + $b`
sleep 0.1s
done
echo $a
if [ $a == 0 ]
then
echo "$DISKNAME No Activity-->>spindown" >> /opt/var/log/syslog.log
/opt/bin/sync
/opt/bin/sdparm --flexible --command=sync /dev/$DISKNAME &>/dev/null
/opt/bin/sdparm --flexible --command=stop /dev/$DISKNAME &>/dev/null
/opt/bin/sdparm --flexible --command=stop /dev/$DISKNAME &>/dev/null
/opt/bin/sg_start --stop /dev/$DISKNAME
/opt/bin/sg_start --stop /dev/$DISKNAME
/opt/bin/sg_start 0 --pc=2 /dev/$DISKNAME
/opt/bin/sg_start 0 --pc=2 /dev/$DISKNAME
/opt/bin/sg_start 0 --pc=3 /dev/$DISKNAME
/opt/bin/sg_start 0 --pc=3 /dev/$DISKNAME
else
echo "$DISKNAME Active-->wait ....." >> /opt/var/log/syslog.log
fi
exit 0




Regards
Rumen