[TUTORIAL] Disk prevent from spinning down because of pvestatd

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:
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
#
 
Are you using PBS?
This should not wake up the disk:

Code:
smartctl -i -n standby /dev/sdg | grep '^Power mode'
 
  • Like
Reactions: roxy
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 ...
 
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:
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
 
/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:
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.
 
Hi,
I`m using OpenMediaVault on Proxmox with two HDD attached

4t8BJIb - Imgur.jpg


Most of the time disk are not used - sometimes is used 2 times per day, but mostly is like for few days I`m not using them - mainly are working to keep some files, pictures etc.

I think in this case is a good idea to spin down as long as are not used.
Should I only edit
Code:
# hdparm
parameter to set APM = 127 and than specified time ?
Or I need to edit
Code:
/etc/lvm/lvm.conf
??

Command dstat is not working on my Proxmox.
Code:
dstat -D sdc -ta --top-bio
 
useful guide, it's working on my PVE machines. i'd like to spindown also the disk on proxmox backup server, where the disk is continuosly used every 5 seconds to write someting even if the backup process isn't running.

Code:
----system---- --total-cpu-usage-- --dsk/sda-- -net/total- ---paging-- ---system-- ----most-expensive----
     time     |usr sys idl wai stl| read  writ| recv  send|  in   out | int   csw |  block i/o process
15-06 22:31:13| 16   6  76   3   0| 381k   23M|   0     0 |   5B   32B|  17k 8054 |proxmox-bac 382k   22M
15-06 22:31:14|  0   1  99   0   0|   0     0 | 120B 1078B|   0     0 |  42    65 |
15-06 22:31:15|  1   0  98   0   0|   0  2048k| 734B  406B|   0     0 |  88   122 |jbd2/dm-1-8   0  4096B
15-06 22:31:16|  8   2  90   0   0|   0     0 |5749B 9766B|   0     0 | 192   200 |proxmox-bac   0  4096B
15-06 22:31:17|  1   0  99   0   0|   0     0 |1711B  759B|   0     0 |  54    62 |
15-06 22:31:18|  1   0  99   0   0|   0     0 |  60B  406B|   0     0 |  57    81 |
15-06 22:31:19|  1   0  99   0   0|   0     0 |  60B  406B|   0     0 |  33    45 |
15-06 22:31:20|  1   0  98   0   0|   0  2048k| 794B  406B|   0     0 |  64    80 |
15-06 22:31:21|  1   0  98   1   0|   0    12k|1985B  743B|   0     0 |  81   108 |jbd2/dm-1-8   0    16k
15-06 22:31:22|  0   0  99   0   0|   0     0 | 272B  438B|   0     0 |  63    70 |
15-06 22:31:23|  0   0  99   0   0|   0     0 |  60B  406B|   0     0 |  31    53 |                      ^X
15-06 22:31:24|  1   0  99   0   0|   0     0 | 238B  524B|   0     0 |  34    56 |
15-06 22:31:25|  1   0  98   1   0|   0  2048k|2599B  829B|   0     0 | 106   155 |jbd2/dm-1-8   0  8192B
15-06 22:31:26|  7   4  87   3   0|   0     0 |7144B   10k|   0     0 | 206   248 |proxmox-bac   0  8192B^C

somebody knows how to stop that writes and let the spindown?
 
here I use a crontab to start & stop PBS to prevent monitoring its datastores systemctl stop proxmox-backup-proxy.service
 
here I use a crontab to start & stop PBS to prevent monitoring its datastores systemctl stop proxmox-backup-proxy.service
thank you for the hint.
well since i saw that the first full backup needed 1hour and 15 minutes, and following backups need only 3 minute if nothing changes, i decided to wake on lan the PBS server from the PVE server, and the shut it down after 1 hour thay should be enough for backup, prune and garbage collection.
 

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 yours easily in our online shop.

Buy now!