0
olivier

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

Recommended Posts

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.

 

 

 

 

Share this post


Link to post
Share on other sites

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)?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

 

Share this post


Link to post
Share on other sites

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 ?

Share this post


Link to post
Share on other sites
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 :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
0