From e7474567be0fcb8c362336cf694be94292ec6be6 Mon Sep 17 00:00:00 2001 From: rkdevi27 <54701695+rkdevi27@users.noreply.github.com> Date: Thu, 30 Apr 2020 05:40:18 +0530 Subject: [PATCH] ssd_mitigation_changes (#829) * ssd_mitigation_changes * ssd_mitigation_changes * ssd_mitigation_changes --- scripts/fast-reboot | 7 +++++++ scripts/log_ssd_health | 7 +++++++ setup.py | 1 + 3 files changed, 15 insertions(+) create mode 100755 scripts/log_ssd_health diff --git a/scripts/fast-reboot b/scripts/fast-reboot index 4313af5d0ab2..ec0ccae1b784 100755 --- a/scripts/fast-reboot +++ b/scripts/fast-reboot @@ -16,6 +16,7 @@ ASSISTANT_SCRIPT="/usr/bin/neighbor_advertiser" DEVPATH="/usr/share/sonic/device" PLATFORM=$(sonic-cfggen -H -v DEVICE_METADATA.localhost.platform) PLATFORM_PLUGIN="${REBOOT_TYPE}_plugin" +LOG_SSD_HEALTH="/usr/bin/log_ssd_health" # Require 100M available on the hard drive for warm reboot temp files, # Size is in 1K blocks: @@ -424,6 +425,12 @@ fi # service will go down and we cannot recover from it. set +e +if [ -x ${LOG_SSD_HEALTH} ]; then + debug "Collecting logs to check ssd health before fast-reboot..." + ${LOG_SSD_HEALTH} +fi + + # Kill nat docker after saving the conntrack table debug "Stopping nat ..." /usr/bin/dump_nat_entries.py diff --git a/scripts/log_ssd_health b/scripts/log_ssd_health new file mode 100755 index 000000000000..f0055f80f321 --- /dev/null +++ b/scripts/log_ssd_health @@ -0,0 +1,7 @@ +#! /bin/bash + +smartctl -a /dev/sda > /tmp/smartctl +if [ -f /tmp/smartctl ];then + logger -f /tmp/smartctl +fi + diff --git a/setup.py b/setup.py index f2abbefc3876..2924566c7d81 100644 --- a/setup.py +++ b/setup.py @@ -79,6 +79,7 @@ 'scripts/intfutil', 'scripts/intfstat', 'scripts/lldpshow', + 'scripts/log_ssd_health', 'scripts/mmuconfig', 'scripts/natclear', 'scripts/natconfig',