Wake Up Your Unraid - A Complete Sleep/Wake Guide

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] hi there guys and welcome to another video so what I thought we'd talk about today is different ways we can make our unraid server sleep and different ways we can then wake the server from that sleep State now the most obvious reason we might want our server to go to sleep in the first place well it's to save power so for example if you had your server sleep for 8 hours a day while you're asleep well that's 33% of the day and so it will save you 33% to run the server there are other reasons you might want your server to go to sleep other reasons I can think of well if your server happens to be in the same room where you sleep or you can hear it from where you sleep well if the server goes to sleep as well you're not going to hear those noisy fans well another reason I guess is theoretically basically it could make your components in the server last longer while the server is sleeping the components aren't really being used it's in a low power State the CPU is not going to be hot the hard drives aren't going to be spinning up so again if it's asleep for 8 hours a day your components possibly could last up to 33% longer I don't know if you guys can think of any other reasons why you might want to sleep the server if you can then please let us know in the comments below now there's various different ways to sleep and awake your server some that you might know and some that you may not know now I'm sure most of you watching you know about the excellent Dynamics S3 sleep plug-in so what this great plug-in does is it enables S3 sleep on your unraid server now don't worry I'll explain what all the different types of sleep are but on the main tab of your unraid server at the bottom when you've installed this plugin underneath the reboot and shutdown buttons you you have another button which you can click on which will put the server to sleep but also what this plugin will do is allow you to set on a schedule for your server to go to sleep or even shut down and the great thing about it is is there's various different conditions you can set that need to be met before it will do so for instance you can have it so there has to be very little dis activity very little network activity in fact a whole bunch of different conditions can we have it so if something is on within our Network then the server will not shut down or sleep yep we can set that in the plugin as well in fact I've got an Nvidia Shield which I use to watch my MB server so in the plugin we can put in the IP address of the devices that we want to make sure that if they're on then the server won't sleep or shut down it's really useful so can the plugin also wake up the server at a certain time I mean like it shuts the server down at midnight then wakes it at same 900 a.m. no unfortunately the plugin's not able to do this when you use the plug-in you you have to manually start the server yourself we can either do that by pressing the power button on the front of the server to wake it or using something called won Lan which uses another computer on the network or maybe your phone or something that sends something called a magic packet that will wake the server up and in the video we'll be looking at how to set up wake on land so it works on our servers yeah I can see you might not want it to Auto Wake anyway there is a cool feature on my Apple Mac called wake or start up your Mac it's in the energy saver settings you can set a specific time for your Mac to wake from sleep or start up is there nothing like that in Linux we could use on our unraid servers well yep actually there is a way to do this there's a command in Linux called RTC wake and what this does is it sleeps the server for a certain amount of time which you specify in the command so you can tell the server to go to sleep from anything for a few seconds up to a few hours and then wake itself afterwards and I'll be showing you a script that uses this where you can set the time of day that you want the server to wake and when you run the script it will sleep at until that time so obviously this method is using the host operating system to wake the server but we don't have to rely on the host operating system to do this there's another way we can use a hardware based system where we can set the time we want the server to wake up in the Bios now this is normally called something like bios wake up or schedule power on and it allows us to choose a time for the server to wake from either sleep or even a complete shutdown okay right let's move on now and talk about the different types of sleep now there's s0 S1 S2 S3 S4 and S5 now I guarantee you've used s0 and S5 before we all have so basically s0 is the computer turned on and S5 is the computer turned turned off so s0 is when the computer's normally functioning in its day-to-day use and S5 is when it's shut down but still plugged into the wall and the PSU turned on in the S5 State there's just enough power to be able to register a button press on the front of your server or PC or if you've enabled it in the motherboard enough power going to the Nick to be able to receive a won land magic packet now whether your computer or server can actually respond to a wakon land packet in an five State basically depends on your motherboard and your network adapter not all Hardware will support this but more about that later so as you can see here the lower the number the more power the server or computer uses and the higher the number the less power it uses so now let's talk about the S1 and S2 sleep States I'd call these more kind of Legacy power States they're not really used much in modern PCS these sleep states were more commonly used in early computers back in the late 1990s and early 2000s it was this time where the acpi or the advanced configuration and power interface standard was being developed before this we had older power management standards such as APM Advanced power management but the S1 and S2 sleep states were some of the first states in the more advanced acpi standard so in both S1 and S2 States the CPU stops executing instructions but the Memory Remains powered and in S2 there's more components that are powered down than there is in S1 that's the basic difference between these two so now from the mid 2000s to late 2000s we didn't really see much of the S1 and S2 as technology got better and power management got better we started seeing S3 and S4 now with S3 which is probably the most common version of sleep the CPU is not executing any instructions and the state of the system is all held in Ram and pretty much most of all the other components they're either off or in a very low power State and S3 is the Sleep state which is easiest to be able to wake using a Wake On L packet more Hardware will support this version than any other an S3 sleep is often referred to as suspend to Ram now S4 sleep is slightly different in the S4 State the state of the computer is not held in the ram but it's written to dis and then the Ram's powered down saving more power now in Linux generally the contents of the ram are written to the swap partition now as you may know in unraid we don't have a swap partition so we can't use S4 sleep and another name for S4 sleep is suspend to disc now in fact that brings something else to mind if you're running a VM on any hardware at all whether it's un raid virtual box whatever you may be using there's never any point and you should really disable any type of S4 or hibernation on a VM because obviously writing its Ram contents to dis in the VM is not going to save any power at all because the host is still awake and the host is still operating normally anyway a little off topic but interesting anyway so obviously what we're going to be concentrating on is S3 suspend to Ram sleep and the first thing we need to make sure is we definitely got this enabled in our bios now obviously I can't show you how to do this for every motherboard but basically go into your bios it will be F2 or delete F12 you're going to need to press some key to get into the BIOS then once you're in the Bios you're going to want to head over probably to the advanced tab then in the advanced tab we want to go down to acpi configuration and then here we can see I've got suspend to Ram now remember S3 sleep is suspend to Ram so I've got the options for disabled or Auto so Auto is going to allow me to have S3 sleep now on this motherboard I've also got the option here if I wanted to have a PS2 keyboard be a to wake up the server from an S4 or S5 sleep I could enable this here but to be honest this doesn't interest me at all so I'm leaving mine on disabled now again what I want to make sure is I have pcie devices power on enabled this will enable me to have wake on landan and be able to send a wake on land ping to my unraid server to wake it up over the network and if we see here the RTC alarm power on at the moment I've got it set by OS so the OS can do this and wake up the machine but if I put enabled here then I can actually set a time of day where if the computer's off it will automatically start using the computer's RTC clock or real time clock and we just set the time and the computer will automatically boot if it's switched off I don't want that I'm going to leave mine by OS and finally the the last two things here the two other devices that can trigger a wake up USB keyboard and USB mouse I'm leaving mine as disabled so on your motherboard just look for similar settings it's probably going to be like I said in the acpi configuration and make sure to enable your S3 sleep and if you can enable wake onlan okay so the next thing to do is to install the S3 sleep plugin onto our unraid server you can see here on this server I don't have a sleep button so I can't activate it from the goey so let's head across to the apps Tab and do a search for S3 and here we can see the Dynamics S3 sleep plugin so let's get that installed so when that's done we can click on done and now going back to the main tab here we are at the bottom we can put the server to sleep now I'm not going to do that what I'm going to do now is I'm going to go across to settings here and now at the bottom of the settings page under user utilities we've got these sleep settings here so let's click onto that and we can see at the top here we got the function that this plug-in can do at the moment it's disabled so it won't automatically do anything but what we can do is we can choose to have it automatically sleep the server or automatically shut it down I'm going to click on to sleep here to automatically sleep the server now what we've got here is excluded days so if there are any days of the week where I didn't want this to happen then I would set that there so for instance if I didn't want my server to sleep at the weekends because I figure I might be watching movies or something well I could disable it from shutting down on a Saturday and Sunday and the same here excluded hours is when I don't want the Sleep plugin to take effect so the hours I don't want my server to shut down might be something like from 9: till midnight so now in between between 9:00 and midnight my server is not going to either sleep or shut down but during these hours here if the underneath conditions are met then it's going to go to sleep but so long as it's not a Saturday or Sunday now the first thing is we can wait for array in activity so if the array is busy it's not going to go to sleep so this is useful if you don't want your server to sleep when it's in the middle busy doing something now for device activity monitoring I recommend leaving on status en counters now with this setting here waiting for array in activity we can also do that with diss outside of the array with our unassigned discs here we can choose which disc we want outside of the array for it to be able to monitor as well I personally don't want to do that so I'm leaving mine as none now here the extra delay after array in activity at the moment this is set for 30 which is 30 minutes I'd probably set that a little bit less maybe 15 and another trigger here we can set is to wait for the network to be inactive so if we were to enable this to wait for the network to be inactive I find this can be a bit hit and miss but here we choose the network adapter that we want to listen on you want to set that for your default network adapter and here we choose the network idle threshold so if we wanted to make sure there's absolutely no traffic on the network and it will only shut down if there's nothing we' use silent and if we didn't care we wanted high or Mega traffic then we can set it this way or anywhere in between personally I leave this turned off now one thing I do like to do is I like to wait for host in activity like I was saying earlier in the video I've got an Nvidia Shield that's on the network and what this will do is it will ping the IP address that you put in here and check if it's online or not and if it is online it won't shut down and it will keep checking to see if it's shut down during the hours that your server can go to sleep so if my Nvidia Shield was on at say midnight it's not going to go to sleep and if it goes off at say 2:00 a.m. well it's going to go to sleep then so I think that's a really useful function and if you wanted to put two things in there just comma separate the IP addresses and you can have two different devices on the network that the plug-in will wait to see whether they're active or Not underneath here we can wait for user in activity we' got no local remote and local in remote personally I leave that to no now there's an important option here set Wake On LAN options before sleep now you want to leave this to be on G if your network adapter isn't on G then you're not going to be able to actually wake up the server with a wake on land ping even though we've enabled it in the Bios the network adapter must be set to G if we want to be to wake the server that way now I'm going to come back to this bit in a moment on another server but here we can put in custom commands before sleep and on some servers you can find that after waking up from sleep your network adapter might not be in gigabit speed so you can force gigabit after wake up by setting that to yes most Modern Hardware you don't really have to do that and again here you can force the DHCP to be renewed maybe your router only gives out an IP address for say an hour 2 hours and your ser might have been off for longer in that casee you'd want to set this to enable the DHCP renewal after the server wakes up okay so I'm going to pop across to my other server now okay so here on my other server let's go and have a look at the Sleep settings here basically I have it every day sleep between 1:00 a.m. and 700 a.m. now because the plug-in doesn't actually wake up the server my server will just go to sleep between these times until I wake it up later on when I want to use it the only trigger I have is the plug-in has to wait for my Nvidia Shield to be off before it sets the server to sleep now you can see I've got a custom command here now this sends a cur command to actually a tasmota smart plug that's connected to my desk it's got various periferals on the desk like the obviously the monitor keyboard various other things USB hub so what it'll do is when the server actually goes to sleep before it does it will switch the smart plug off saving me a bit of electricity in in case I've forgotten to turn everything off but other than that I keep it pretty simple but I find it extremely useful now I just want to go back and mention again about the G option here for the won land now although you can actually set it here to actually change the network adapter to be in that state I find it doesn't work on every server so what I want to do is I want to go to settings here and I'm going to go to my network settings and I can see here my default interface is eth0 now I'm going to open up a terminal window now and I'm going to type a command eth tool space and then e80 which is my primary network adapter so if I hit enter here we can see some things about the network adapter now the important things for us is the type of waycon that the network card supports and which type it's actually set to so here for my network card you can see won on the types that it support is p u m BG and each one of these letters represents a different way that the network card would be able to wake the server from sleep now for us to be able to use wake on land the G is the important one g means magic packet and Magic packet is basically a type of network packet that's used for Wake On Lan and it contains the unique Mac address of the network adapter repeated several times within the packet's payload and the Nick listens for this containing its Mac address and it wakes up the system when it receives it now you can see that my network adapter supports some other ways of waking up the server we're not really interested in these but but for those of you who are interested to know what these letters actually stand for well p means physical activity that would probably be something like if you plugged a network cable into the Nick that could wake it up as that would be changing the network link State and U stands for unicast message and these are messages sent from one device specific specifically to another device and are actually the most common form of data transmission on the network and so if the network card was set to you it would basically wake up whenever it receives a message that's sent directly to itself now whilst this sounds similar to a magic packet it will actually wake the server with any network traffic designed to go to it such as another PC on the network trying to access a network share that would probably wake it up as well the only problem is you can get unintended wakeups and the server can wake up sometimes when it shouldn't so next m stands for multicast messages now these are messages that are sent not to one individual device but to a group of devices and the network adapter will wake up when it receives one of these messages which is addressed to a multicast group that it's a member of next b stands for broadcast messages now these are messages that are sent to all of the devices on the network and when the network adapter receives one of these it will wake up the system now this isn't so secure and you can get a lot of unintended wakeups Okay so brings us back to G which is the regular wake on land packet and so now you can see why these packets are the best way to wake up the server because they're more secure and you don't get any unintended wakeups but obviously the other modes they have their uses as well and if you guys use any of these other modes then please tell us how you use them in the comments below but really you need to just check that your network adapter actually supports the g mode and it also should be in the g mode as well now let's go across to this other server here here so on This Server here if I go to settings network settings again my network card is et80 so on This Server I'm going to run the same command eth tool and then the interface name which for me is eth0 now at the bottom here we can see it supports Wake On LAN but the won Lan is set to D which means disabled now going across here to my sleep settings so what this is for here is to set the network adapter before it actually goes to sleep when you use this plugin to sleep the server so here before my server goes to sleep this plugin should set it into the G state but I found this doesn't always work for instance if I actually click on the button to manually sleep the server now the server is now asleep and I'm going to go across and press the power button to wake it up so the server's now awake again so now theoretically if I run the same command again then I should see it in G but I don't so what we can do in this situation is we can manually set it ourself and so to do that we use the same command we use eth tool but this time hon s then the network adapter eth0 for me then wall space g so doing this should set it to be able to accept magic packets so I'm going to hit enter and now let's have a look and see if that's corrected it and now we can see that it's enabled and can accept magic packets so a good idea to do when you've got this situation is take that command go to settings making sure you've got the user script plug-in installed add a new script I'm going to call it set wall and then edit the script put the command in save the changes now I'm going to set that to start at the start up of the array so every time now my server starts it should set the network adapter to the correct state Okay so we've got our server now so it can accept magic packets and it can be woken up after sleeping and now we need to learn how to wake up the server when it's sleeping without having to walk into the room and physically press the power button so to wake up your server using wake online there are various apps you can get for your phone that will do the job and there's apps for Windows and Mac OS as well but also we can do it from one unraid server to another but first we need to install an app which obviously is called won Lan now be sure to install the won Lan plugin not the virtual won Lan so click install to install that and with this installed we can now go ahead to the command line and we can use the ether wake tool where we just type ether wake and then the MAC address of the device that we want to wake up now this isn't my real Mac address it's just one I made up but here you'd put the MAC address of your server so obviously if you wanted to you can make a user script with various servers that you want to wake up now I'm going to go across to one of my servers here and I'm going to put this one to sleep and also let's put my main server to sleep and now what I'm going to show you is at the top here you can see I've got some custom tabs what I've done is I've integrated into these custom tabs that when I click onto This Server here basar it will actually send a magic packet to wake up that server and then go straight to its gooey so it's woken up the server straight away and here I can go back to the server I was on and again here's the other server I can click onto that and now this server's awake too now how to do this is coming in the upcoming video at the end of this week so you have to wait till then now you may be wondering just what the point is of being able to wake up another server from the gooey of a different server running well I run this server here that's on 24/7 it's a very lightweight server this one it's got the Intel M100 CPU and when running this server uses about 12 wats now it runs my reverse proxy a bit Warden container and a jyin container here that serves up the last 6 months worth of the media that I have with my main server running the main media server with far more than that but also it runs my home assistant and the firewall for the house in a pfSense VM so this obviously needs to be on all the time so having it all built into an unraid server that draws 12 Wat seemed a really smart idea as well this server's only got one hard drive of 4 tbte nvme and of course it's going to be an upcoming video about how I set all of this up so I find it super useful myself to be able to have the more power hungry servers in a sleep State and to be able to easily wake them just from the gooey of this small server in fact recently I was overseas visiting the nexcloud team again there's an upcoming video on the uncast show where I interview Yosh the co-founder of nexcloud keep an eye out for that and on my way home due to various cancelled and delayed flights I spent quite a bit of time sitting on these super uncomfortable seats here I don't think I've ever sat on anything more uncomfortable I think it's designed to make you not stay there and whilst away I'd heard about this cool Linux drro called NYX OS and I thought well I'm going to try and install it whilst I'm in the airport I've got nothing to do the seats are uncomfy it will take my mind off it and I actually recorded this whilst I was in the airport I opened VPN into my Network and then I connected to the Mini Server and from there I started up using the wakon lands script my VM server which was sleeping and then that gave me something to do installing the drro and checking it out whilst I was delayed in the airport now I'm sure you don't want to hear about my cancelled flights and boring delays let's move on and talk about another way we can actually make the server sleep and wake using something called RTC wake now I think this is really useful myself and yeah I know know it will scare some people off me opening up this terminal window here cuz it is actually a command that we're going to use but don't worry I'm going to show you a super useful script that will make this all really easy so all you do is type RTC wake and a space and hyphen M which is the mode for the sleep so I'm going to put space and me which is S3 sleep and then a space then hyphen s and that's how many seconds we want it to sleep I'm going to for this demonstration just put 20 seconds here and I'm going to hit enter okay so it says when it's going to actually wake up and we can see the server's asleep here clicking on these buttons it's not doing anything cuz the server's sleeping so you don't have to watch I'll skip through to 20 seconds later and now the server's woken itself up now it's pretty cool to be to put in a command for it to sleep for a certain amount of time but seriously if I wanted the server to wake up at say 7:30 a.m. tomorrow well I can't work that out how many seconds in the future that is but don't worry I've got you covered I've made a script that will do exactly that for you you put in the time the server wants to wake up in the script and when the script runs it will calculate the amount of seconds run the command and wake the server up at the specified time so to get the script head on over to my GitHub page click on to repositories and look for Server wake up scheduler click on to that have a read through the read me then click on wake up server here and click on copy raw file and let's go to the server page go to settings now obviously we need the user script plugin to be installed so make sure that's installed and I'm going to add a new script I'm just going to call it wake up click onto the Cog click edit get rid of the bin bash and then paste in the script and then here where it says time this is where we put in the time that we want our server to wake up it has to be in 24-hour format and only hours and minutes so at the moment here it's 11:01 so I'm I'm going to put 2303 and it's going to wake up the server at 2303 just so we can test it I'm going to click save and I'm going to run this in the background and everything's frozen at the moment basically because the server's asleep so I'm going to pause the video and come back in a moment okay so the server's woken back up and if I click on the log here of the script then we can see here what the script did and when it woke up now one thing to be careful of make sure you come across the time and date make sure your time Zone's correct and your unraid servers time is what you think it should be if it isn't then it's going to wake up at a funny time okay guys so that wraps up the video for today so look out for my video regarding running scripts from Custom tabs that should be out in a few days or next week sometime but if you enjoyed this video then please hit the like button and subscribe to the channel if you haven't already now I want to give a really big thank you to all my patreons and supporters out there thank you so much guys for all your support I really wouldn't better do these videos if it wasn't for your support and if you want to join these great bunch of people then please find the links in the description below anyway guys it's time for me to go now but whatever you're up to for the rest of the day I hope it's good and I'll catch you in the next video
Info
Channel: Spaceinvader One
Views: 10,056
Rating: undefined out of 5
Keywords:
Id: lBxQcU1MPY0
Channel Id: undefined
Length: 29min 24sec (1764 seconds)
Published: Fri Dec 15 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.