Backup internal HDD - sleep mode

LolekUK

Active Member
Dec 11, 2019
56
2
28
43
I have installed an additional HDD (spinning platters) in my PVE host, it will be purely used to take weekly backups of VMs and CTs (which currently takes less than 10 minutes).

Would it be possible to put the drive to sleep (and stop the platters spinning) for the remaining time of the week and wake it up just for the backup job?
 
Yes, that should be possible, but pvestatd keeps the drive active.
If you want to be able to spin it down, you would have to either disable the storage or exclude the drive in /etc/lvm/lvm.conf with
Code:
global_filter=["r|/dev/zd.*|", "r|/dev/disk/by-id/<your disk id>"]
To apply the changes either restart PVE or run vgscan to reload the LVM config.
You should then be able to spin down the disk from the host with:
Code:
hdparm -y /dev/sdX
If you want it to automatically spin down after some time of inactivity, you can use hd-idle, which is found in the Debian repository.
 
  • Like
Reactions: LolekUK
Thanks @fschauer, sounds easily achieveable.

I will need to do a bit more research on this :D as I have made the change, rebooted the host (remotely) and it didn't come back up. I will have to check it (physically) after work when I'm back home.
 
Also have a look at Vzdump hook scripts to automate the enabling/disabling of the storage. With that a weekly backup job could enable the storage first and disable it again once the backup job has finished. A disabled storage won't be polled by pvestatd, so it won't be kwpt awake every few seconds.
 
Yes, that should be possible, but pvestatd keeps the drive active.
If you want to be able to spin it down, you would have to either disable the storage or exclude the drive in /etc/lvm/lvm.conf with
Code:
global_filter=["r|/dev/zd.*|", "r|/dev/disk/by-id/<your disk id>"]
To apply the changes either restart PVE or run vgscan to reload the LVM config.
You should then be able to spin down the disk from the host with:
Code:
hdparm -y /dev/sdX
If you want it to automatically spin down after some time of inactivity, you can use hd-idle, which is found in the Debian repository.
update: I've found the missing character | at the end of the command, tested and working :) Thank you
Code:
global_filter=["r|/dev/zd.*|", "r|/dev/disk/by-id/<your disk id>|"]

when I enter disk by-id in lvm.conf, none of the machines (CTs and VMs) start after host reboot. I have checked disk ID by going to the /dev/disk/by-id folder (I have also entered disk ID for PVE GUI, which was WDBlue, same result:

Code:
  Invalid separator at end of regex.
  Invalid filter pattern "r|/dev/disk/by-id/ata-WDC_WD10SPCX-60HWST0_WD-WX11AC305006".
  Failed to create global regex device filter
command '/sbin/vgs --separator : --noheadings --units b --unbuffered --nosuffix --options vg_name,vg_size,vg_free,lv_count' failed: exit code 5
  Invalid separator at end of regex.
  Invalid filter pattern "r|/dev/disk/by-id/ata-WDC_WD10SPCX-60HWST0_WD-WX11AC305006".
  Failed to create global regex device filter
command '/sbin/vgscan --ignorelockingfailure --mknodes' failed: exit code 5
  Invalid separator at end of regex.
  Invalid filter pattern "r|/dev/disk/by-id/ata-WDC_WD10SPCX-60HWST0_WD-WX11AC305006".
  Failed to create global regex device filter
TASK ERROR: command '/sbin/lvs --separator : --noheadings --units b --unbuffered --nosuffix --config 'report/time_format="%s"' --options vg_name,lv_name,lv_size,lv_attr,pool_lv,data_percent,metadata_percent,snap_percent,uuid,tags,metadata_size,time' failed: exit code 5
 
Last edited:
Fab, thanks @fschauer, works flawlessly

Step 1. in /etc/lvm/lvm.conf
Code:
global_filter=["r|/dev/zd.*|", "r|/dev/disk/by-id/<your disk id>|"]

Step 2. install hd-idle and run the following command (to put to standby after 10 minutes/600 seconds)
Code:
hd-idle -a sda -i 600

Step 3. add to system startup
Code:
systemctl enable hd-idle

Step 4. edit startup hd-idle config file /etc/default/hd-idle, in my scenario it looked like this:
Code:
HD_IDLE_OPTS="-a sda -i 600"
 
Last edited:

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!