• Home
  • NW
  • Kultúra
  • Šport
  • Fun
  • Linux
  • Download

Asus A6TC

  • Ubuntu 8.04
  • Gigabit LAN
  • Disk

Network

  • IP config
  • Firewall
  • SSH tunnel
  • TIPS
  • SSH tunnel advanced

Server basics

  • LVM with EXT3

Linky kámošov

  • Sacie-komando

Linky školy

  • Diplomovka
  • STU FEI KTL
  • STU FEI

Linky in-line

  • Zakkaz
  • Be-mag

Na pobavenie

  • Najstaršia stránka
LINUX » ASUSA6TCDISK

Problem with disk (too many load cycle counts)

The S.M.A.R.T. attributes are specific properties (parameters) of various parts of a disk. S.M.A.R.T. uses attributes to monitor the disk condition and to analyze its reliability (e.g.: the "Temperature" attribute indicates the temperature of the hard disk, the "Power-On Hours" attribute indicates the count of hours in a power-on state, etc.).

S.M.A.R.T. is used also for power management on notebooks. When the disk is inactive for long time, it should stop it to prevent battery wasting. Default Ubuntu 8.04 installation uses very aggressive power management, whitch try park heads of disk very often (many times per second). This can cause destruction of the disk. In order to avoid this issue, you can change power management value on disk to bigger one (the bigger the less aggressive is the power management). Value 0 means that it tries to stop disk as many times as possible, value 255 meand that the power management is stopped. Default installation of Ubuntu 8.04 set this value to zero, but it does not behave corectly. Even when you are working with your notebook you can hear jerk noise comming from you harddrive. To correct this bug, I have set apm (advanced power management) value of disk to 192.

1. Install smartmontools for checking the disk and watch the load_cycle_count value for few minutes, it will rise rapidly:
root@roleta:/# apt-get install smartmontools
Reading package lists... Done
Building dependency tree       
Reading state information... Done
smartmontools is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
root@roleta:/# fdisk -l

Disk /dev/sda: 100.0 GB, 100030242816 bytes
255 heads, 63 sectors/track, 12161 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x000998c5

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1       12161    97683201   83  Linux
root@roleta:/# smartctl -d ata -a /dev/sda1| grep Load_Cycle_Count| awk {'print $10'};
26244
root@roleta:/# 
2. Change apm value of disk:
hdparm -B 192 /dev/sda
3. Modify hdaprm initial script /etc/hdparm.conf to make this change happend everytime Ubuntu is starting:
## This is the default configuration for hdparm for Debian.  It is a 
## rather simple script, so please follow the following guidelines :)
## Any line that begins with a comment is ignored - add as many as you 
## like.  Note that an in-line comment is not supported.  If a line 
## consists of whitespace only (tabs, spaces, carriage return), it will be
## ignored, so you can space control fields as you like.  ANYTHING ELSE
## IS PARSED!!  This means that lines with stray characters or lines that 
## use non # comment characters will be interpreted by the initscript.  
## This has probably minor, but potentially serious, side effects for your 
## hard drives, so please follow the guidelines.  Patches to improve 
## flexibilty welcome.  Please read /usr/share/doc/hdparm/README.Debian for 
## notes about known issues, especially if you have an MD array.
##
## Note that if the init script causes boot problems, you can pass 'nohdparm' 
## on the kernel command line, and the script will not be run.
##
## Uncommenting the options below will cause them to be added to the DEFAULT
## string which is prepended to options listed in the blocks below.
##
## If an option is listed twice, the second instance replaces the first.
##
## /sbin/hdparm is not run unless a block of the form:
##      DEV {
##         option
##         option
##         ...
##      }
## exists.  This blocks will cause /sbin/hdparm OPTIONS DEV to be run.
## Where OPTIONS is the concatenation of all options previously defined
## outside of a block and all options defined with in the block.

# -q be quiet
quiet 
# -a sector count for filesystem read-ahead
#read_ahead_sect = 12
# -A disable/enable the IDE drive's read-lookahead feature
#lookahead = on
# -b bus state
#bus = on
# -B apm setting
#apm = 255
# -c enable (E)IDE 32-bit I/O support - can be any of 0,1,3
#io32_support = 1
# -d disable/enable the "using_dma" flag for this drive
#dma = off
# -D enable/disable the on-drive defect management
#defect_mana = off
# -E cdrom speed
#cd_speed = 16
# -k disable/enable the "keep_settings_over_reset" flag for this drive
#keep_settings_over_reset = off
# -K disable/enable the drive's "keep_features_over_reset" flag
#keep_features_over_reset = on
# -m sector count for multiple sector I/O
#mult_sect_io = 32
# -P maximum sector count for the drive's internal prefetch mechanism
#prefetch_sect = 12
# -r read-only flag for device
#read_only = off
# -s Turn on/off power on in standby mode
#poweron_standby = off
# -S standby (spindown) timeout for the drive
#spindown_time = 24
# -u interrupt-unmask flag for the drive
#interrupt_unmask = on
# -W Disable/enable the IDE drive's write-caching feature
#write_cache = off
# -X IDE transfer mode for newer (E)IDE/ATA2 drives
#transfer_mode = 34
# -y force to immediately enter the standby mode
#standby
# -Y force to immediately enter the sleep mode
#sleep
# -Z Disable the power-saving function of certain Seagate drives
#disable_seagate
# -M Set the acoustic management properties of a drive
#acoustic_management
# -p Set the chipset PIO mode
# chipset_pio_mode
# --security-freeze Freeze the drive's security status
# security_freeze
# --security-unlock Unlock the drive's security
# security_unlock = PWD
# --security-set-pass Set security password
# security_pass = password
# --security-disable Disable drive locking
# security_disable
# --user-master Select password to use
# user-master = u
# --security-mode Set the security mode
# security_mode = h

# Root file systems.  Please see README.Debian for details
# ROOTFS = /dev/hda

## New note - you can use straight hdparm commands in this config file 
## as well - the set up is ugly, but it keeps backwards compatibility
## Additionally, it should be noted that any blocks that begin with 
## the keyword 'command_line' are not run until after the root filesystem
## is mounted.  This is done to avoid running blocks twice.  If you need 
## to run hdparm to set parameters for your root disk, please use the 
## standard format.

#Samples follow:
#First three are good for devfs systems, fourth one for systems that do 
#not use devfs.  The fifth example uses straight hdparm command line
#syntax.  Any of the blocks that use command line syntax must begin with
#the keyword 'command_line', and no attempt is made to validate syntax.  
#It is provided for those more comfortable with hdparm syntax. 

#/dev/discs/disc0/disc {
#    mult_sect_io = 16
#    write_cache = off
#    spindown_time = 240
#}

#/dev/discs/disc1/disc {
#    mult_sect_io = 32
#    spindown_time = 36
#    write_cache = off
#}

#/dev/cdroms/cdrom0 {
#    dma = on           
#    interrupt_unmask = on
#    io32_support = 0
#}

#/dev/hda {
#    mult_sect_io = 16
#    write_cache = off
#    dma = on
#}

#command_line {
#       hdparm -q -m16 -q -W0 -q -d1 /dev/hda
#}

command_line {
#       hdparm -q -m16 -q -W0 -q -d1 /dev/hda

#hdparm -B 255 /dev/hdc
hdparm -B 192 /dev/sda
}

What we made, avoid only when notebook runs only on battery, or only on AC. When it switched to battery or to AC, it will try to park heads of disk again. To avoid this we have to modify acpi settings.

4. Use vi to create file /etc/acpi/99-hdd-spin-fix.sh containing:
#!/bin/sh
hdparm -B 192 /dev/sda
5. Change permission of this file to make it executable :

t@roleta:/# ll /etc/acpi/99-hdd-spin-fix.sh
-rw-r--r-- 1 root root 33 2008-07-17 01:24 /etc/acpi/99-hdd-spin-fix.sh
root@roleta:/# chmod 755 /etc/acpi/99-hdd-spin-fix.sh
root@roleta:/# ll /etc/acpi/99-hdd-spin-fix.sh
-rwxr-xr-x 1 root root 33 2008-07-17 01:24 /etc/acpi/99-hdd-spin-fix.sh
root@roleta:/# 
6. Copy that file to three places: start.d, suspend.d and resume.d:
root@roleta:/# cp /etc/acpi/99-hdd-spin-fix.sh /etc/acpi/start.d
root@roleta:/# cp /etc/acpi/99-hdd-spin-fix.sh /etc/acpi/suspend.d
root@roleta:/# cp /etc/acpi/99-hdd-spin-fix.sh /etc/acpi/resume.d
7. After hours of running my notebook the load cycle count value of my disk is the same, so it is o.k.:
root@roleta:/# smartctl -d ata -a /dev/sda1| grep Load_Cycle_Count| awk {'print $10'};
26244
root@roleta:/# 

Some content copyright © 2008 find on facebook , some rights reserved, feel free to share "opensource" way of thinking. Layout created at CSSWebLayouts
Legal | Privacy Policy | Contact