Jump to content

[Solved with hd-idle] configuring hdparm.config to spindown hdd's when not in use


Recommended Posts

Posted

Hi i have 2 drives connected to my Cuboxi 4pro imx6. A sata drive and a usb drive.

I am trying to get them to spin down because they will only be accessed in the evening and possibly during the day and evenings in the weekends.

To let them all spin 24/7 makes me really nervous.

The sata drive mounted and is in fstab:

 

UUID="15bd6efe-5765-44a8-9750-9d31f19413aa" /media/SATAHD ext4 defaults,nofail 0 0

 

fdisk output for the sata drive is

——————

Disk /dev/sda: 3.7 TiB, 4000787030016 bytes, 7814037168 sectors

Units: sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disklabel type: gpt

Disk identifier: 90F50F69-D96F-4ED2-A74F-C1A7857FBDAF

 

Device        Start        End               Sectors         Size     Type

/dev/sda1   2048        7814035455 7814033408  3.7T     Linux filesystem

/dev/sda2     34          2047             2014              1007K Linux filesystem

 

Partition table entries are not in disk order.

—————————

The usb disk is not mounted but i can see it on /dev/sdb

The 4TB sata disk sleeps instantly when i do

 

sudo hdparm -y /dev/sda

 

and wakes up eventually hours later.

I added the following lines to hdparm.config but only the usb drive spins down which is on sdb.

 

command_line {

    hdparm -S 127 /dev/sda

}

 

command_line {

    hdparm -S 127 /dev/sdb

}

 

When i try "sudo hdparm -B /dev/sd[abc]" the sata drive gives "APM_level not supported" and the usb drive give "apm 254".

 

I have been reading up on hdparm for the past 2 days

http://forum.havetheknowhow.com/viewtopic.php?t=479

https://unix.stackexchange.com/questions/410264/hdd-idle-settings-using-hdparm-apm-suspend

https://askubuntu.com/questions/39760/how-can-i-control-hdd-spin-down-time

 

But i just cant wrap my head around it. Next step is to install a light desktop to try gnome-disk-utility.

 

Can anyone help me/point me in the right direction ?

 

Kind regards Oliver.

 

 

 

 

Posted

On my NanoPi Neo2 in the FriendlyElec NAS-Case I did configure it the following way:

 

/etc/fstab

/dev/sda1 /harddisc ext4 defaults 0 0

getting the uuid with blkid for /dev/sda1

blkid /dev/sda1
dev/sda1: UUID="111b8932-714c-4da8-a36f-184e5ca84730" TYPE="ext4" PARTUUID="00056f38-01"

adding the following lines to the end of the /etc/hdparm.conf

/dev/disk/by-uuid/111b8932-714c-4da8-a36f-184e5ca84730 {
        spindown_time = 240
}

This is like in your link:
https://askubuntu.com/questions/39760/how-can-i-control-hdd-spin-down-time

 

==> spindown_time: see https://blog.bravi.org/?p=134  
0 = disabled

1..240 = multiples of 5 seconds (5 seconds to 20 minutes)

241..251 = 1..11 x 30 mins 252 = 21 mins

253 = vendor defined (8..12 hours)

254 = reserved

255 = 21 mins + 15 secs

 

Why would you set 127 (127x5 sec)?

Posted
20 hours ago, guidol said:

Why would you set 127 (127x5 sec)?

So i could see if it works after i would change it, 10 minutes.

I wil try what you did and post my results.

Posted
23 hours ago, guidol said:

/harddisc

is the name of your hdd ?

Does it give an apm value with "sudo hdparm -B /dev/sda" ?

 

I did the uuid naming in hdparm config but it didnt work.

 

Posted

Solved, i installed hd-idle and that spun down the sata drive. Usb drives work with hdparm. Just not my sata drive.

I also installed open media vault from a fresh image and added all the drives through the interface and then checked my hdparm.conf. and fstab and it looks all good.

 

Quote

hd-idle sata drive

HD_IDLE_OPTS="-i 0 -a /dev/disk/by-uuid/15bd6efe-5765-44a8-9750-9d31f19413aa -i 600

 

Quote

}

/dev/disk/by-id/usb-SAMSUNG_HM640JJ_0016031C0EF9-0:0 {

    apm = 127

    spindown_time = 120

    write_cache = off

}

 

 

PS how do you format the white boxes with code ?

  • olivier changed the title to [Solved with hd-idle] configuring hdparm.config to spindown hdd's when not in use
Posted
15 minutes ago, olivier said:

PS how do you format the white boxes with code ?

I never found a chance to format code  :(

but thanks for write_cache = off
I did forgot it in my config :)

Posted

I know this is an older topic but I have one question as I'm setting up some details to the HHD's on my OMV (5.5.20-1 Usul) based Helios64 NAS. I'm on the latest kernel 5.9.4 rockchip64. I have my primary OS on an M2 SATA drive and 3 8TB HHD's using Snapraid and UnionFS (2 in pool & 1 in parity).

 

I have not set up HD-Idle yet....but plan to shortly. Question is why turn off write cache in the OMV "Disks" interface?

PS...set APM=127 and spindown_time=240 on all three HHDs

Posted
1 hour ago, Z06Frank said:

I know this is an older topic but I have one question as I'm setting up some details to the HHD's on my OMV (5.5.20-1 Usul) based Helios64 NAS. I'm on the latest kernel 5.9.4 rockchip64. I have my primary OS on an M2 SATA drive and 3 8TB HHD's using Snapraid and UnionFS (2 in pool & 1 in parity).

 

I have not set up HD-Idle yet....but plan to shortly. Question is why turn off write cache in the OMV "Disks" interface?

PS...set APM=127 and spindown_time=240 on all three HHDs

you want buffers to be flushed directly so the drive does not spin up whenever the kernel decides it needs to flush.

IMHO I wouldn't recommend it (esp in RAID), consumer disks aren't as loud as 20 years ago and spinning up is the point where drives fail most. Early USB disks where prone to early catastrophic fails due to USB power mgmt.

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines