[TUTORIAL] Disk prevent from spinning down because of pvestatd

mar_565

New Member
Oct 22, 2020
7
0
1
29
Great tutorial, thanks.
This would be realy usefull for PBS since it only runs backups once a day. Unfortunally there are constant writes (2048k) to the disk.
Any ideas?

PBS alongside PVE with ext4 Storage HDD.
 
Last edited:

rcd

Member
Jul 12, 2019
197
16
23
60
I use an USB drive for backups, and in the nature of backups of course it only needs to spin during the backup. It seems to spin all the time though, judging by the sound. The dstat command shows zeroes for read/writes for several minutes (as long as I watched it) except for a 20/22k block when it's just started.

Is there a command that will show it's state without waking it up?

Code:
# dstat  -D sdg -ta --top-bio
----system---- --total-cpu-usage-- --dsk/sdg-- -net/total- ---paging-- ---system-- ----most-expensive----
     time     |usr sys idl wai stl| read  writ| recv  send|  in   out | int   csw |  block i/o process
10-05 09:36:21|  3   2  94   1   0|  22k   20k|   0     0 |5462B 6291B|4962    12k|z_rd_int   1100k    0
10-05 09:36:22|  2   1  97   0   0|   0     0 |  18k   21k|   0     0 |5078    10k|miniserv.pl 449k   23k
10-05 09:36:23|  2   1  97   0   0|   0     0 |  46k   45k|   0     0 |3313  5655 |webm        175k    0
10-05 09:36:24|  2   1  96   1   0|   0     0 |  23k   26k|   0     0 |4062    11k|webm        274k   23k
10-05 09:36:25|  1   1  98   0   0|   0     0 |  38k   38k|   0     0 |3142  5481 |pmxcfs        0    40k
10-05 09:36:26|  1   1  98   0   0|   0     0 |  39k   39k|   0     0 |3316  5882 |miniserv.pl 449k   23k
10-05 09:36:27|  2   1  97   0   0|   0     0 |  43k   42k|   0     0 |3720  6354 |webm        175k    0
10-05 09:36:28|  2   1  98   0   0|   0     0 |  52k   55k|   0     0 |3530  6236 |webm        274k   23k
10-05 09:36:29|  1   1  96   2   0|   0     0 |  36k   33k|   0     0 |3860  9926 |pihole-FTL  100B    0
10-05 09:36:30|  3   2  95   0   0|   0     0 |  53k   54k|   0     0 |3959  6976 |miniserv.pl 449k   23k
10-05 09:36:31|  2   1  97   0   0|   0     0 |  35k   37k|   0     0 |3487  5828 |webm        175k    0
10-05 09:36:32|  3   1  96   0   0|   0     0 |  27k   28k|   0     0 |4287  7516 |webm        274k   23k
10-05 09:36:33|  1   1  98   0   0|   0     0 |  27k   26k|   0     0 |3803  6633 |zvol          0   160k
10-05 09:36:34|  1   2  96   1   0|   0     0 |  43k   39k|   0     0 |4101    11k|miniserv.pl 449k   23k
10-05 09:36:35|  2   1  98   0   0|   0     0 |  34k   41k|   0     0 |3351  5569 |webm        175k    0
10-05 09:36:36|  2   1  98   0   0|   0     0 |  47k   47k|   0     0 |3441  5946 |webm        274k   23k
10-05 09:36:37|  1   1  98   0   0|   0     0 |  37k   34k|   0     0 |3668  6080 |sshd         32k    0
10-05 09:36:38|  1   1  98   0   0|   0     0 |  42k   43k|   0     0 |3144  5625 |miniserv.pl 449k   23k
10-05 09:36:39|  2   2  94   2   0|   0     0 |  48k   47k|   0     0 |4288    11k|rrdcached     0   276k
10-05 09:36:40|  3   2  95   0   0|   0     0 |  34k   35k|   0     0 |4047  6860 |webm        274k   23k
10-05 09:36:41|  1   1  98   0   0|   0     0 |  36k   39k|   0     0 |3265  5569 |jbd2/dm-1-8   0    36k
10-05 09:36:42|  1   1  98   0   0|   0     0 |  31k   33k|   0     0 |3050  5279 |miniserv.pl 449k   23k
10-05 09:36:43|  2   1  97   0   0|   0     0 |  39k   38k|   0     0 |3426  5687 |webm        175k    0
10-05 09:36:44|  2   2  95   1   0|   0     0 |  31k   30k|   0     0 |4267    11k|webm        274k   23k
10-05 09:36:45|  1   1  98   0   0|   0     0 |  43k   46k|  12k    0 |3196  5504 |pmxcfs        0    60k
10-05 09:36:46|  1   1  98   0   0|   0     0 |  30k   33k|   0     0 |3164  5445 |miniserv.pl 449k   23k
10-05 09:36:47|  2   1  97   0   0|   0     0 |  39k   41k|   0     0 |3976  6736 |webm        175k    0
10-05 09:36:48|  2   1  96   0   0|   0     0 |  35k   34k|   0     0 |3533  6294 |webm        274k   23k
10-05 09:36:49|  2   1  95   1   0|   0     0 |  28k   28k|   0     0 |3917    10k|pihole-FTL  100B    0
----system---- --total-cpu-usage-- --dsk/sdg-- -net/total- ---paging-- ---system-- ----most-expensive----
     time     |usr sys idl wai stl| read  writ| recv  send|  in   out | int   csw |  block i/o process

# hdparm -C /dev/sdg


/dev/sdg:
SG_IO: bad/missing sense data, sb[]:  f0 00 01 00 50 00 81 0a 80 00 00 00 00 1d 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 drive state is:  unknown
#
 

mar_565

New Member
Oct 22, 2020
7
0
1
29
Are you using PBS?
This should not wake up the disk:

Code:
smartctl -i -n standby /dev/sdg | grep '^Power mode'
 

rcd

Member
Jul 12, 2019
197
16
23
60
No, I don't use PBS.

Code:
# smartctl -i -n standby /dev/sdg | grep '^Power mode'
Power mode was:   IDLE_A
#

It's still spinning though ...
 
Feb 27, 2021
81
16
8
smartctl -i -n standby /dev/sdg
This depends a lot on the disks. This did not work for me, but the option -n idle did: smartctl -i -n idle /dev/sdg
The problem are new idle modes IDLE_A (electronics low power), IDLE_B (head parking) where the disk still spins.

Also newer server hdds use EPC instead of APM.
Have a look at the spec of you hdds, it sould mention the power modes.

Edit:
In my smartd.conf I use -n idle,6,q
This means that the smart data is only checked when the hdd is active, but if it was inaktive 5 times before, wake it up and read the data.
 
Last edited:

rcd

Member
Jul 12, 2019
197
16
23
60
Code:
# smartctl -i -n idle /dev/sdg
smartctl 7.2 2020-12-30 r5155 [x86_64-linux-5.4.106-1-pve] (local build)
Copyright (C) 2002-20, Bruce Allen, Christian Franke, www.smartmontools.org


Device is in IDLE_A mode, exit(2)
#

smartctl reports the drive is WDC WD80EDAZ-11TA3A0.

I don't really have experience with smart.conf. So what do I do - like:

/dev/sdg -n idle,6,q
 
Feb 27, 2021
81
16
8
/dev/sdg -n idle,6,q
yes that should work

You can use defaults as well:
Code:
DEFAULT -a -I 194 -W 0,45 -R 5! -n idle,6,q -m root
/dev/disk/by-id/ata-WDC_WD80EZAZ-11TDBA0_xxxxxxxxx -R 1! -R 22! -R 196!  -l scterc,70,70

There are many options :)
man smartd.conf

I go the WD80EZAZ as well, but it seems to be a different firmware.
Many people like the drives a lot, I found them to be a bit frustrating:
  • APM is not supported
  • EPC (Extended Power Conditions) is supported, but I could find a tool to change to settings
  • They are noisy and vibrate a lot
  • They are a bit slow
  • At least they are very cheap
 
Last edited:

rcd

Member
Jul 12, 2019
197
16
23
60
I added /dev/sdg -n idle,6,q to /etc/smartd.conf and rebooted, but it still says IDLE_A and is spinning.

I realize it's not a premium drive. It's just one of those cheap WD USB appliances which only purpose is to backup my zfs raid.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get your own in 60 seconds.

Buy now!