Eu tenho um servidor com três unidades SATA/600 de 3 TB idênticas: /dev/sda
, /dev/sdb
, /dev/sdc
. As unidades são particionadas usando GPT com três partições cada:
- 1 MB: partição reservada para carregador de boot
- 1GB: RAID1 /dev/md0 ( ext2 ( /boot ) )
- 3 TB: RAID1 /dev/md1 ( volume criptografado ( LVM ( grupo de volumes ( Swap, /, /etc, /home ... ) ) ) )
Uma das três unidades é sobressalente e as outras duas estão ativas nos conjuntos RAID. Funciona bem e consigo inicializar depois de desconectar qualquer HDD. Eu quero usarsmartd (parte do smartmontools)para monitorar a integridade das unidades e relatar erros ao syslog (que eu monitoro usandoverificação de log). Este servidor deve ter a maior disponibilidade possível, mas é aceitável que o desempenho seja reduzido durante os testes.
Aqui está a saída de smartctl -a /dev/sda
:
smartctl 5.41 2011-06-09 r3365 [x86_64-linux-3.2.0-4-amd64] (local build)
Copyright (C) 2002-11 by Bruce Allen, http://smartmontools.sourceforge.net
=== START OF INFORMATION SECTION ===
Device Model: WDC WD30EZRX-00MMMB0
Serial Number: WD-WMAWZ0412093
LU WWN Device Id: 5 0014ee 2b19fbdcd
Firmware Version: 80.00A80
User Capacity: 3,000,592,982,016 bytes [3.00 TB]
Sector Sizes: 512 bytes logical, 4096 bytes physical
Device is: Not in smartctl database [for details use: -P showall]
ATA Version is: 8
ATA Standard is: Exact ATA specification draft version not indicated
Local Time is: Fri Sep 27 15:37:25 2013 CEST
SMART support is: Available - device has SMART capability.
SMART support is: Enabled
=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED
General SMART Values:
Offline data collection status: (0x82) Offline data collection activity
was completed without error.
Auto Offline Data Collection: Enabled.
Self-test execution status: ( 0) The previous self-test routine completed
without error or no self-test has ever
been run.
Total time to complete Offline
data collection: (50280) seconds.
Offline data collection
capabilities: (0x7b) SMART execute Offline immediate.
Auto Offline data collection on/off support.
Suspend Offline collection upon new
command.
Offline surface scan supported.
Self-test supported.
Conveyance Self-test supported.
Selective Self-test supported.
SMART capabilities: (0x0003) Saves SMART data before entering
power-saving mode.
Supports SMART auto save timer.
Error logging capability: (0x01) Error logging supported.
General Purpose Logging supported.
Short self-test routine
recommended polling time: ( 2) minutes.
Extended self-test routine
recommended polling time: ( 255) minutes.
Conveyance self-test routine
recommended polling time: ( 5) minutes.
SCT capabilities: (0x3035) SCT Status supported.
SCT Feature Control supported.
SCT Data Table supported.
SMART Attributes Data Structure revision number: 16
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED WHEN_FAILED RAW_VALUE
1 Raw_Read_Error_Rate 0x002f 200 200 051 Pre-fail Always - 0
3 Spin_Up_Time 0x0027 148 148 021 Pre-fail Always - 9575
4 Start_Stop_Count 0x0032 100 100 000 Old_age Always - 95
5 Reallocated_Sector_Ct 0x0033 200 200 140 Pre-fail Always - 0
7 Seek_Error_Rate 0x002e 200 200 000 Old_age Always - 0
9 Power_On_Hours 0x0032 099 099 000 Old_age Always - 820
10 Spin_Retry_Count 0x0032 100 253 000 Old_age Always - 0
11 Calibration_Retry_Count 0x0032 100 253 000 Old_age Always - 0
12 Power_Cycle_Count 0x0032 100 100 000 Old_age Always - 93
192 Power-Off_Retract_Count 0x0032 200 200 000 Old_age Always - 65
193 Load_Cycle_Count 0x0032 196 196 000 Old_age Always - 12824
194 Temperature_Celsius 0x0022 119 116 000 Old_age Always - 33
196 Reallocated_Event_Count 0x0032 200 200 000 Old_age Always - 0
197 Current_Pending_Sector 0x0032 200 200 000 Old_age Always - 0
198 Offline_Uncorrectable 0x0030 200 200 000 Old_age Offline - 0
199 UDMA_CRC_Error_Count 0x0032 200 200 000 Old_age Always - 0
200 Multi_Zone_Error_Rate 0x0008 200 200 000 Old_age Offline - 0
SMART Error Log Version: 1
No Errors Logged
SMART Self-test log structure revision number 1
Num Test_Description Status Remaining LifeTime(hours) LBA_of_first_error
# 1 Short offline Completed without error 00% 787 -
# 2 Extended offline Completed without error 00% 727 -
SMART Selective self-test log data structure revision number 1
SPAN MIN_LBA MAX_LBA CURRENT_TEST_STATUS
1 0 0 Not_testing
2 0 0 Not_testing
3 0 0 Not_testing
4 0 0 Not_testing
5 0 0 Not_testing
Selective self-test flags (0x0):
After scanning selected spans, do NOT read-scan remainder of disk.
If Selective self-test is pending on power-up, resume after 0 minute delay.
Parece que o teste offline é compatível. Quando eu emito smartctl -o on
, smartctl -c
mostra que Offline data collection status
foi definido como (0x82)
. Se eu emitir smartctl -o off
o mesmo valor torna-se (0x02)
.
Eu configurei o smartd para inicializar o servidor configurando o start_smartd=yes
arquivo /etc/default/smartmontools
. Como você recomendaria que eu configurasse o smartd editando /etc/smartd.conf
para este servidor? Descreva cada parâmetro que você usa e por que você o usa dessa maneira.
Adicionarei minha configuração atual como resposta. Sinta-se à vontade para usá-lo como base e melhorá-lo em sua própria resposta. Uma descrição melhor usando a mesma configuração também seria uma melhoria!
Responder1
Mudei de longos autotestes para select,cont
testes. É como um longo autoteste, mas apenas uma fatia do disco por vez. Portanto, embora o longo autoteste possa levar mais de um dia (com um disco de 3 TB ocupado), o teste seletivo pode ser executado todas as noites quando o servidor estiver menos ocupado e realmente terminar, sem prejudicar o desempenho nas horas mais movimentadas.
Então, basicamente, você distribuiria um autoteste mensal de todo o disco para um teste seletivo noturno que ainda cobre todo o disco ao longo de um mês.
No entanto, é necessária alguma preparação.
smartd
deve ser executado com a--savestates
opção, pois os próprios discos geralmente não acompanham a última região testada.- Você deve iniciar o primeiro autoteste seletivo manualmente (
-t select,0-$size
) parasmartd
saber o tamanho da fatia a ser testada a cada dia. O tamanho determina quanto tempo o teste levará e quantos dias abrangerá todo o disco. - Certifique-se de que o $size escolhido esteja alinhado ao tamanho do disco. Caso contrário, você corre o risco de a última fatia ser muito pequena (na pior das hipóteses, você perde um dia testando apenas um único setor do disco).
- Você deve verificar se essas informações realmente chegaram aos arquivos savestates, pois às vezes isso não acontece e o teste não será executado da maneira que você deseja. (Editar o arquivo savestate diretamente também é uma opção).
- A sintaxe do
smartd.conf
arquivo é-s c/../.././01
(neste exemplo, ele seria executado todos os dias à 1h).
Uma vez feito isso, o processo é automático e confiável. Quando chegar ao final do disco, ele iniciará automaticamente do início do dia seguinte. Leia a smartctl
página de manual sobre select,cont
testes.
Embora os testes longos ou seletivos sejam ótimos, você provavelmente ainda deve realizar os testes de avaliação curtos ou gerais. Eles levam pouco tempo e podem ajudar a detectar problemas gerais.
Responder2
Configuramos todos os nossos servidores para executar autotestes regulares com a seguinte linha /etc/smartd.conf
:
# DEVICESCAN matches all hard disks found in /dev/ and applies the following
# options to them.
#
# Default options from Debian:
# -d removable don't exit when the device when a device vanishes
# -n standby don't wake a device up that is sleeping
# -m root send error reports to root
# -M exec ... pipe the mail through that script
#
# Our options:
# -s L/../02/./17 run a long selftest on every 2nd of every month
# at 17 o'clock
DEVICESCAN -d removable -n standby -m root -M exec /usr/share/smartmontools/smartd-runner -s L/../02/./17
Os autotestes são, IMO, o tipo de verificação de saúde mais confiável que a SMART oferece.
EDITAR:
Você poderia explicar o que
-d removable
faz?
De man smartd.conf
:
removable - the device or its media is removable. This indi‐
cates to smartd that it should continue (instead of exiting,
which is the default behavior) if the device does not appear to
be present when smartd is started. This Directive may be used
in conjunction with the other ´-d´ Directives.
Presumo que evita smartd
a morte quando um dos discos monitorados desaparece...? Não tenho certeza, apenas adicionei a -s L/../02/./17
parte a essa linha. A linha original:
DEVICESCAN -d removable -n standby -m root -M exec /usr/share/smartmontools/smartd-runner
é o padrão do Debian.
Responder3
# DEVICESCAN For all disks with SMART capabilities.
#
# -o off Turn off automatic running of offline tests. An offline test
# is a test which may degrade performance.
#
# -n standby Do not spin up the disk for the periodic 30 minute (default)
# SMART status polling, instead wait until the disk is active
# again and poll it then.
#
# -W 2 Report temperature changes of at least 2 degrees celsius since
# the last reading. Also report if a new min/max temperature is
# detected.
#
# -S on Auto save attributes such as how long the disk has been powered
# on, min and max disk temperature.
#
# -s (L/../.[02468]/1/04|S/../.[13579]/1/04)
# '-------a--------' '--------b-------'
#
# a: Long test on even monday mornings at 04:00
# b: Short test on uneven monday mornings at 04:00
DEVICESCAN -o off -n standby -W 2 -S on -s (L/../.[02468]/1/04|S/../.[13579]/1/04)
Responder4
Eu normalmente uso essa verificação simples que é definida por unidade e não globalmente por sistema (com DEVICESCAN
opção) - estou interessado no status geral de integridade do SMART e se há alguma realocação de setores pendentes e setores defeituosos desde o último teste SMART. Quaisquer eventos suspeitos são enviados para meu endereço inteligente e abrangente:
/dev/sda -H -C 0 -U 0 -m [email protected]
Em alguns sistemas, defini a execução automática de autotestes SMART em datas específicas. Esta especificação define a execução de testes longos em duas unidades todos os domingos depois da meia-noite (mas não nos mesmos horários - entre meia-noite e 1h e depois a partir das 2h):
/dev/sda -a -s L/../../7/00 -m [email protected]
/dev/sdb -a -s L/../../7/02 -m [email protected]