====== Verificar el Disco en FreeBSD-12.1 ====== {{ :informatica:freebsd:discos.jpg?380 | Discos en FreeBSD }} [[https://www.cyberciti.biz/faq/how-to-check-hard-drive-health-on-freebsd/ | Articulo Original en NixCraft]] ¿Cómo leo el estado de mi disco Duro/SSD usando el comando **smartctl** en el sistema operativo FreeBSD? ¿Cómo puedo controlar el estado del disco duro en FreeBSD y averiguar si mi disco está muriendo? El sistema de autocontrol, análisis e informes (SMART) está integrado en la mayoría de los discos duros modernos. El propósito de SMART es monitorear la confiabilidad del disco duro y predecir las fallas del disco, y llevar a cabo diferentes tipos de autocomprobaciones del disco bajo los sistemas operativos FreeBSD. Esta página muestra cómo instalar **smartmontools** en FreeBSD y usar **smartcl** para verificar el estado del disco duro en FreeBSD. ===== Instalar smartmontools en FreeBSD ===== Use el sistema de **ports** de FreeBSD de la siguiente manera para instalar lo mismo: # cd /usr/ports/sysutils/smartmontools # make install clean O uno puede sistema de paquete binario, aunque es mejor compilarlo en la misma máquina. Ejecute el siguiente comando pkg: # pkg install smartmontools El paquete smartmontools contiene dos programas de utilidad para FreeBSD: - Comando **smartctl**: una herramienta de línea de comando para controlar y controlar el estado de los discos duros. - **smartd**: es un demonio de FreeBSD que monitorea el estado de los discos duros y alerta a los usuarios sobre problemas al usar archivos de registro, correo electrónico y más. ===== Cómo verificar el estado del disco duro en FreeBSD ===== La sintaxis es la siguiente para verificar el estado de las unidades: $ smartctl -a /dev/disk Uno puede obtener una lista de todos los discos duros conectados en FreeBSD ejecutando los siguientes comandos: # camcontrol devlist at scbus0 target 0 lun 0 (ada0,pass0) at scbus1 target 0 lun 0 (ada1,pass1) O use el comando **grep** o el comando **egrep** de la siguiente manera: # egrep 'ad[0-9]|cd[0-9]' /var/run/dmesg.boot ===== Controles de estado del disco duro de FreeeBSD ===== Ahora ya conoce el dispositivo de disco duro nombrado en FreeBSD. Por lo tanto, es hora de verificar la información del disco duro, ejecute con privilegios el comando siguiente: # smartctl -i /dev/ada0 smartctl 7.1 2019-12-30 r5022 [FreeBSD 12.1-RELEASE-p7 amd64] (local build) Copyright (C) 2002-19, Bruce Allen, Christian Franke, www.smartmontools.org === START OF INFORMATION SECTION === Model Family: SandForce Driven SSDs Device Model: KINGSTON SHFS37A120G Serial Number: 50026B725801ADE8 LU WWN Device Id: 5 0026b7 25801ade8 Firmware Version: 603ABBF0 User Capacity: 120,034,123,776 bytes [120 GB] Sector Size: 512 bytes logical/physical Rotation Rate: Solid State Device Device is: In smartctl database [for details use: -P show] ATA Version is: ATA8-ACS, ACS-2 T13/2015-D revision 3 SATA Version is: SATA 3.0, 6.0 Gb/s (current: 6.0 Gb/s) Local Time is: Tue Jul 14 20:51:43 2020 -04 SMART support is: Available - device has SMART capability. SMART support is: Enabled Compruebe el estado del disco, ejecute: # smartctl -a /dev/ada0 smartctl 7.1 2019-12-30 r5022 [FreeBSD 12.1-RELEASE-p7 amd64] (local build) Copyright (C) 2002-19, Bruce Allen, Christian Franke, www.smartmontools.org === START OF INFORMATION SECTION === Model Family: SandForce Driven SSDs Device Model: KINGSTON SHFS37A120G Serial Number: 50026B725801ADE8 LU WWN Device Id: 5 0026b7 25801ade8 Firmware Version: 603ABBF0 User Capacity: 120,034,123,776 bytes [120 GB] Sector Size: 512 bytes logical/physical Rotation Rate: Solid State Device Device is: In smartctl database [for details use: -P show] ATA Version is: ATA8-ACS, ACS-2 T13/2015-D revision 3 SATA Version is: SATA 3.0, 6.0 Gb/s (current: 6.0 Gb/s) Local Time is: Tue Jul 14 20:53:51 2020 -04 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: (0x02) Offline data collection activity was completed without error. Auto Offline Data Collection: Disabled. 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: ( 0) seconds. Offline data collection capabilities: (0x7d) SMART execute Offline immediate. No Auto Offline data collection support. Abort 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: ( 1) minutes. Extended self-test routine recommended polling time: ( 48) minutes. Conveyance self-test routine recommended polling time: ( 2) minutes. SCT capabilities: (0x0025) SCT Status supported. SCT Data Table supported. SMART Attributes Data Structure revision number: 10 Vendor Specific SMART Attributes with Thresholds: ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED WHEN_FAILED RAW_VALUE 1 Raw_Read_Error_Rate 0x0032 095 095 050 Old_age Always - 0/149232163 5 Retired_Block_Count 0x0033 100 100 003 Pre-fail Always - 0 9 Power_On_Hours_and_Msec 0x0032 091 091 000 Old_age Always - 8027h+31m+03.420s 12 Power_Cycle_Count 0x0032 100 100 000 Old_age Always - 710 171 Program_Fail_Count 0x000a 100 100 000 Old_age Always - 0 172 Erase_Fail_Count 0x0032 100 100 000 Old_age Always - 0 174 Unexpect_Power_Loss_Ct 0x0030 000 000 000 Old_age Offline - 244 177 Wear_Range_Delta 0x0000 000 000 000 Old_age Offline - 0 181 Program_Fail_Count 0x000a 100 100 000 Old_age Always - 0 182 Erase_Fail_Count 0x0032 100 100 000 Old_age Always - 0 187 Reported_Uncorrect 0x0012 100 100 000 Old_age Always - 0 189 Airflow_Temperature_Cel 0x0000 028 045 000 Old_age Offline - 28 (Min/Max 14/45) 194 Temperature_Celsius 0x0022 028 045 000 Old_age Always - 28 (Min/Max 14/45) 195 ECC_Uncorr_Error_Count 0x001c 120 120 000 Old_age Offline - 0/149232163 196 Reallocated_Event_Count 0x0033 100 100 003 Pre-fail Always - 0 201 Unc_Soft_Read_Err_Rate 0x001c 120 120 000 Old_age Offline - 0/149232163 204 Soft_ECC_Correct_Rate 0x001c 120 120 000 Old_age Offline - 0/149232163 230 Life_Curve_Status 0x0013 100 100 000 Pre-fail Always - 100 231 SSD_Life_Left 0x0000 100 100 011 Old_age Offline - 4294967296 233 SandForce_Internal 0x0032 000 000 000 Old_age Always - 2603 234 SandForce_Internal 0x0032 000 000 000 Old_age Always - 2500 241 Lifetime_Writes_GiB 0x0032 000 000 000 Old_age Always - 2500 242 Lifetime_Reads_GiB 0x0032 000 000 000 Old_age Always - 2140 244 Unknown_Attribute 0x0000 099 099 010 Old_age Offline - 2687016 SMART Error Log not supported 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% 7165 - 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. ===== Configurar smartd para recibir alertas por correo electrónico ===== Edite el archivo de la siguiente manera usando el comando vi o vim, ocualquier editor: # cd /usr/local/etc # cp smartd.conf.sample smartd.conf # vim smartd.conf Primero, comente o elimine todas las líneas DEVICESCAN: # DEVICESCAN A continuación, enumere explícitamente los dispositivos que desea monitorear. Por ejemplo: /dev/ada0 -a -m disk.admin@your-tld Agregue todos sus discos también: /dev/ada1 -a -m disk.admin@your-tld,root@localhost Habilitar el demonio al inicio: # sysrc smartd_enable="YES" ===== Inicie/Detenga/Reinicie el Servicio ===== Para realizar esto debe hacerlo como cualquier servicio: # service smartd start # service smartd stop # service smartd restart # service smartd status ===== Conclusión ===== Esta página explica cómo verificar el estado del disco duro en el sistema operativo FreeBSD usando la herramienta de línea de comando y el servicio **smartd**. Es esencial que siempre mantenga una copia de seguridad de todos los datos críticos. Para más información ver: - [[https://www.cyberciti.biz/tips/linux-find-out-if-harddisk-failing.html | Prueba de Discos SCSI/SATA/SSD]] - [[https://www.smartmontools.org/ | Smartmontools Site]]