Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
USB HDD schlafen legen
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Deutsches Forum (German) Diskussionsforum
View previous topic :: View next topic  
Author Message
manuels
Advocate
Advocate


Joined: 22 Nov 2003
Posts: 2146
Location: Europe

PostPosted: Tue Jan 04, 2011 7:44 pm    Post subject: USB HDD schlafen legen Reply with quote

Hi,

ich möchte meine USB HDD an meiner Alix schlafen legen, wenn sie X Minuten nicht gebraucht wird.
Hauptsächlich um die Platte zu schonen (Alix läuft 24/7).
Wäre es eine IDE-Platte, würde ich es mit hdparm machen...

Wie läuft das denn bei USB?

Danke!
Manuel
_________________
Build your own live cd with catalyst 2.0!
Back to top
View user's profile Send private message
kernelOfTruth
Watchman
Watchman


Joined: 20 Dec 2005
Posts: 6111
Location: Vienna, Austria; Germany; hello world :)

PostPosted: Tue Jan 04, 2011 7:57 pm    Post subject: Reply with quote

ja, das sollte gehen du hast (soviel ich weiß) 3 oder mehr Möglichkeiten

*) per hdparm

Code:
hdparm -Y /dev/foo


*) per sdparm

Code:
sdparm -C stop /dev/foo


*) per sys-apps/hd-idle

Code:
hd-idle -t foo

_________________
https://github.com/kernelOfTruth/ZFS-for-SystemRescueCD/tree/ZFS-for-SysRescCD-4.9.0
https://github.com/kernelOfTruth/pulseaudio-equalizer-ladspa

Hardcore Gentoo Linux user since 2004 :D
Back to top
View user's profile Send private message
manuels
Advocate
Advocate


Joined: 22 Nov 2003
Posts: 2146
Location: Europe

PostPosted: Tue Jan 04, 2011 8:33 pm    Post subject: Reply with quote

Da hab ich mich wohl undeutlich ausgedrückt:
Ich möchte, dass die Platte automatisch nach z.B. 5min sich schlafen legt.
Ich möchte das nicht manuell machen müssen.
_________________
Build your own live cd with catalyst 2.0!
Back to top
View user's profile Send private message
kernelOfTruth
Watchman
Watchman


Joined: 20 Dec 2005
Posts: 6111
Location: Vienna, Austria; Germany; hello world :)

PostPosted: Tue Jan 04, 2011 9:10 pm    Post subject: Reply with quote

manuels wrote:
Da hab ich mich wohl undeutlich ausgedrückt:
Ich möchte, dass die Platte automatisch nach z.B. 5min sich schlafen legt.
Ich möchte das nicht manuell machen müssen.


Code:
man hdparm


Code:
hdparm -S 60 /dev/foo

_________________
https://github.com/kernelOfTruth/ZFS-for-SystemRescueCD/tree/ZFS-for-SysRescCD-4.9.0
https://github.com/kernelOfTruth/pulseaudio-equalizer-ladspa

Hardcore Gentoo Linux user since 2004 :D
Back to top
View user's profile Send private message
manuels
Advocate
Advocate


Joined: 22 Nov 2003
Posts: 2146
Location: Europe

PostPosted: Wed Jan 05, 2011 12:26 am    Post subject: Reply with quote

-S veranlasst aber nur den Standby-Modus, ich möchte den Sleep-Modus.
_________________
Build your own live cd with catalyst 2.0!
Back to top
View user's profile Send private message
kernelOfTruth
Watchman
Watchman


Joined: 20 Dec 2005
Posts: 6111
Location: Vienna, Austria; Germany; hello world :)

PostPosted: Thu Jan 06, 2011 12:56 am    Post subject: Reply with quote

"Skript, das per cron job regelmäßig prüft, ob die Platte angesprochen wurde"

Quelle: hd-idle installieren

du kannst sdparm --flexible --command=stop /dev/$1 durch hdparm -Y /dev/$1

oder was ähnliches ersetzen ...

ist nur die Frage, ob es dann auch geht :?
_________________
https://github.com/kernelOfTruth/ZFS-for-SystemRescueCD/tree/ZFS-for-SysRescCD-4.9.0
https://github.com/kernelOfTruth/pulseaudio-equalizer-ladspa

Hardcore Gentoo Linux user since 2004 :D
Back to top
View user's profile Send private message
Massimo B.
Veteran
Veteran


Joined: 09 Feb 2005
Posts: 1759
Location: PB, Germany

PostPosted: Mon Aug 20, 2012 9:19 am    Post subject: Reply with quote

hdparm -S ist die Option für automatischen Low-power mode nach einer eingestellten Zeit.
Ich setze das automatisch beim Booten
Code:
$ grep -v "^#" /etc/conf.d/hdparm
cdrom_args="-E 36"
sda_args="  -B255   -M254   -S243"
sdb_args="                  -S243"
sdc_args="  -B100   -M254   -S180"
all_args=""

Meine Frage ist nun aber, warum sdc als USB-Device nie beim Booten mit hdparm eingestellt wird. Nach dem Booten muss ich jedesmal /etc/init.d/hdparm neustarten. Was bräuchte das hdparm init-Script als Abhängigkeit, damit USB erkannt wird?
_________________
HP ZBook Power 15.6" G8 i7-11800H|HP EliteDesk 800G1 i7-4790|HP Compaq Pro 6300 i7-3770
Back to top
View user's profile Send private message
bell
Guru
Guru


Joined: 27 Nov 2007
Posts: 508

PostPosted: Mon Aug 20, 2012 9:48 am    Post subject: Reply with quote

Ich hatte mal für meinen Media-Center sowas geschrieben. Da habe ich eine USB-Festplatte für die Inhalte die nicht ständig laufen sollte. Bei mir trägt das Skript den Namen "sdparm-idle.sh".
Das Skript prüft alle 30 Sekunden ob es eine Aktivität gab und stoppt nach 300 Sekunden, wenn es keine Zugriffe gab. Gestoppt wird also mit der Genauigkeit +/- 30 Sekunden (Oder wie Du den Parameter setzt).

Code:
#!/bin/sh

disk=/dev/sdb
interval=300
step=30
#debug=yes


l_debug(){
   if [ "$debug" = "yes" ]; then
      logger "sdparm-idle debug: $@"
   fi
}

state=`cat /sys/block/$(basename $disk)/stat`
count=$interval
up=1

while [ true ]; do
   sleep $step
   newstate=`cat /sys/block/$(basename $disk)/stat`

   l_debug count $count / up $up / state $state / $newstate
   if [ "$state" = "$newstate" ]; then
      if [ $count -gt 0 ]; then
         count=$(($count-$step))
      else
         count=$interval
         if [ $up = 1 ]; then
            logger "sdparm-idle: Festplatte wird angehalten"
            sync
            state="$newstate"
            sdparm --command=stop $disk
            up=0
         fi
      fi
   else
      logger "sdparm-idle: Festplatte ist aktiv, warte $interval Sekunden"
      count=$interval
      state="$newstate"
      up=1
   fi
done &


Einfach nach /etc/local.d/sdparm-idle.start ablegen damit es beim Hochfahren mit gestartet wird.
Falls dich die "logger" Zeilen stören kannst Du diese rausnehmen oder durch l_debug ersetzen.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Deutsches Forum (German) Diskussionsforum All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum