Saving Power in my Homelab with Auto-Shutdown for Proxmox Backup Server

  Рет қаралды 30,598

apalrd's adventures

apalrd's adventures

Күн бұрын

Today I'm trying to reduce the power consumption of my [Proxmox Backup Server](/posts/2023/pbs_intro/). The HP Microserver is great for what I need, but it's kinda loud and I'm working on optimizing my power bill. The homelab is the largest single consumer of electricity aside from the air conditioning in the summer, so it's something I'm looking at heavily.
I tried doing S3 speep (normal suspend to RAM) and found that the Microserver doesn't support this. I then didn't have enough space on my 16G boot disk (microSD card) for a swap partition to hibernate to, and don't want to mess with the partition tables on my zfs drives to add one there, so hibernate is out too. This leaves me with actually fully shutting the system down and booting back up in the future. Downside to this is the RTC won't wake it back up, I need to have another system send a Wake on LAN magic packet. No big deal, I just need to make sure I send it early enough that the backups aren't scheduled to start until after the server is fully booted.
Blog post with all of the scripts:
www.apalrd.net...
Support me on Ko-Fi if you enjoy my content and find it useful:
ko-fi.com/apalrd
Feel free to chat about my upcoming projects on Discord!
/ discord

Пікірлер: 57
@bug1on1
@bug1on1 10 ай бұрын
To enable WOL for low cost offbaord-NICs (RTL8125, etc) it might be needed to run something like "ethtool -s enp2s0 wol g" once per boot for the card to keep the port up after shutdown. Thanks for the video!
@jemand771
@jemand771 10 ай бұрын
uhh, fetching the running task list is really cool! what I do for some of my systems is have them plugged into a smart outlet which completely cuts power once there's less than 5W of power draw (system is off) then, to boot it back up, I've got power loss recovery set to "always on" in the bios and just turn on the outlet I don't have ipmi on anything so this is a great way to squeeze out the last couple of watts when the system is off
@Chris.Wiley.
@Chris.Wiley. 10 ай бұрын
I learn so much from your videos. Thank you!
@JavierPerez-fq2fi
@JavierPerez-fq2fi 10 ай бұрын
Great video and thanks for sharing it! It just arrived on time since I did something similar finished today. In my case I end up configuring a nodered flow to perform backups sequentially and controlled from my 3 servers (wanted to avoid doing backup of a server while asynchronously start garbage collection or a remote sync which impacts a lot the performance just by guessing this will take 30 min and other task 40 etc...). To avoid that, I run one backup at a time and check the task created for that backup. Once finished jump to the next... once all finished sync job (which is very unpredictable in terms of when will be finish) and finally prune + garbage. This approach helps to keep everything under control and one thing at a time for performance reason. I was worry to play with expected timings that sometimes screw up everything :S
@StephenDeTomasi
@StephenDeTomasi 7 ай бұрын
Another thing that isn't considered is using a smart plug with the "power on with power connected" feature that is present in most BIOSes. Tuya-based plugs have a feature where if power consumption is low or none for 40 minutes, it turns off the plug automatically. Of course it can also be controlled via home assistant as well. Also it is also possible to schedule a shutdown every hour that only runs when the 15 minute load average drops below a certain value (aka the system is idle). That works well too.
@DavidAshwell
@DavidAshwell 10 ай бұрын
This is a useful topic and good ideas! Aligning it to your off peak power is great.
@apalrdsadventures
@apalrdsadventures 10 ай бұрын
It's still possible it will run all the way into the next on-peak time, but usually just the infrequent media backup does that
@RoxzinGaming
@RoxzinGaming 8 ай бұрын
that's perfect! I really needed this but never got to it. I will definitely try something similar, based off your documentation. Thanks for the video and the write up!
@eDoc2020
@eDoc2020 10 ай бұрын
WoL packets should be considered unreliable. A slight modification for more robustness is a program that continually sends WoL packets every few seconds until the target system responds to pings (or otherwise is determined to be online). If you combine it with systemd's dependency sequencing you could guarantee that your backups don't try to start until it's ready.
@Act1veSp1n
@Act1veSp1n 10 ай бұрын
Yes, this is the thing I was looking for! Thanks for the vid!
@Raja.Subramanian
@Raja.Subramanian 10 ай бұрын
Thanks a lot for your videos :-) I run Proxmox on refurbished Dell Optiplex (Intel i3, i5) and Acer/Asus Chromebox (Intel i7) SFF desktops. With a little bit of kernel command line magic you can dynamically drop the CPU to 400MHz when idle, this saves quite a bit of power. If booting on ZFS root: edit the /etc/kernel/cmdline file and append cpufreq.default_governor=powersave to the end of the kernel boot command line. Then run proxmox-boot-tool refresh to updated the bootloader and reboot Proxmox to take effect. After rebooting, you can run the below to verify the realtime CPU frequency: watch -n .5 grep MHz /proc/cpuinfo
@sherrysingh876
@sherrysingh876 7 ай бұрын
I have my NAS running on a Haswell crippled to use only one core and "powertop --auto-tune". That is plenty of power to saturate my 1Gig LAN. With just the boot drive(2.5 inch external), I got it down to use 10W of power on idle. Now that server holds my PBS lxc as well.
@100daysofmeh
@100daysofmeh 10 ай бұрын
Cheers for the video, the task list idea might make its way into my solution. Currently i use home assistant to power on a wifi plug, once the power goes on the server automatically boots up (i forget the bios option for this but basically if theres power, its on, all be it after a 2 mins sleep). Shutting down its a bit janky it works out if its shut down and then turns then plug off at the mains.
@RandomNullpointer
@RandomNullpointer 9 ай бұрын
Thank you for all the education you're sharing 🌼 Can I ask you how to automate some simple tasks to be done across the different systems? like updating a configuration file on all of them. They say Ansible is one solution, but I'm not sure; it feels there should be something friendlier in a way...
@udd123123
@udd123123 9 ай бұрын
Came here after recommendation from "Guy with Swiss Accent " and subscribed . Your video contents are great and hopefully you will surpass Andreas contents ..
@sebasdt2103
@sebasdt2103 10 ай бұрын
Its quite similar to what I got. only shutdown is just a hard shutdown no checking if any tasks are still running. time to change that! Thanks man
@zyghom
@zyghom 10 ай бұрын
My secondary machine on which I run second PBS takes only 8W while idle (MinisForum Venus UM773) that as per UK prices gives me in total cost of 20 GBP/year - probably no need to turn in off and on and bring more exposure to failure due to power on/off. But the idea is great and makes sense if your PBS consumes too much power.
@sethalump
@sethalump 10 ай бұрын
This is solid. I'm curious to hear your thoughts about running a server off a thumb drive / sdcard like you mentioned.
@apalrdsadventures
@apalrdsadventures 10 ай бұрын
For the SD card, I have the SD card formatted ext4, noatime, no swap, and I put all of the PBS logs on the zfs pool (not the sd card), so it's not getting written to that much. Still not perfect, but all of the important data is on the zfs pool anyway.
@sethalump
@sethalump 10 ай бұрын
@@apalrdsadventures awesome thx.
@watvannou
@watvannou 10 ай бұрын
It sort of sounds to me like the better option here would be to use one of those fancy mains power backup units (jackery?) or whatever flavour of the week, then put a relay on it to only charge the battery from mains when its on off-peak power hours :) In my case I have truenas scale on an older desktop in the basement and I just looked into the cpu speedstep stuff to make sure it runs the cpu as slow as possible when there is no load. Took a bunch of googling to find the commands and I already forgot how i did it now :(
@JoseMariArceta
@JoseMariArceta 10 ай бұрын
For backup low capacity charger it's probably great for saving money? not really it would takes years to recoup seeing his computation of 96usd per year if the server was off 24/7 instead of on 24/7.
@apalrdsadventures
@apalrdsadventures 10 ай бұрын
Shutting it down removes the load entirely instead of shifting it to a cheaper price with a battery.
@Trains-With-Shane
@Trains-With-Shane 10 ай бұрын
Not sure it would be worth the effort. My UPS stays in a pretty much fully charged state so the large share of the power draw is by whatever is plugged into it and running. And as such the battery charger is probably doing minimal work. The only time that should ever change is after a power outage where the batteries were drained down whatever amount. And in which case the battery charger would start charging the instant mains power was restored. In that instance I would want the batteries topped off as quickly as possible, no matter what time of day it was, in case the power were to fault again.
@postnick
@postnick 10 ай бұрын
I used to turn off my NAS and Proxmox at night, like 11:30 pm - I'm usually in bed by 11 anyway. And my Ras Pi had a backup Pihole and a Wake on Lan script and it worked great. But the problem is you lose your ARC cache on Truenas. SO i just host proxmox always on stuff on a Micro PC that uses like 10 watts at idle most of the time.
@apalrdsadventures
@apalrdsadventures 10 ай бұрын
Losing ARC shouldn't be a big deal, it can read it back in as needed in the future
@postnick
@postnick 10 ай бұрын
@@apalrdsadventures true since it’s an SSD nas anyway it’s not like it’s that slow.
@paullacatus8975
@paullacatus8975 10 ай бұрын
I am using WOL from HomeAssistant to wake up the PBS but for shutdown your script is nice and I will use also . Thanks
@apalrdsadventures
@apalrdsadventures 10 ай бұрын
Glad you like it!
@adrianstephens56
@adrianstephens56 10 ай бұрын
I found a slightly different solution. My proxmox backup server is always on - it's a VM on the main proxmox server (consumes 100W) itself, which mounts an nfs directory on truenas scale, running on the proxmox server itself. Clearly, this is not a good enough solution. Then I have a secondary proxmox server (consumes 40W) running truenas in a VM. I have a script that does a zfs incremental backup between the two truenas scale deployments, with wake/suspend around it. The proxmox backup to the backup server takes about 4-5 hours to run. The incremental zfs backup varies, but it typically a few minutes. So that is how long each day my secondary server is awake.
@ВалерийШадрин-л5г
@ВалерийШадрин-л5г 10 ай бұрын
Neat!
@arthurlee4323
@arthurlee4323 10 ай бұрын
Are you worried about the increased wear on your backup drives booting up and shutting down once per day?
@damiendye6623
@damiendye6623 10 ай бұрын
That increased ware is offset by not spinning all day.
@apalrdsadventures
@apalrdsadventures 10 ай бұрын
There's probably more wear from startup/shutdown than on-time, since HDDs wear from both cases. I'm also not super concerned with these Seagate Exos SAS drives. I'd probably be more concerned with desktop drives.
@ratazine2027
@ratazine2027 9 ай бұрын
worked flawless for me! Question: why backup independently the various servers you mention? Mine are in a cluster and with one job at the cluster level all go through. Are you saying the cluster will do them one by one anyway?
@apalrdsadventures
@apalrdsadventures 9 ай бұрын
I have two separate servers (not clustered), one is 'production' and one is 'dev'. The webserver is also off-site hosted so it's a third separate system. A cluster with a backup job will kick off all of the backups at once, but each individual VM/CT backup and also each VM/CT 'prune' is a separate 'job' to the backup server, so you will see a lot of jobs in the job history when backing up a cluster.
@ratazine2027
@ratazine2027 9 ай бұрын
Thanks for the quick answer. I think I understand now ;) I would much appreciate a video on backing up random zfs datasets that are not necessarily for any given VM/CT if that is possible towards the PBS. Thanks again!
@apalrdsadventures
@apalrdsadventures 9 ай бұрын
I actually have a blog post on the topic, but I'm waiting for a few months to make a video since there are some changes to pxar / pbs client that will greatly improve speed and minimize reading every single file when doing backups without qemu snapshots. www.apalrd.net/posts/2023/ultimate_migrate/#large-dataset-backups-to-proxmox-backup-server
@ratazine2027
@ratazine2027 9 ай бұрын
Thanks again. I'll check it out right away.
@emmkerkatsouranis8273
@emmkerkatsouranis8273 9 ай бұрын
Great video. But if the backup server is turned off, the logs on the VEs will go crazy not finding the shared backup location. I've tried it and it gives a ton of these: pvestatd[1370]: BackupServer: error fetching datastores - 500 Can't connect to x.x.x.x:8007 (No route to host) Any solution for that?
@Samuel-eu1ts
@Samuel-eu1ts 10 ай бұрын
Don't most motherboard support wake from RTC in the bios ?
@apalrdsadventures
@apalrdsadventures 10 ай бұрын
This one has very little in the BIOS, it doesn't support a lot of things (like suspend, but also the iGPU is completely absent).
@daidaloscz
@daidaloscz 10 ай бұрын
It's funny that Dell poweredge servers for example don't have wake from RTC. I have mine set up to wake up over idrac, over a VPN, for off-site backups
@apalrdsadventures
@apalrdsadventures 10 ай бұрын
iLO is another option for me, and yeah the server BIOS are the worst.
@Samuel-eu1ts
@Samuel-eu1ts 10 ай бұрын
@@apalrdsadventures Hum didn't know, thanks! Weird that only consumer MB have the option, would a thought it's more of an enterprise feature.
@eDoc2020
@eDoc2020 10 ай бұрын
Usually the option isn't available in the BIOS UI but the OS can configure it. That's how systemd timers could wake up the system.
@shephusted2714
@shephusted2714 10 ай бұрын
i say leave it on all the time - goto a mobile tiger lake platform? good point about enterprise gear people get these big systems and then they get the power surprise but if you use a system basically all the time just leave it on - if you serve via r proxy you sort of have to; also this vid points to trend of consolidation - instead of 5-6 boxes try to run a couple boxes both with ups and running at optimal efficiency - save enough in a few years to make a difference #shelly relays
@C.I...
@C.I... Ай бұрын
This seems like a lot of effort to not go to the box and press the power button occasionally.
@74357175
@74357175 10 ай бұрын
Is there an opportunity to use anacron, so you don't have to worry excessively of the server has made it back online in time for a particular time trigger?
@apalrdsadventures
@apalrdsadventures 10 ай бұрын
Systemd timers will run later if an event was missed. In this case, the timers are on other systems (backups are 'push'), so their timers will trigger and the job will fail with errors if the backup system isn't up.
@74357175
@74357175 10 ай бұрын
@@apalrdsadventures ah, I guess that's one advantage of completely shutting the dust down, vs hibernating.
@ВасилийНовопашин-б6к
@ВасилийНовопашин-б6к 10 ай бұрын
лайка, откуда такая майка?
@XSmile2008
@XSmile2008 10 ай бұрын
Russian propaganda t-shirt during war? Nice! Maybe next day you can wear one with Hitler, Stalin or a swastika?
@АлексейМиллер-щ7ч
@АлексейМиллер-щ7ч 10 ай бұрын
по свастике это к украинцам
@BluefaceChannel
@BluefaceChannel 9 ай бұрын
@@АлексейМиллер-щ7ч ты что себе, холоп, позволяешь?! Кто тебе разрешил на западные сайты заходить?! В наказание тебе 12 часов молитв фуражке Гитлера в Храме Вооружённых сил на коленях (как тебя учили родители) и после этого поедешь на 6 месяцев на урановые рудники отрабатывать неповиновение Царскому указу.
@АлексейМиллер-щ7ч
@АлексейМиллер-щ7ч 10 ай бұрын
лайк за лайку :)
New Boot SSD for my PROXMOX System
17:07
apalrd's adventures
Рет қаралды 24 М.
Running a NAS on Proxmox, Different Methods and What to Know
18:47
ElectronicsWizardry
Рет қаралды 80 М.
SLIDE #shortssprintbrasil
0:31
Natan por Aí
Рет қаралды 49 МЛН
Wednesday VS Enid: Who is The Best Mommy? #shorts
0:14
Troom Oki Toki
Рет қаралды 50 МЛН
Quick and Easy Local SSL Certificates for Your Homelab!
12:08
Wolfgang's Channel
Рет қаралды 933 М.
Turning Proxmox Into a Pretty Good NAS
18:31
apalrd's adventures
Рет қаралды 281 М.
EXPOSE your Homelab to the INTERNET?! (Be Careful)
16:28
The Hardwarek3r
Рет қаралды 2,1 М.
Proxmox Backup Server Saves You Money And Time!
24:48
Jim's Garage
Рет қаралды 67 М.
5 Ways to Make Proxmox Better (New Install Changes)
16:41
WunderTech
Рет қаралды 44 М.
Single-Root IO Virtualization in Proxmox (for Networking)
21:39
apalrd's adventures
Рет қаралды 12 М.
Don’t run Proxmox without these settings!
25:45
Christian Lempa
Рет қаралды 356 М.