€•ÅTŒsphinx.addnodes”Œdocument”“”)”}”(Œ rawsource”Œ”Œchildren”]”(Œ translations”Œ LanguagesNode”“”)”}”(hhh]”(hŒ pending_xref”“”)”}”(hhh]”Œdocutils.nodes”ŒText”“”ŒChinese (Simplified)”…””}”Œparent”hsbaŒ attributes”}”(Œids”]”Œclasses”]”Œnames”]”Œdupnames”]”Œbackrefs”]”Œ refdomain”Œstd”Œreftype”Œdoc”Œ reftarget”Œ=/translations/zh_CN/admin-guide/laptops/disk-shock-protection”Œmodname”NŒ classname”NŒ refexplicit”ˆuŒtagname”hhh ubh)”}”(hhh]”hŒChinese (Traditional)”…””}”hh2sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ=/translations/zh_TW/admin-guide/laptops/disk-shock-protection”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒItalian”…””}”hhFsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ=/translations/it_IT/admin-guide/laptops/disk-shock-protection”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒJapanese”…””}”hhZsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ=/translations/ja_JP/admin-guide/laptops/disk-shock-protection”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒKorean”…””}”hhnsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ=/translations/ko_KR/admin-guide/laptops/disk-shock-protection”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒSpanish”…””}”hh‚sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ=/translations/sp_SP/admin-guide/laptops/disk-shock-protection”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubeh}”(h]”h ]”h"]”h$]”h&]”Œcurrent_language”ŒEnglish”uh1h hhŒ _document”hŒsource”NŒline”NubhŒsection”“”)”}”(hhh]”(hŒtitle”“”)”}”(hŒHard disk shock protection”h]”hŒHard disk shock protection”…””}”(hh¨hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h¦hh£hžhhŸŒW/var/lib/git/docbuild/linux/Documentation/admin-guide/laptops/disk-shock-protection.rst”h KubhŒ paragraph”“”)”}”(hŒ*Author: Elias Oltmanns ”h]”(hŒAuthor: Elias Oltmanns <”…””}”(hh¹hžhhŸNh NubhŒ reference”“”)”}”(hŒeo@nebensachen.de”h]”hŒeo@nebensachen.de”…””}”(hhÃhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”Œrefuri”Œmailto:eo@nebensachen.de”uh1hÁhh¹ubhŒ>”…””}”(hh¹hžhhŸNh Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h Khh£hžhubh¸)”}”(hŒLast modified: 2008-10-03”h]”hŒLast modified: 2008-10-03”…””}”(hhÝhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h Khh£hžhubhŒcomment”“”)”}”(hŒ?0. Contents 1. Intro 2. The interface 3. References 4. CREDITS”h]”hŒ?0. Contents 1. Intro 2. The interface 3. References 4. CREDITS”…””}”hhísbah}”(h]”h ]”h"]”h$]”h&]”Œ xml:space”Œpreserve”uh1hëhh£hžhhŸh¶h Kubh¢)”}”(hhh]”(h§)”}”(hŒ1. Intro”h]”hŒ1. Intro”…””}”(hjhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h¦hhýhžhhŸh¶h Kubh¸)”}”(hX1ATA/ATAPI-7 specifies the IDLE IMMEDIATE command with unload feature. Issuing this command should cause the drive to switch to idle mode and unload disk heads. This feature is being used in modern laptops in conjunction with accelerometers and appropriate software to implement a shock protection facility. The idea is to stop all I/O operations on the internal hard drive and park its heads on the ramp when critical situations are anticipated. The desire to have such a feature available on GNU/Linux systems has been the original motivation to implement a generic disk head parking interface in the Linux kernel. Please note, however, that other components have to be set up on your system in order to get disk shock protection working (see section 3. References below for pointers to more information about that).”h]”hX1ATA/ATAPI-7 specifies the IDLE IMMEDIATE command with unload feature. Issuing this command should cause the drive to switch to idle mode and unload disk heads. This feature is being used in modern laptops in conjunction with accelerometers and appropriate software to implement a shock protection facility. The idea is to stop all I/O operations on the internal hard drive and park its heads on the ramp when critical situations are anticipated. The desire to have such a feature available on GNU/Linux systems has been the original motivation to implement a generic disk head parking interface in the Linux kernel. Please note, however, that other components have to be set up on your system in order to get disk shock protection working (see section 3. References below for pointers to more information about that).”…””}”(hjhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h Khhýhžhubeh}”(h]”Œintro”ah ]”h"]”Œ1. intro”ah$]”h&]”uh1h¡hh£hžhhŸh¶h Kubh¢)”}”(hhh]”(h§)”}”(hŒ2. The interface”h]”hŒ2. The interface”…””}”(hj'hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h¦hj$hžhhŸh¶h K%ubh¸)”}”(hX¼For each ATA device, the kernel exports the file `block/*/device/unload_heads` in sysfs (here assumed to be mounted under /sys). Access to `/sys/block/*/device/unload_heads` is denied with -EOPNOTSUPP if the device does not support the unload feature. Otherwise, writing an integer value to this file will take the heads of the respective drive off the platter and block all I/O operations for the specified number of milliseconds. When the timeout expires and no further disk head park request has been issued in the meantime, normal operation will be resumed. The maximal value accepted for a timeout is 30000 milliseconds. Exceeding this limit will return -EOVERFLOW, but heads will be parked anyway and the timeout will be set to 30 seconds. However, you can always change a timeout to any value between 0 and 30000 by issuing a subsequent head park request before the timeout of the previous one has expired. In particular, the total timeout can exceed 30 seconds and, more importantly, you can cancel a previously set timeout and resume normal operation immediately by specifying a timeout of 0. Values below -2 are rejected with -EINVAL (see below for the special meaning of -1 and -2). If the timeout specified for a recent head park request has not yet expired, reading from `/sys/block/*/device/unload_heads` will report the number of milliseconds remaining until normal operation will be resumed; otherwise, reading the unload_heads attribute will return 0.”h]”(hŒ1For each ATA device, the kernel exports the file ”…””}”(hj5hžhhŸNh NubhŒtitle_reference”“”)”}”(hŒ`block/*/device/unload_heads`”h]”hŒblock/*/device/unload_heads”…””}”(hj?hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j=hj5ubhŒ= in sysfs (here assumed to be mounted under /sys). Access to ”…””}”(hj5hžhhŸNh Nubj>)”}”(hŒ"`/sys/block/*/device/unload_heads`”h]”hŒ /sys/block/*/device/unload_heads”…””}”(hjQhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j=hj5ubhXW is denied with -EOPNOTSUPP if the device does not support the unload feature. Otherwise, writing an integer value to this file will take the heads of the respective drive off the platter and block all I/O operations for the specified number of milliseconds. When the timeout expires and no further disk head park request has been issued in the meantime, normal operation will be resumed. The maximal value accepted for a timeout is 30000 milliseconds. Exceeding this limit will return -EOVERFLOW, but heads will be parked anyway and the timeout will be set to 30 seconds. However, you can always change a timeout to any value between 0 and 30000 by issuing a subsequent head park request before the timeout of the previous one has expired. In particular, the total timeout can exceed 30 seconds and, more importantly, you can cancel a previously set timeout and resume normal operation immediately by specifying a timeout of 0. Values below -2 are rejected with -EINVAL (see below for the special meaning of -1 and -2). If the timeout specified for a recent head park request has not yet expired, reading from ”…””}”(hj5hžhhŸNh Nubj>)”}”(hŒ"`/sys/block/*/device/unload_heads`”h]”hŒ /sys/block/*/device/unload_heads”…””}”(hjchžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j=hj5ubhŒ– will report the number of milliseconds remaining until normal operation will be resumed; otherwise, reading the unload_heads attribute will return 0.”…””}”(hj5hžhhŸNh Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h K'hj$hžhubh¸)”}”(hŒyFor example, do the following in order to park the heads of drive /dev/sda and stop all I/O operations for five seconds::”h]”hŒxFor example, do the following in order to park the heads of drive /dev/sda and stop all I/O operations for five seconds:”…””}”(hj{hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h K>hj$hžhubhŒ literal_block”“”)”}”(hŒ0# echo 5000 > /sys/block/sda/device/unload_heads”h]”hŒ0# echo 5000 > /sys/block/sda/device/unload_heads”…””}”hj‹sbah}”(h]”h ]”h"]”h$]”h&]”hûhüuh1j‰hŸh¶h KAhj$hžhubh¸)”}”(hŒ A simple::”h]”hŒ A simple:”…””}”(hj™hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h KChj$hžhubjŠ)”}”(hŒ(# cat /sys/block/sda/device/unload_heads”h]”hŒ(# cat /sys/block/sda/device/unload_heads”…””}”hj§sbah}”(h]”h ]”h"]”h$]”h&]”hûhüuh1j‰hŸh¶h KEhj$hžhubh¸)”}”(hŒUwill show you how many milliseconds are left before normal operation will be resumed.”h]”hŒUwill show you how many milliseconds are left before normal operation will be resumed.”…””}”(hjµhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h KGhj$hžhubh¸)”}”(hXeA word of caution: The fact that the interface operates on a basis of milliseconds may raise expectations that cannot be satisfied in reality. In fact, the ATA specs clearly state that the time for an unload operation to complete is vendor specific. The hint in ATA-7 that this will typically be within 500 milliseconds apparently has been dropped in ATA-8.”h]”hXeA word of caution: The fact that the interface operates on a basis of milliseconds may raise expectations that cannot be satisfied in reality. In fact, the ATA specs clearly state that the time for an unload operation to complete is vendor specific. The hint in ATA-7 that this will typically be within 500 milliseconds apparently has been dropped in ATA-8.”…””}”(hjÃhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h KJhj$hžhubh¸)”}”(hXÚThere is a technical detail of this implementation that may cause some confusion and should be discussed here. When a head park request has been issued to a device successfully, all I/O operations on the controller port this device is attached to will be deferred. That is to say, any other device that may be connected to the same port will be affected too. The only exception is that a subsequent head unload request to that other device will be executed immediately. Further operations on that port will be deferred until the timeout specified for either device on the port has expired. As far as PATA (old style IDE) configurations are concerned, there can only be two devices attached to any single port. In SATA world we have port multipliers which means that a user-issued head parking request to one device may actually result in stopping I/O to a whole bunch of devices. However, since this feature is supposed to be used on laptops and does not seem to be very useful in any other environment, there will be mostly one device per port. Even if the CD/DVD writer happens to be connected to the same port as the hard drive, it generally *should* recover just fine from the occasional buffer under-run incurred by a head park request to the HD. Actually, when you are using an ide driver rather than its libata counterpart (i.e. your disk is called /dev/hda instead of /dev/sda), then parking the heads of one drive (drive X) will generally not affect the mode of operation of another drive (drive Y) on the same port as described above. It is only when a port reset is required to recover from an exception on drive Y that further I/O operations on that drive (and the reset itself) will be delayed until drive X is no longer in the parked state.”h]”(hXyThere is a technical detail of this implementation that may cause some confusion and should be discussed here. When a head park request has been issued to a device successfully, all I/O operations on the controller port this device is attached to will be deferred. That is to say, any other device that may be connected to the same port will be affected too. The only exception is that a subsequent head unload request to that other device will be executed immediately. Further operations on that port will be deferred until the timeout specified for either device on the port has expired. As far as PATA (old style IDE) configurations are concerned, there can only be two devices attached to any single port. In SATA world we have port multipliers which means that a user-issued head parking request to one device may actually result in stopping I/O to a whole bunch of devices. However, since this feature is supposed to be used on laptops and does not seem to be very useful in any other environment, there will be mostly one device per port. Even if the CD/DVD writer happens to be connected to the same port as the hard drive, it generally ”…””}”(hjÑhžhhŸNh NubhŒemphasis”“”)”}”(hŒ*should*”h]”hŒshould”…””}”(hjÛhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jÙhjÑubhXY recover just fine from the occasional buffer under-run incurred by a head park request to the HD. Actually, when you are using an ide driver rather than its libata counterpart (i.e. your disk is called /dev/hda instead of /dev/sda), then parking the heads of one drive (drive X) will generally not affect the mode of operation of another drive (drive Y) on the same port as described above. It is only when a port reset is required to recover from an exception on drive Y that further I/O operations on that drive (and the reset itself) will be delayed until drive X is no longer in the parked state.”…””}”(hjÑhžhhŸNh Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h KQhj$hžhubh¸)”}”(hXHFinally, there are some hard drives that only comply with an earlier version of the ATA standard than ATA-7, but do support the unload feature nonetheless. Unfortunately, there is no safe way Linux can detect these devices, so you won't be able to write to the unload_heads attribute. If you know that your device really does support the unload feature (for instance, because the vendor of your laptop or the hard drive itself told you so), then you can tell the kernel to enable the usage of this feature for that drive by writing the special value -1 to the unload_heads attribute::”h]”hXIFinally, there are some hard drives that only comply with an earlier version of the ATA standard than ATA-7, but do support the unload feature nonetheless. Unfortunately, there is no safe way Linux can detect these devices, so you won’t be able to write to the unload_heads attribute. If you know that your device really does support the unload feature (for instance, because the vendor of your laptop or the hard drive itself told you so), then you can tell the kernel to enable the usage of this feature for that drive by writing the special value -1 to the unload_heads attribute:”…””}”(hjóhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h Klhj$hžhubjŠ)”}”(hŒ.# echo -1 > /sys/block/sda/device/unload_heads”h]”hŒ.# echo -1 > /sys/block/sda/device/unload_heads”…””}”hjsbah}”(h]”h ]”h"]”h$]”h&]”hûhüuh1j‰hŸh¶h Kvhj$hžhubh¸)”}”(hŒXwill enable the feature for /dev/sda, and giving -2 instead of -1 will disable it again.”h]”hŒXwill enable the feature for /dev/sda, and giving -2 instead of -1 will disable it again.”…””}”(hjhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h Kxhj$hžhubeh}”(h]”Œ the-interface”ah ]”h"]”Œ2. the interface”ah$]”h&]”uh1h¡hh£hžhhŸh¶h K%ubh¢)”}”(hhh]”(h§)”}”(hŒ 3. References”h]”hŒ 3. References”…””}”(hj(hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h¦hj%hžhhŸh¶h K}ubh¸)”}”(hXxThere are several laptops from different vendors featuring shock protection capabilities. As manufacturers have refused to support open source development of the required software components so far, Linux support for shock protection varies considerably between different hardware implementations. Ideally, this section should contain a list of pointers at different projects aiming at an implementation of shock protection on different systems. Unfortunately, I only know of a single project which, although still considered experimental, is fit for use. Please feel free to add projects that have been the victims of my ignorance.”h]”hXxThere are several laptops from different vendors featuring shock protection capabilities. As manufacturers have refused to support open source development of the required software components so far, Linux support for shock protection varies considerably between different hardware implementations. Ideally, this section should contain a list of pointers at different projects aiming at an implementation of shock protection on different systems. Unfortunately, I only know of a single project which, although still considered experimental, is fit for use. Please feel free to add projects that have been the victims of my ignorance.”…””}”(hj6hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h Khj%hžhubhŒ bullet_list”“”)”}”(hhh]”hŒ list_item”“”)”}”(hŒ«https://www.thinkwiki.org/wiki/HDAPS See this page for information about Linux support of the hard disk active protection system as implemented in IBM/Lenovo Thinkpads. ”h]”(h¸)”}”(hŒ$https://www.thinkwiki.org/wiki/HDAPS”h]”hÂ)”}”(hjQh]”hŒ$https://www.thinkwiki.org/wiki/HDAPS”…””}”(hjShžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”Œrefuri”jQuh1hÁhjOubah}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h KŠhjKubh¸)”}”(hŒƒSee this page for information about Linux support of the hard disk active protection system as implemented in IBM/Lenovo Thinkpads.”h]”hŒƒSee this page for information about Linux support of the hard disk active protection system as implemented in IBM/Lenovo Thinkpads.”…””}”(hjghžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h KŒhjKubeh}”(h]”h ]”h"]”h$]”h&]”uh1jIhjFhžhhŸh¶h Nubah}”(h]”h ]”h"]”h$]”h&]”Œbullet”Œ-”uh1jDhŸh¶h KŠhj%hžhubeh}”(h]”Œ references”ah ]”h"]”Œ 3. references”ah$]”h&]”uh1h¡hh£hžhhŸh¶h K}ubh¢)”}”(hhh]”(h§)”}”(hŒ 4. CREDITS”h]”hŒ 4. CREDITS”…””}”(hjŽhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h¦hj‹hžhhŸh¶h K‘ubh¸)”}”(hXFThis implementation of disk head parking has been inspired by a patch originally published by Jon Escombe . My efforts to develop an implementation of this feature that is fit to be merged into mainline have been aided by various kernel developers, in particular by Tejun Heo and Bartlomiej Zolnierkiewicz.”h]”(hŒkThis implementation of disk head parking has been inspired by a patch originally published by Jon Escombe <”…””}”(hjœhžhhŸNh NubhÂ)”}”(hŒlists@dresco.co.uk”h]”hŒlists@dresco.co.uk”…””}”(hj¤hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”Œrefuri”Œmailto:lists@dresco.co.uk”uh1hÁhjœubhŒÉ>. My efforts to develop an implementation of this feature that is fit to be merged into mainline have been aided by various kernel developers, in particular by Tejun Heo and Bartlomiej Zolnierkiewicz.”…””}”(hjœhžhhŸNh Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h K“hj‹hžhubeh}”(h]”Œcredits”ah ]”h"]”Œ 4. credits”ah$]”h&]”uh1h¡hh£hžhhŸh¶h K‘ubeh}”(h]”Œhard-disk-shock-protection”ah ]”h"]”Œhard disk shock protection”ah$]”h&]”uh1h¡hhhžhhŸh¶h Kubeh}”(h]”h ]”h"]”h$]”h&]”Œsource”h¶uh1hŒcurrent_source”NŒ current_line”NŒsettings”Œdocutils.frontend”ŒValues”“”)”}”(h¦NŒ generator”NŒ datestamp”NŒ source_link”NŒ source_url”NŒ toc_backlinks”Œentry”Œfootnote_backlinks”KŒ sectnum_xform”KŒstrip_comments”NŒstrip_elements_with_classes”NŒ strip_classes”NŒ report_level”KŒ halt_level”KŒexit_status_level”KŒdebug”NŒwarning_stream”NŒ traceback”ˆŒinput_encoding”Œ utf-8-sig”Œinput_encoding_error_handler”Œstrict”Œoutput_encoding”Œutf-8”Œoutput_encoding_error_handler”jñŒerror_encoding”Œutf-8”Œerror_encoding_error_handler”Œbackslashreplace”Œ language_code”Œen”Œrecord_dependencies”NŒconfig”NŒ id_prefix”hŒauto_id_prefix”Œid”Œ dump_settings”NŒdump_internals”NŒdump_transforms”NŒdump_pseudo_xml”NŒexpose_internals”NŒstrict_visitor”NŒ_disable_config”NŒ_source”h¶Œ _destination”NŒ _config_files”]”Œ7/var/lib/git/docbuild/linux/Documentation/docutils.conf”aŒfile_insertion_enabled”ˆŒ raw_enabled”KŒline_length_limit”M'Œpep_references”NŒ pep_base_url”Œhttps://peps.python.org/”Œpep_file_url_template”Œpep-%04d”Œrfc_references”NŒ rfc_base_url”Œ&https://datatracker.ietf.org/doc/html/”Œ tab_width”KŒtrim_footnote_reference_space”‰Œsyntax_highlight”Œlong”Œ smart_quotes”ˆŒsmartquotes_locales”]”Œcharacter_level_inline_markup”‰Œdoctitle_xform”‰Œ docinfo_xform”KŒsectsubtitle_xform”‰Œ image_loading”Œlink”Œembed_stylesheet”‰Œcloak_email_addresses”ˆŒsection_self_link”‰Œenv”NubŒreporter”NŒindirect_targets”]”Œsubstitution_defs”}”Œsubstitution_names”}”Œrefnames”}”Œrefids”}”Œnameids”}”(jËjÈj!jj"jjˆj…jÃjÀuŒ nametypes”}”(jˉj!‰j"‰jˆ‰jÉuh}”(jÈh£jhýjj$j…j%jÀj‹uŒ footnote_refs”}”Œ citation_refs”}”Œ autofootnotes”]”Œautofootnote_refs”]”Œsymbol_footnotes”]”Œsymbol_footnote_refs”]”Œ footnotes”]”Œ citations”]”Œautofootnote_start”KŒsymbol_footnote_start”KŒ id_counter”Œ collections”ŒCounter”“”}”…”R”Œparse_messages”]”Œtransform_messages”]”Œ transformer”NŒ include_log”]”Œ decoration”Nhžhub.