Tuesday, 22 December 2015

Hdparm, Load_Cycle_Count and Samsung HM641JI and Seagate ST320LT022

Previously i have written about controlling the increment of load cycle count of my Samsung harddrive running Fedora and LMDE. In this post, i must admit i have included many redundant steps to tune the harddrive setting  to control Load_Cycle_Count.

In this series, i am writing further about controlling the load cycle count of my external Seagate harddrive to ensure that the harddrive do not suffer an early death.

In this first section, i am running OpenSUSE Leap 42.1 on my external Seagate harddrive. As this new hybrid consumer-enterprise distribution (i.e OpenSUSE Leap) works like Fedora (another RPM-based dristribution), I created a systemd service named hdsilence.service to run at boot up. This service allows me to spin down my idling internal harddrive and keep my external harddrive spinning. To refresh our memory, we execute the command :

ls /dev/disk/by-id/*  

to retrieve the model and serial of all harddrives attached to our workstation.

Below is the contents of hdsilence.service:

[Unit]
Description=Silence HD
After=suspend.target

[Service]
Type=oneshot
# Disable automatic head parking for the main disk
ExecStart=/sbin/hdparm -B 254 -S 251 /dev/disk/by-id/ata-Seagate_Model_Serial
# Enable automatic spin down after 30 seconds for the second, infrequently used disk
ExecStart=/sbin/hdparm -B 127 -S 12 /dev/disk/by-id/ata-Samsung_Model_Serial

[Install]
WantedBy=suspend.target basic.target


To get a sense of the syntax of systemd service, you may refer to archlinux Archwiki (https://wiki.archlinux.org/index.php/Systemd) which provides a comprehensive introduction to systemd. I am sure this article is interesting for beginners and experienced linux users :)

In the second section, i am running Ubuntu and Sparkylinux on my external Seagate harddrive.

I edited hdparm.conf in the directory /etc/hdparm.conf as advised in the previous post.

The edited hdparm.conf includes the following details:

# Root file systems.  Please see README.Debian for details
ROOTFS = /dev/disk/by-id/ata-Samsung_Model_Serial


/dev/disk/by-id/ata-Samsung_Model_Serial {
     apm = 254
     spindown_time = 251
#    dma = on
}


Notice that the dma option is commented (with #). You may experiment with uncommenting it ( by removing #) with caution as it work on some workstations but not on mine.
In addition, i created a new rule called 50-hdparm.rules in /etc/udev/rules.d.

50-hdparm.rules include one statement for putting my idling Samsung harddrive to sleep that is similar to hdsilence.service and keeping my working external Seagate harddrive chugging along. 

50-hdparm.rules shall include the following statements:

ACTION=="add", SUBSYSTEM=="block", KERNEL=="sdb", RUN+="/usr/sbin/hdparm -B 254 --prefer-ata12 -S 251 /dev/disk/by-id/ata-Seagate_Model_Serial"

ACTION=="add|change", KERNEL=="sda", ATTR{queue/rotational}=="1", RUN+="/usr/sbin/hdparm -B 127 -S 12 /dev/disk/by-id/ata-Samsung_Model_Serial"



To ensure that the load cycle count is managed successfully, please check the temperature of the harddrive by running the command:

sudo smartctl -A /dev/disk/by-id/ata-Samsung_Model_Serial | grep -E "Load_Cycle|ID| Power_On|Temp"

The command is used to check Load_Cycle-Count, Power_On_Hours and Temperature_Celsius.

Please be advised that i am not responsible for any system failure in your workstation should you follow my procedures above as different workstations has their own unique settings. You are advised to exercise due diligence before attempting the steps above.

Please feel free to share your experience in tuning your harddrive to avoid harddrive crash.

Follow my blog with Bloglovin

No comments:

Post a Comment

Experimenting with Archlinux on Legacy Bios system

nano /etc/wpa_suppplicant/wpa_supplicant.conf    ctrl_interface=/run/wpa_supplicant    update_config=1 wpa_supplicant -B -i wlan0 -c /e...