Jika Anda seorang administrator sistem dan bertanggung jawab untuk mengelola sistem Linux di Pusat Data. Kemudian, disarankan untuk memeriksa kesehatan drive SSD dan HDD secara teratur. Ini akan membantu Anda mengidentifikasi drive yang gagal dan drive tersebut dapat diganti sebelum terjadi kehilangan data. S.M.A.R.T adalah alat yang digunakan untuk memantau status kesehatan SSD dan HDD. Ini juga memungkinkan Anda melakukan pengujian sesuai permintaan pada drive.
Dalam postingan ini, kami akan menunjukkan cara memeriksa kesehatan SSD dan HDD di Linux.
Prasyarat
- Server atau Desktop yang menjalankan sistem operasi Linux.
- Kata sandi root dikonfigurasi di server.
Instal Smartctl
Secara default, Smartctl disertakan dalam repositori default semua distribusi Linux utama.
Untuk distribusi Debian dan Ubuntu, instal Smartctl menggunakan perintah berikut:
apt-get install smartmontools -y
Untuk distribusi RHEL, CentOS, dan Fedora, instal Smartctl menggunakan perintah berikut:
dnf install smartmontools
Setelah menginstal Smartctl, mulai layanan Smartctl menggunakan perintah berikut:
systemctl start smartd
Anda dapat memeriksa status smartd dengan perintah berikut:
systemctl status smartd
Anda akan mendapatkan output berikut:
? smartmontools.service - Self Monitoring and Reporting Technology (SMART) Daemon Loaded: loaded (/lib/systemd/system/smartmontools.service; enabled; vendor preset: enabled) Active: active (running) since Fri 2021-07-02 08:58:33 UTC; 11s ago Docs: man:smartd(8) man:smartd.conf(5) Main PID: 1042 (smartd) Status: "Next check of 0 devices will start at 09:28:33" Tasks: 1 (limit: 2353) Memory: 1.2M CGroup: /system.slice/smartmontools.service ??1042 /usr/sbin/smartd -n Jul 02 08:58:33 ubuntu2004 smartd[1042]: Device: /dev/sda, opened Jul 02 08:58:33 ubuntu2004 smartd[1042]: Device: /dev/sda, [QEMU QEMU HARDDISK 2.5+], 53.6 GB Jul 02 08:58:33 ubuntu2004 smartd[1042]: Device: /dev/sda, IE (SMART) not enabled, skip device Jul 02 08:58:33 ubuntu2004 smartd[1042]: Try 'smartctl -s on /dev/sda' to turn on SMART features Jul 02 08:58:33 ubuntu2004 smartd[1042]: Device: /dev/sdb, opened Jul 02 08:58:33 ubuntu2004 smartd[1042]: Device: /dev/sdb, [AN Volume 2.5+], S/N: sdb, 53.6 GB Jul 02 08:58:33 ubuntu2004 smartd[1042]: Device: /dev/sdb, IE (SMART) not enabled, skip device Jul 02 08:58:33 ubuntu2004 smartd[1042]: Try 'smartctl -s on /dev/sdb' to turn on SMART features Jul 02 08:58:33 ubuntu2004 smartd[1042]: Monitoring 0 ATA/SATA, 0 SCSI/SAS and 0 NVMe devices Jul 02 08:58:33 ubuntu2004 systemd[1]: Started Self Monitoring and Reporting Technology (SMART) Daemon.
Uji Kesehatan SSD/HDD
Setelah menginstal Smartctl, Anda perlu mengaktifkan fitur SMART di hard drive Anda.
Anda dapat melakukannya dengan menggunakan perintah berikut:
smartctl -s on /dev/sda
Hal pertama yang perlu Anda lakukan adalah mendapatkan informasi tentang SSD atau HDD.
Anda dapat melakukannya dengan menggunakan perintah berikut:
smartctl -i /dev/sda
Ini akan memberi Anda informasi mendetail tentang hard drive Anda.
smartctl 6.2 2013-07-26 r3841 [x86_64-linux-4.4.0-148-generic] (local build) Copyright (C) 2002-13, Bruce Allen, Christian Franke, www.smartmontools.org === START OF INFORMATION SECTION === Device Model: WDC WD5000LPVX-75V0TT0 Serial Number: WXV1EC4KN2N7 LU WWN Device Id: 5 0014ee 65af65611 Firmware Version: 01.01A01 User Capacity: 500,107,862,016 bytes [500 GB] Sector Sizes: 512 bytes logical, 4096 bytes physical Rotation Rate: 5400 rpm Device is: Not in smartctl database [for details use: -P showall] ATA Version is: ACS-2 (minor revision not indicated) SATA Version is: SATA 3.0, 6.0 Gb/s (current: 3.0 Gb/s) Local Time is: Fri Jul 2 14:39:33 2021 IST SMART support is: Available - device has SMART capability. SMART support is: Enabled
Jika Anda ingin melakukan tes singkat pada drive, jalankan perintah berikut:
smartctl -t short -a /dev/sda
Anda akan mendapatkan output berikut:
smartctl 6.2 2013-07-26 r3841 [x86_64-linux-4.4.0-148-generic] (local build) Copyright (C) 2002-13, Bruce Allen, Christian Franke, www.smartmontools.org === START OF INFORMATION SECTION === Device Model: WDC WD5000LPVX-75V0TT0 Serial Number: WXV1EC4KN2N7 LU WWN Device Id: 5 0014ee 65af65611 Firmware Version: 01.01A01 User Capacity: 500,107,862,016 bytes [500 GB] Sector Sizes: 512 bytes logical, 4096 bytes physical Rotation Rate: 5400 rpm Device is: Not in smartctl database [for details use: -P showall] ATA Version is: ACS-2 (minor revision not indicated) SATA Version is: SATA 3.0, 6.0 Gb/s (current: 3.0 Gb/s) Local Time is: Fri Jul 2 14:40:23 2021 IST 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: (0x00) Offline data collection activity was never started. 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: ( 9360) seconds. Offline data collection capabilities: (0x7b) SMART execute Offline immediate. Auto Offline data collection on/off support.
Tes singkat akan menguji Sifat Listrik, Sifat Mekanik, dan Baca/Verifikasi.
Untuk menemukan dan mencetak hasil swauji, jalankan perintah berikut:
smartctl -l selftest /dev/sda
Anda akan mendapatkan output berikut:
smartctl 6.2 2013-07-26 r3841 [x86_64-linux-4.4.0-148-generic] (local build) Copyright (C) 2002-13, Bruce Allen, Christian Franke, www.smartmontools.org === START OF READ SMART DATA SECTION === 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% 7609 - # 2 Short offline Interrupted (host reset) 90% 6972 - # 3 Short offline Aborted by host 70% 6972 - # 4 Short offline Interrupted (host reset) 70% 2 -
Untuk menjalankan pengujian panjang, gunakan perintah berikut:
smartctl -t long -a /dev/sda
Anda akan mendapatkan output berikut:
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. === START OF OFFLINE IMMEDIATE AND SELF-TEST SECTION === Sending command: "Execute SMART Extended self-test routine immediately in off-line mode". Drive command "Execute SMART Extended self-test routine immediately in off-line mode" successful. Testing has begun. Please wait 107 minutes for test to complete. Test will complete after Fri Jul 2 16:30:41 2021 Use smartctl -X to abort test.
Tes panjang akan menguji semua yang disertakan dengan tes singkat.
Anda dapat menghentikan pengujian, jalankan perintah berikut:
smartctl -X /dev/sda
Anda akan melihat output berikut:
smartctl 6.2 2013-07-26 r3841 [x86_64-linux-4.4.0-148-generic] (local build) Copyright (C) 2002-13, Bruce Allen, Christian Franke, www.smartmontools.org === START OF OFFLINE IMMEDIATE AND SELF-TEST SECTION === Sending command: "Abort SMART off-line mode self-test routine". Self-testing aborted!
Untuk menguji kesehatan drive secara keseluruhan, jalankan perintah berikut:
smartctl -d ata -H /dev/sda
Anda akan mendapatkan output berikut:
smartctl 6.2 2013-07-26 r3841 [x86_64-linux-4.4.0-148-generic] (local build) Copyright (C) 2002-13, Bruce Allen, Christian Franke, www.smartmontools.org === START OF READ SMART DATA SECTION === SMART overall-health self-assessment test result: PASSED
Untuk memeriksa perkiraan waktu untuk melakukan pengujian, jalankan perintah berikut:
smartctl -c /dev/sda
Anda akan mendapatkan output berikut:
smartctl 6.2 2013-07-26 r3841 [x86_64-linux-4.4.0-148-generic] (local build) Copyright (C) 2002-13, Bruce Allen, Christian Franke, www.smartmontools.org === START OF READ SMART DATA SECTION === General SMART Values: Offline data collection status: (0x00) Offline data collection activity was never started. Auto Offline Data Collection: Disabled. Self-test execution status: ( 25) The self-test routine was aborted by the host. Total time to complete Offline data collection: ( 9360) 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: ( 107) minutes. Conveyance self-test routine recommended polling time: ( 5) minutes. SCT capabilities: (0x7035) SCT Status supported. SCT Feature Control supported. SCT Data Table supported.
Untuk mencetak hanya log kesalahan, jalankan perintah berikut:
smartctl -l error /dev/sda
Untuk mendapatkan informasi bantuan, jalankan perintah berikut:
smartctl --help
Kesimpulan
Dalam panduan di atas, Anda mempelajari cara menginstal dan menggunakan alat S.M.A.R.T untuk memeriksa kesehatan drive SSH dan HDD Anda. Saya harap ini akan banyak membantu Anda. Untuk informasi lebih lanjut, baca halaman manual smartctl.