Hdparm: differenze tra le versioni

Da Guide@Debianizzati.Org.
Vai alla navigazione Vai alla ricerca
(tolta categoria "Da Adottare" (era stata inserita a mano))
(tolti template "Versioni compatibili" e "Autori")
Riga 1: Riga 1:
{{Guida da adottare}}{{stub}}{{Versioni compatibili}}
{{Guida da adottare}}


= Introduzione =
= Introduzione =
Riga 132: Riga 132:
== Conclusioni ==
== Conclusioni ==


{{Autori
 
|Autore = [[Utente:MaXeR|MaXeR]]
|Estesa_da =
: [[Utente:Wtf|Wtf]] 10:04, 9 gen 2013 (CET)
|Verificata_da =
: [[Utente:Wtf|Wtf]]
|Numero_revisori = 1
}}
[[Categoria:Shell]]
[[Categoria:Shell]]
[[Categoria:Hard Disk]]
[[Categoria:Hard Disk]]

Versione delle 13:29, 7 giu 2015

Guida da adottare! Bannermv.png


Introduzione

Hdparm consente la modifica avanzata dei parametri funzionali dei disposibivi ATA/IDE (hard disk, lettori cd/dvd), permettendo un fine tuning degli hard disk e lettori, che spesso rappresentano un vero collo di bottiglia per le performance di una macchina.

Prerequisiti

Da squeeze in avanti nessuno in particolare, per le versioni precedenti si veda il seguito.

Kernel

Per poter utilizzare al meglio questo strumento, è consigliato:

  • avere una versione del kernel abbastanza recente (quelle presenti in Sarge vanno più che bene)
  • avere i moduli per il proprio chipset caricati (o compilati staticamente nel kernel)

Installazione

Il pacchetto è presente in Debian:

# apt-get install hdparm

Utilizzo

Da riga di comando

La sintassi standard è

# hdparm [opzioni] [dispositivo...]
Warning.png ATTENZIONE
Le impostazioni date da riga di comando vengono "dimenticate" ad ogni riavvio. Per rendere permanenti le modifiche è necessario editare il file /etc/hdparm.conf


Opzioni e Argomenti

Le opzioni disponibili sono tante, alcune delle quali critiche, quindi sconsiglio vivamente l'utilizzo di opzioni che non si conoscono, per evitare danni e/o malfunzionamenti/perdite di dati... (declino ogni responsabilità su questi).

-A
Disabilita/Abilita la fjnzione di read-lookahead del driver IDE (di solito ON di defaul). Utilizzo: -A0 (disabilita) o -A1 (abilita).
-b
Restituisce o imposta lo stato del bus [0,1]
-B
Modifica le impostazioni della gestione avanzata dell'alimentazione (APM), se supportate. Un valore basso implica un comportamento aggressivo per quanto riguarda il risparmio energetico, quindi un consumo minore, un valore alto, invece, permette performance migliori. Il valore 255 disattiva l'apm.
-c
Visualizza lo stato o abilita il supporto per l'I/O a 32 bit per i dispositivi (E)IDE. I seguenti valori numerici possono essere usati per impostare:
0
per disabilitare il supporto a 32-bit
1
per abilitare il trasferimento dei dati a 32-bit
3
per abilitare il trasferimento dei dati a 32-bit con una speciale sequenza di sincronizzazione richiesta da molti chipset.
-C
Controlla lo stato corrente dell'alimentazione del dispositivo; le possibili risposte sono:
unknown
il dispositivo non supporta la funzione
active/idle
stato normale
standby
il device è in standby, i piatti dell'hard disk non sono in movimento
sleeping
il device è completamente spento.
È possibile modificare le modalità tramite le opzioni -S, -y, -Y, -Z.
-d
Disabilita/abilita l'opzione "using_dma". Questa opzione funziona con la maggior parte delle coppie 'dispositivo interfaccia' supportanti il DMA e supportate dai driver del kernel. E' una buona idea utilizzare l'appropriato valore dell'opzione -X in combinaizone con -d1 per essere sicuri che il dispositivo sia impostato correttamente, anche se molti BIOS dovrebbero impostare questi parametri correttamente all'avvio del sistema. L'utilizzo del DMA consente di avere delle buone performance, aumentando la velocita' di trasferimento e diminuendo il carico del processore. Ci sono, pero', alcune configurazioni per cui l'abilitazione o meno del DMA non provoca cambiamenti, o puo' perfino causare un degradamento delle performance (caso molto raro).
-E
Imposta la velocità del cdrom. Questo NON è necessario normalmente, dato che il drive selezionerà automaticamente la velocità. Ma se vuoi provarci, fornisci un numero dopo l'opzione, di solito un numero come 2 o 4.
-f
Sincronizza ed esegue un flush del buffer del dispositibo. Viene eseguito anche dutante i test -T e -t
-g
Mostra la geometria del drive (cilindri, testine, settori), la dimensione (in settori) del device, e l'offset di partenza (in settori) del device dall'inizio del drive.
-i
Visualizza Display the identification info that was obtained from the drive at boot time, if available. This is a feature of modern IDE drives, and may not be supported by older devices. The data returned may or may not be current, depending on activity since booting the system. However, the current multiple sector mode count is always shown. For a more detailed interpretation of the identification info, refer to AT Attachment Interface for Disk Drives (ANSI ASC X3T9.2 working draft, revision 4a, April 19/93).
-I
Richiede informazioni di identificazione direttamente dal drive, e le mostrerà in un nuovo formato espanso con più dettagli rispetto alla vecchia opzione -i.
-Istdin
This is a special "no seatbelts" variation on the -I option, which accepts a drive identification block as standard input instead of using a /dev/hd* parameter. The format of this block must be exactly the same as that found in the /proc/ide/*/hd*/identify "files", or that produced by the -Istdout option described below. This variation is designed for use with collected "libraries" of drive identification information, and can also be used on ATAPI drives which may give media errors with the standard mechanism.
-Istdout
This option simply dumps the identify data in hex to stdout, in a format similar to that from /proc/, and suitable for later use with the -Istdin option.
-k
Get/set the keep_settings_over_reset flag for the drive. When this flag is set, the driver will preserve the -dmu options over a soft reset, (as done during the error recovery sequence). This flag defaults to off, to prevent drive reset loops which could be caused by combinations of -dmu settings. The -k flag should therefore only be set after one has achieved confidence in correct system operation with a chosen set of configuration settings. In practice, all that is typically necessary to test a configuration (prior to using -k) is to verify that the drive can be read/written, and that no error logs (kernel messages) are generated in the process (look in /var/adm/messages on most systems).
-K
Set the drive's keep_features_over_reset flag. Setting this enables the drive to retain the settings for -APSWXZ over a soft reset (as done during the error recovery sequence). Not all drives support this feature.
-L
Set the drive's doorlock flag. Setting this to 1 will lock the door mechanism of some removable hard drives (eg. Syquest, ZIP, Jazz..), and setting it to 0 will unlock the door mechanism. Normally, Linux maintains the door locking mechanism automatically, depending on drive usage (locked whenever a filesystem is mounted). But on system shutdown, this can be a nuisance if the root partition is on a removeable disk, since the root partition is left mounted (read-only) after shutdown. So, by using this command to unlock the door after the root filesystem is remounted read-only, one can then remove the cartridge from the drive after shutdown.
-m
Get/set sector count for multiple sector I/O on the drive. A setting of 0 disables this feature. Multiple sector mode (aka IDE Block Mode), is a feature of most modern IDE hard drives, permitting the transfer of multiple sectors per I/O interrupt, rather than the usual one sector per interrupt. When this feature is enabled, it typically reduces operating system overhead for disk I/O by 30-50%. On many systems, it also provides increased data throughput of anywhere from 5% to 50%. Some drives, however (most notably the WD Caviar series), seem to run slower with multiple mode enabled. Your mileage may vary. Most drives support the minimum settings of 2, 4, 8, or 16 (sectors). Larger settings may also be possible, depending on the drive. A setting of 16 or 32 seems optimal on many systems. Western Digital recommends lower settings of 4 to 8 on many of their drives, due tiny (32kB) drive buffers and non-optimized buffering algorithms. The -i flag can be used to find the maximum setting supported by an installed drive (look for MaxMultSect in the output). Some drives claim to support multiple mode, but lose data at some settings. Under rare circumstances, such failures can result in massive filesystem corruption.
-M
Get/set Automatic Acoustic Management (AAM) setting. Most modern harddisk drives have the ability to speed down the head movements to reduce their noise output. The possible values are between 0 and 254. 128 is the most quiet (and therefore slowest) setting and 254 the fastest (and loudest). Some drives have only two levels (quiet / fast), while others may have different levels between 128 and 254. THIS FEATURE IS EXPERIMENTAL AND NOT WELL TESTED. USE AT YOUR OWN RISK.
-n
Restituisce o imposta il flag ignore write errors per i driver del chipset IDE. Non usarlo senza aver controllato molto bene il codice sorgente del driver dei chipset IDE.
-p
Attempt to reprogram the IDE interface chipset for the specified PIO mode, or attempt to auto-tune for the "best" PIO mode supported by the drive. This feature is supported in the kernel for only a few "known" chipsets, and even then the support is iffy at best. Some IDE chipsets are unable to alter the PIO mode for a single drive, in which case this flag may cause the PIO mode for both drives to be set. Many IDE chipsets support either fewer or more than the standard six (0 to 5) PIO modes, so the exact speed setting that is actually implemented will vary by chipset/driver sophis tication. Use with extreme caution! This feature includes zero protection for the unwary, and an unsuccessful outcome may result in severe filesystem corruption!
-P
Set the maximum sector count for the drive's internal prefetch mechanism. Not all drives support this feature.
-q
Handle the next flag quietly, suppressing normal output. This is useful for reducing screen clutter when running from system startup scripts. Not applicable to the -i or -v or -t or -T flags.
-Q
Set tagged queue depth (1 or greater), or turn tagged queuing off (0). This only works with the newer 2.5.xx (or later) kernels, and only with the few drives that currently support it.
-r
Imposta/leggi modalità sola-lettura sul drive. Quando impostata, Linux impedisce operazioni di scrittura sul device.
-R
Register an IDE interface. Dangerous. See the -U option for more information.
-S
modalità di standby, imposta il timeout per l'arresto del disco (spindown). Questo valore viene usato per determinare quanto aspettare (in caso di assenza di attività) prima di arrestare la rotazione dei dischi. In alcuni casi, il disco può impiegare anche 30 secondi prima di rispondere ad una richiesta di lettura, quando i piatti sono fermi. I valori usabili sono i seguenti:
0
disattivato: il dispositivo non entrerà automaticamente in standby
1-240
specifica i multipli di 5 secondi, gestendo un timeout variabile tra i 5 secondi e i 20 minuti
241-251
specifica le unità di da 30 minuti fino a 5 or e mezza (ad intervalli di 30 minuti)
252
21 minutes
253
imposta un timeout preimpostato dal produttore, variabile tra le 8 e le 12 ore
254
valore riservato
255
21 minuti e 15 secondi
alcuni vecchi dispositivi possono interpretare diversamente questi valori.
-T
Perform timings of cache reads for benchmark and comparison purposes. For meaningful results, this operation should be repeated 2-3 times on an otherwise inactive system (no other active processes) with at least a couple of megabytes of free memory. This displays the speed of reading directly from the Linux buffer cache without disk access. This measurement is essentially an indication of the throughput of the processor, cache, and memory of the system under test. If the -t flag is also specified, then a correction factor based on the outcome of -T will be incorporated into the result reported for the -t operation.
-t
Perform timings of device reads for benchmark and comparison purposes. For meaningful results, this operation should be repeated 2-3 times on an otherwise inactive system (no other active processes) with at least a couple of megabytes of free memory. This displays the speed of reading through the buffer cache to the disk without any prior caching of data. This measurement is an indication of how fast the drive can sustain sequential data reads under Linux, without any filesystem overhead. To ensure accurate measurements, the buffer cache is flushed during the processing of -t using the BLKFLSBUF ioctl. If the -T flag is also specified, then a correction factor based on the outcome of -T will be incorporated into the result reported for the -t operation.
-u
Get/set interrupt-unmask flag for the drive. A setting of 1 permits the driver to unmask other interrupts during processing of a disk interrupt, which greatly improves Linux's responsiveness and eliminates "serial port overrun" errors. Use this feature with caution: some drive/controller combinations do not tolerate the increased I/O latencies possible when this feature is enabled, resulting in massive filesystem corruption. In particular, CMD-640B and RZ1000 (E)IDE interfaces can be unreliable (due to a hardware flaw) when this option is used with kernel versions earlier than 2.0.13. Disabling the IDE prefetch feature of these interfaces (usually a BIOS/CMOS setting) provides a safe fix for the problem for use with earlier kernels.
-U
Un-register an IDE interface. Dangerous. The companion for the -R option. Intended for use with hardware made specifically for hot-swapping (very rare!). Use with knowledge and extreme caution as this can easily hang or damage your system. The hdparm source distribution includes a 'contrib' directory with some user-donated scripts for hot-swapping on the UltraBay of a ThinkPad 600E. Use at your own risk.
-v
Display all settings, except -i (same as -acdgkmnru for IDE, -gr for SCSI or -adgr for XT). This is also the default behaviour when no flags are specified.
-w
Perform a device reset (DANGEROUS). Do NOT use this option. It exists for unlikely situations where a reboot might otherwise be required to get a confused drive back into a useable state.
-W
Disable/enable the IDE drive's write-caching feature (default state is undeterminable; manufacturer/model specific).
-X
Set the IDE transfer mode for newer (E)IDE/ATA drives. This is typically used in combination with -d1 when enabling DMA to/from a drive on a sup ported interface chipset, where -X mdma2 is used to select multiword DMA mode2 transfers and -X sdma1 is used to select simple mode 1 DMA transfers. With systems which support UltraDMA burst timings, -X udma2 is used to select UltraDMA mode2 transfers (you'll need to prepare the chipset for UltraDMA beforehand). Apart from that, use of this flag is seldom necessary since most/all modern IDE drives default to their fastest PIO transfer mode at power-on. Fiddling with this can be both needless and risky. On drives which support alternate transfer modes, -X can be used to switch the mode of the drive only. Prior to changing the transfer mode, the IDE interface should be jumpered or programmed (see -p flag) for the new mode setting to prevent loss and/or corruption of data. Use this with extreme caution! For the PIO (Programmed Input/Output) transfer modes used by Linux, this value is simply the desired PIO mode number plus 8. Thus, a value of 09 sets PIO mode1, 10 enables PIO mode2, and 11 selects PIO mode3. Setting 00 restores the drive's "default" PIO mode, and 01 disables IORDY. For multiword DMA, the value used is the desired DMA mode number plus 32. for UltraDMA, the value is the desired UltraDMA mode number plus 64.
  • Modalità PIO
    • 0 -X08 3.3MB/sec
    • 1 -X09 5.2MB/sec
    • 2 -X10 8.3MB/sec NEC PC-98*1
    • 3 -X11 11.1MB/sec
    • 4 -X12 16.7MB/sec
  • Modalità Singleword DMA
    • 0 2.1MB/sec
    • 1 4.2MB/sec
    • 2 8.3MB/sec
  • Modalità Multiword DMA
    • 0 -X32 4.2MB/sec
    • 1 -X33 13.3MB/sec
    • 2 -X34 16.6MB/sec
  • Modalità Ultra DMA
    • 0 16MB/sec
    • 1 25MB/sec
    • 2 -X66 33MB/sec UDMA33
    • 3 50MB/sec
    • 4 -X68 66MB/sec UDMA66
    • 5 -x69 100MB/sec UDMA100
-y
Forza un dispositivo IDE ad entrare nello stato di basso consumo (Low power consumption standby mode), normalmente causando la fermata dei piatti. Lo stato corrente può essere verificato tramite l'opzione -C;
-Y
Forza un dispositivo IDE ad entrare immediatamente nel più basso livello di consumo energetico, causandone lo spegnimento completo (sleep mode). È necessario un hard o soft reset prima che il dispositivo sia nuovamente accessibile (i driver IDE di linux eseguiranno il reset automaticamente, se necessariod). Lo stato corrente può essere controllato con l'opzione -C.
-z
Forza la rilettura della tabella delle partizioni, utile nel caso di modifiche con fdisk o simili, senza rendere necessario un riavvio della macchina. È necessario assicurarsi che tutte le partizioni del dispositivo siano smontate. Di seguito è riportato un esempio dell'uso di questa opzione:
# hdparm -z /dev/hda

File di configurazione

Per rendere permanenti le modifiche apportate ai dispositivi è necessario inserire le varie direttive nel file /etc/hdparm.conf. La sintassi generale è:

/dev/vostro_dispositivo {
       direttiva1 = valore
       direttiva2 = valore
       ecc.
}

Si noti che è teoricamente possibile utilizzare la stessa sintassi della riga di comando anche all'interno di questo file di configurazione (si vedano le note inserite nel file stesso).

Test delle Performance

Alcuni esempi di Tuning

Standby (Spindown time)

Impostare il disco sdb affinché si metta in standby dopo 15 minuti:

# hdparm -S 180 /dev/sdb

Per rendere permanente la modifica inserire nel file di configurazione la direttiva spindown_time = 180, ad esempio:

/dev/sdb {
       spindown_time = 180
}

Posto naturalmente che questa sia l'unica modifica che si vuole apportare.

Conclusioni