My hard drive spin down a lot by default, so I run hdparm -B254 /dev/sda on system start to set the apm level. After resuming from suspend it is reset. Commands to reproduce: $ hdparm -B254 /dev/sda | /dev/sda: | setting Advanced Power Management level to 0xfe (254) | APM_level = 254 $ echo mem > /sys/power/state ...zzzZZZ $ hdparm -B /dev/sda | /dev/sda: | APM_level = 128 I expect to have the same apm that was set. It remains when I make the drive sleep with $ hdparm -Y /dev/sda or $ sdparm --command=stop /dev/sda Environment: ------------ The driver used for sda is sd_mod. ***** dmesg while suspending ************************************* [ 2558.926020] PM: Syncing filesystems ... done. [ 2559.252867] PM: Preparing system for mem sleep [ 2559.253034] Freezing user space processes ... (elapsed 0.001 seconds) done. [ 2559.254772] Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done. [ 2559.255958] PM: Entering mem sleep [ 2559.256003] Suspending console(s) (use no_console_suspend to debug) [ 2559.256523] wlan0: deauthenticating from 00:23:cd:f9:2e:52 by local choice (Reason: 3=DEAUTH_LEAVING) [ 2559.264289] queueing ieee80211 work while going to suspend [ 2559.271069] cfg80211: Exceeded CRDA call max attempts. Not calling CRDA [ 2559.271209] sd 0:0:0:0: [sda] Synchronizing SCSI cache [ 2559.436708] sd 0:0:0:0: [sda] Stopping disk [ 2560.053161] PM: suspend of devices complete after 796.778 msecs [ 2560.066504] PM: late suspend of devices complete after 13.336 msecs [ 2560.067096] ehci-pci 0000:00:1d.7: System wakeup enabled by ACPI [ 2560.067196] uhci_hcd 0000:00:1d.2: System wakeup enabled by ACPI [ 2560.067235] uhci_hcd 0000:00:1d.1: System wakeup enabled by ACPI [ 2560.067282] uhci_hcd 0000:00:1d.0: System wakeup enabled by ACPI [ 2560.067509] ehci-pci 0000:00:1a.7: System wakeup enabled by ACPI [ 2560.067542] uhci_hcd 0000:00:1a.2: System wakeup enabled by ACPI [ 2560.067605] uhci_hcd 0000:00:1a.1: System wakeup enabled by ACPI [ 2560.067628] uhci_hcd 0000:00:1a.0: System wakeup enabled by ACPI [ 2560.079881] PM: noirq suspend of devices complete after 13.372 msecs [ 2560.080028] ACPI: Preparing to enter system sleep state S3 [ 2560.094945] ACPI : EC: EC stopped [ 2560.094946] PM: Saving platform NVS memory [ 2560.095271] Disabling non-boot CPUs ... [ 2560.096659] smpboot: CPU 1 is now offline [ 2560.096916] ACPI: Low-level resume complete [ 2560.096916] ACPI : EC: EC started [ 2560.096916] PM: Restoring platform NVS memory [ 2560.096916] microcode: CPU0 microcode updated early to revision 0xa0b, date = 2010-09-28 [ 2560.096916] Enabling non-boot CPUs ... [ 2560.096916] x86: Booting SMP configuration: [ 2560.096916] smpboot: Booting Node 0 Processor 1 APIC 0x1 [ 2560.096626] microcode: CPU1 microcode updated early to revision 0xa0b, date = 2010-09-28 [ 2560.114963] cache: parent cpu1 should not be sleeping [ 2560.115497] CPU1 is up [ 2560.116590] ACPI: Waking up from system sleep state S3 [ 2560.493779] uhci_hcd 0000:00:1a.0: System wakeup disabled by ACPI [ 2560.493846] uhci_hcd 0000:00:1a.1: System wakeup disabled by ACPI [ 2560.493908] uhci_hcd 0000:00:1a.2: System wakeup disabled by ACPI [ 2560.494212] uhci_hcd 0000:00:1d.0: System wakeup disabled by ACPI [ 2560.494308] uhci_hcd 0000:00:1d.1: System wakeup disabled by ACPI [ 2560.494340] uhci_hcd 0000:00:1d.2: System wakeup disabled by ACPI [ 2560.506601] ehci-pci 0000:00:1a.7: System wakeup disabled by ACPI [ 2560.506944] ehci-pci 0000:00:1d.7: System wakeup disabled by ACPI [ 2560.506992] PM: noirq resume of devices complete after 13.383 msecs [ 2560.507370] PM: early resume of devices complete after 0.329 msecs [ 2560.511488] usb usb1: root hub lost power or was reset [ 2560.511545] usb usb2: root hub lost power or was reset [ 2560.511591] usb usb3: root hub lost power or was reset [ 2560.511793] usb usb4: root hub lost power or was reset [ 2560.511840] usb usb5: root hub lost power or was reset [ 2560.511884] usb usb8: root hub lost power or was reset [ 2560.513006] ath: phy0: ASPM enabled: 0x42 [ 2560.513209] pciehp 0000:00:1c.5:pcie04: Timeout on hotplug command 0x1038 (issued 91526 msec ago) [ 2560.513963] sd 0:0:0:0: [sda] Starting disk [ 2560.616490] pciehp 0000:00:1c.5:pcie04: Device 0000:03:00.0 already exists at 0000:03:00, cannot hot-add [ 2560.616492] pciehp 0000:00:1c.5:pcie04: Cannot add device at 0000:03:00 [ 2560.616609] rtc_cmos 00:01: System wakeup disabled by ACPI [ 2560.836476] usb 4-1: reset full-speed USB device number 2 using uhci_hcd [ 2560.839816] ata2: SATA link up 1.5 Gbps (SStatus 113 SControl 300) [ 2560.841444] ata2.00: ACPI cmd ef/10:06:00:00:00:a0 (SET FEATURES) succeeded [ 2560.841670] ata2.00: ACPI cmd ef/90:03:00:00:00:a0 (SET FEATURES) succeeded [ 2560.844713] ata2.00: ACPI cmd ef/10:06:00:00:00:a0 (SET FEATURES) succeeded [ 2560.844979] ata2.00: ACPI cmd ef/90:03:00:00:00:a0 (SET FEATURES) succeeded [ 2560.846120] ata2.00: configured for UDMA/100 [ 2560.986487] usb 5-1: reset low-speed USB device number 2 using uhci_hcd [ 2561.337432] PM: resume of devices complete after 830.055 msecs [ 2561.338151] PM: Finishing wakeup. [ 2561.338154] Restarting tasks ... done. [ 2562.457051] wlan0: authenticate with 00:23:cd:f9:2e:52 [ 2562.476192] wlan0: send auth to 00:23:cd:f9:2e:52 (try 1/3) [ 2562.478038] wlan0: authenticated [ 2562.478289] ath9k 0000:02:00.0 wlan0: disabling HT as WMM/QoS is not supported by the AP [ 2562.478294] ath9k 0000:02:00.0 wlan0: disabling VHT as WMM/QoS is not supported by the AP [ 2562.479863] wlan0: associate with 00:23:cd:f9:2e:52 (try 1/3) [ 2562.482334] wlan0: RX AssocResp from 00:23:cd:f9:2e:52 (capab=0x431 status=0 aid=1) [ 2562.482906] wlan0: associated [ 2562.486536] ata1: SATA link up 3.0 Gbps (SStatus 123 SControl 300) [ 2562.487453] ata1.00: ACPI cmd f5/00:00:00:00:00:a0 (SECURITY FREEZE LOCK) filtered out [ 2562.487627] ata1.00: ACPI cmd ef/10:06:00:00:00:a0 (SET FEATURES) succeeded [ 2562.487774] ata1.00: ACPI cmd ef/90:03:00:00:00:a0 (SET FEATURES) succeeded [ 2562.489633] ata1.00: ACPI cmd f5/00:00:00:00:00:a0 (SECURITY FREEZE LOCK) filtered out [ 2562.489813] ata1.00: ACPI cmd ef/10:06:00:00:00:a0 (SET FEATURES) succeeded [ 2562.489942] ata1.00: ACPI cmd ef/90:03:00:00:00:a0 (SET FEATURES) succeeded [ 2562.490788] ata1.00: configured for UDMA/133 ************************ end of dmesg ************************************** ********************************* ver_linux output************************** Linux zoli-laptop 4.1.4-1-ARCH #1 SMP PREEMPT Mon Aug 3 21:30:37 UTC 2015 x86_64 GNU/Linux Gnu C 5.2.0 Gnu make 4.1 binutils 2.25.1 util-linux 2.26.2 mount debug module-init-tools 21 e2fsprogs 1.42.12 PPP 2.4.7 Linux C Library Dynamic linker (ldd) 2.21 Linux C++ Library 6.0.21 Procps 3.3.10 Net-tools 2.10-alpha Kbd 2.0.2 Sh-utils 8.24 wireless-tools 30 Modules Loaded rfcomm fuse ctr ccm bnep uvcvideo videobuf2_vmalloc videobuf2_memops videobuf2_core v4l2_common joydev videodev media mousedev iTCO_wdt iTCO_vendor_support btusb btbcm btintel bluetooth snd_hda_codec_via snd_hda_codec_generic pcspkr arc4 snd_hda_intel coretemp snd_hda_controller ath9k snd_hda_codec psmouse snd_hda_core ath9k_common serio_raw ath9k_hw snd_hwdep snd_pcm ath snd_timer mac80211 snd lpc_ich atl1e cfg80211 asus_laptop evdev thermal sparse_keymap led_class rfkill input_polldev mac_hid ac shpchp battery tpm_tis tpm soundcore intel_agp acpi_cpufreq processor ip_tables x_tables ext4 crc16 mbcache jbd2 hid_generic usbhid hid sr_mod cdrom sd_mod atkbd libps2 ahci libahci libata scsi_mod ehci_pci uhci_hcd ehci_hcd usbcore usb_common i8042 serio i915 button intel_gtt i2c_algo_bit video drm_kms_helper drm i2c_core ************************ end of ver_linux output ***************************** *********************** /proc/scsi/scsi ************************************** Attached devices: Host: scsi0 Channel: 00 Id: 00 Lun: 00 Vendor: ATA Model: Hitachi HTS54322 Rev: A60W Type: Direct-Access ANSI SCSI revision: 05 Host: scsi1 Channel: 00 Id: 00 Lun: 00 Vendor: HL-DT-ST Model: DVDRAM GT10N Rev: 1.00 Type: CD-ROM ANSI SCSI revision: 05 ************************ end of /proc/scsi/scsi ****************************** *************************** hdparm -I **************************************** /dev/sda: ATA device, with non-removable media Model Number: Hitachi HTS543225A7A384 Serial Number: E2024242C134XD Firmware Revision: ESBOA60W Transport: Serial, ATA8-AST, SATA 1.0a, SATA II Extensions, SATA Rev 2.5, SATA Rev 2.6; Revision: ATA8-AST T13 Project D1697 Revision 0b Standards: Used: unknown (minor revision code 0x0028) Supported: 8 7 6 5 Likely used: 8 Configuration: Logical max current cylinders 16383 16383 heads 16 16 sectors/track 63 63 -- CHS current addressable sectors: 16514064 LBA user addressable sectors: 268435455 LBA48 user addressable sectors: 488397168 Logical/Physical Sector size: 512 bytes device size with M = 1024*1024: 238475 MBytes device size with M = 1000*1000: 250059 MBytes (250 GB) cache/buffer size = 8192 KBytes (type=DualPortCache) Form Factor: 2.5 inch Nominal Media Rotation Rate: 5400 Capabilities: LBA, IORDY(can be disabled) Queue depth: 32 Standby timer values: spec'd by Vendor, no device specific minimum R/W multiple sector transfer: Max = 16 Current = 0 Advanced power management level: 254 DMA: mdma0 mdma1 mdma2 udma0 udma1 udma2 udma3 udma4 udma5 *udma6 Cycle time: min=120ns recommended=120ns PIO: pio0 pio1 pio2 pio3 pio4 Cycle time: no flow control=120ns IORDY flow control=120ns Commands/features: Enabled Supported: * SMART feature set Security Mode feature set * Power Management feature set * Write cache * Look-ahead * Host Protected Area feature set * WRITE_BUFFER command * READ_BUFFER command * NOP cmd * DOWNLOAD_MICROCODE * Advanced Power Management feature set Power-Up In Standby feature set * SET_FEATURES required to spinup after power up SET_MAX security extension * 48-bit Address feature set * Device Configuration Overlay feature set * Mandatory FLUSH_CACHE * FLUSH_CACHE_EXT * SMART error logging * SMART self-test * General Purpose Logging feature set * WRITE_{DMA|MULTIPLE}_FUA_EXT * 64-bit World wide name * IDLE_IMMEDIATE with UNLOAD * WRITE_UNCORRECTABLE_EXT command * {READ,WRITE}_DMA_EXT_GPL commands * Segmented DOWNLOAD_MICROCODE * Gen1 signaling speed (1.5Gb/s) * Gen2 signaling speed (3.0Gb/s) * Native Command Queueing (NCQ) * Host-initiated interface power management * Phy event counters * NCQ priority information Non-Zero buffer offsets in DMA Setup FIS * DMA Setup Auto-Activate optimization Device-initiated interface power management In-order data delivery * Software settings preservation * SMART Command Transport (SCT) feature set * SCT Write Same (AC2) * SCT Error Recovery Control (AC3) * SCT Features Control (AC4) * SCT Data Tables (AC5) Security: Master password revision code = 65534 supported not enabled not locked frozen not expired: security count supported: enhanced erase 78min for SECURITY ERASE UNIT. 80min for ENHANCED SECURITY ERASE UNIT. Logical Unit WWN Device Identifier: 5000cca68fc0803a NAA : 5 IEEE OUI : 000cca Unique ID : 68fc0803a Checksum: correct ************************** end of hdparm -I **********************************
This is not a bug but rather it's just normal (or at most, hardware-specific) behaviour. I actually wonder if any ATA drives can perserve those settings over power cycle. In my case, my internal SATA SSD preserves the settings over reboot but not poweroff or suspend (yes S3 does cut power down more drastically then reboot AFAIK). In another SATA SSD connected with an USB adapter, the settings are preserved over a poweroff IF I enabled "USB charging in S5" but NOT if have that disabled. Also see this similar issue and my reply if you're interested: https://bugzilla.kernel.org/show_bug.cgi?id=105281
Thanks for the nice answer. I was confused why hdparm -Y preserve it, but the suspend not. But I can't say I understand what's happening. If you say it's normal, than it's fine. I hoped I can assume that after suspend everything will be in the same state I left, but I can understand if it's not only the kernel's task.
I am not sure about what you mean by "hdparm -Y preserve it", but from the man page what it does is "Force an IDE drive to immediately enter the lowest power consumption sleep mode, causing it to shut down completely. A hard or soft reset is required before the drive can be accessed again...", so do you actually just mean that the settings survives a reboot? Also if sda is the only drive you have, `hdparm -Y /dev/sda` shouldn't really be able to do its job. It should only be able to put the drive to "standby" (but not "sleep") mode for a short while (even shorter than -y) at most in such case. And it doesn't seem to me that `sdparm --command=stop /dev/sda` would even work for ATA drives. Is there anything which assures you that it does make some changes to the drive?
You are right with everything, Only drive. With hdparm I just hear it spindown. And indeed sdparm doesn't even do that.