Decorum for the Forum:
  • Be nice. If you want to be mean, try Reddit.
  • No Piracy. If you want to be a thief, there are dark places on the internet dedicated to that.
  • No Cracking. Discussions on AnyDVD, DeUHD, DVDFab, UHDKeys and similar tools are not permitted here.
  • No Spamming. If you want to make a buck, work smarter... somewhere else.
  • No Adult Content. Half the internet is dedicated to adult content. This half isn't.

Privacy Policy: Click Here to Review (updated September 30, 2020)

What is Unraid and how to build an Unraid media server

Show off your HTPC builds, NAS Servers, and any other hardware. Great place to ask for hardware help too.
Manni
Posts: 389
Joined: Wed May 22, 2019 5:27 am

Re: What is Unraid and how to build an Unraid media server

Post by Manni » Fri Jan 21, 2022 3:59 pm

Yeah, I was wondering if it was the SATA bandwidth instead. Sorry about the typo, I means Gb/s (I know it might surprise you, but I actually know the difference).

Manni
Posts: 389
Joined: Wed May 22, 2019 5:27 am

Re: What is Unraid and how to build an Unraid media server

Post by Manni » Sun Jan 23, 2022 8:06 pm

Happy to report that the second Unraid server with the 9305-24i seems to be working fine. I was able to complete two pre-clear on two WD Red 6TB using Joe's script, so this confirm that the issue was due to the fact that the S3 plugin wasn't taking into account the unassigned devices.

I have a weird performance issue though, which is that the post-read it done at half the speed as the pre-read, and I'm not sure why. There is nothing running on that server (no VM, no docker, no share being used) so I don't see why it should pre-read at 124MB/s and post-read at 64MB/s, for both disks.:
Pre-clear results.JPG
Pre-clear results.JPG (114.67 KiB) Viewed 641 times
Otherwise, I've reinstalled my MyMovies/CMC configuration to have MyMovies server installed on the Unraid server only, a single instance of CCC running on that same unraid server, and all other CMC clients to point to that CMC installation. This seems to be working fine for now, though the CMC on my HTPC (which points CCC to the unraid server) is reported "FE" in the sync icon, probably because CCC is doing a Full Export. I assume that once that's done, it will stop displaying this.

Regarding MyMovies, I managed to fully uninstall the server instance on the HTPC, and I installed instead the client version, which points to the new server version installed on the Unraid server (where I restored a full backup made before deleting the HTPC instance). This allows me to access the MyMovies database from any client as if I was on the server, but without having to start a remote desktop session. I can add a title, read the disc IDs and map the episodes using the drives in the HTPC (or in any other PC/laptop), which means I don't need to buy the LAN-USB expensive device recommended by Paul.

I actually recommend to do this instead, because it means I can use any client to add titles with any drives anywhere on the network, or to access the database without start a remote session, which is quite convenient. Also no more syncs to the cloud and from the cloud between all the MM server instances, unless I make a minor change with the iOS app, as there is now only one server and many clients. That's progress! I realised that when I'm offsite, I can still see the collection and manage it from my phone/ipad, so I don't really need access to the server.

Anyway, very happy with the new setup, I need to run some tests tomorrow to see how much the server uses when all the disks are asleep, to decide if I keep it on 24/7 or if I use the S3 sleep (which seems to be working fine) to save energy after 30 minutes of inactivity. I can wake up both servers using the Asus app on my phone, so really easy to do when/if necessary.

User avatar
Pauven
Posts: 2303
Joined: Tue Dec 26, 2017 10:28 pm
Location: Atlanta, GA, USA
Contact:

Re: What is Unraid and how to build an Unraid media server

Post by Pauven » Sun Jan 23, 2022 8:25 pm

Awesome, sounds like you've got a nice setup working for you.

Manni wrote:
Sun Jan 23, 2022 8:06 pm
I don't see why it should pre-read at 124MB/s and post-read at 64MB/s, for both disks.:
From recollection, that's normal. Remember, Joe's script is designed to give your drives a workout, not complete as fast as possible. I think he does something different on the post read.

Manni wrote:
Sun Jan 23, 2022 8:06 pm
This seems to be working fine for now, though the CMC on my HTPC (which points CCC to the unraid server) is reported "FE" in the sync icon, probably because CCC is doing a Full Export. I assume that once that's done, it will stop displaying this.
Bingo, we have a winner. Since CCC's data is incomplete until the full export finishes, CMC skips the sync and relies on local, previously synced data.


I'm curious in your server's idle power consumption too.
President, Chameleon Consulting LLC
Author, Chameleon MediaCenter

Manni
Posts: 389
Joined: Wed May 22, 2019 5:27 am

Re: What is Unraid and how to build an Unraid media server

Post by Manni » Sun Jan 23, 2022 9:18 pm

Thanks again Paul for all your help, you've made this a lot easier!

You're right about the post-read, I think the script checks if the zeros written during the clear are all there, which probably slows it down. I've started the pre-clear of the next two discs and I've selected "fast post-read" in the plugin, so we'll see what the difference is. I'll post the results here.

I'll let you know about the power use with all the disks asleep (and when the 13 disks are working) on the tower config.

By the way, I checked and the 2500K on the second server does support VT after I enabled it in the BIOS, so I could have a VM on that one too if I wanted to (same 16GB of RAM as on the other one). I don't think I will, but it's nice to have the option if needed.

Manni
Posts: 389
Joined: Wed May 22, 2019 5:27 am

Re: What is Unraid and how to build an Unraid media server

Post by Manni » Mon Jan 24, 2022 8:03 am

All right, so power use of the first server:

i3770K at 3.5Ghz (I could use it at stock speed if it makes a significant difference)
16GB RAM
GPU: nVidia 7600GS (unfortunately I need it to boot, there is no iGPU on the MB)
All system files and VM on 1TB Samsung EVO840 SSD (cache)
12x4TB Hitachi HDDs in the array itself

Off/S3 Sleep (with WOL): 10-15W
During boot/power up: 200-210W
Idle after boot (all drives active, no activity except maybe the VM starting): 180W
Read check (all disks active): 215-225W (might be a bit more during a write, but they're unlikely to be all writing at the same time).
All drives asleep (except cache due to VM idle activity, CPU 7-10% load, with spikes up to 25% load): 98-115W

So the drives going to sleep only saves 50% of energy. 100W is still a lot of wasted power, when I only really use the arrays a few days a week, for a couple of hours at a time.

I think I'm going to switch it to S3 sleep after one hour of inactivity (45 min after the drives go to sleep). That way I'll have to WOL it when needed, but I won't burn lots of energy for nothing. I'll have to run move and read check manually though, which is a bit of a bummer, but at least it won't cause stuttering when I'm actually using the server as I'll control when it starts.

The second server (i2500K) might use less power, I'll see when it's all set with all its drives (I only have four at the moment for testing). I doubt it though because I have to use an even beefier GPU to boot (AMD 7850 I think) as the MB doesn't have an iGPU either. That's the oldest/least hungry GPU I could find in my stash. The next one is the 1080ti...

Good news is my array starts automatically and so does the VM. Also I've set the VM to hibernate on power off and to not ask login credentials when coming out of sleep (I'm not forwarding any port from the router, so there is no access possible from the outside), so it's very fast to start.

User avatar
Pauven
Posts: 2303
Joined: Tue Dec 26, 2017 10:28 pm
Location: Atlanta, GA, USA
Contact:

Re: What is Unraid and how to build an Unraid media server

Post by Pauven » Mon Jan 24, 2022 12:56 pm

Years ago I tried to build an Unraid server with 24 drives that idled at very low power. I documented it all on the Unraid forum, still there if you want to peruse that old thread. I went in with a goal of being sub 20w, or something like that. It's an interesting read with lots of power stats for individual components.

My ignorance was laid bare. My goal wasn't even close to possible.

From memory, even sleeping hdd's consume 1-2w. The fans, ramped down to their slowest possible speed, another 5-10w. But the biggest single power consumer was the SAS controller, over 50w right there if I recall correctly.

Sure, the motherboard, CPU, RAM, and GPU (Nvidia 730 GT) were very power efficient, well under 20w. I had never considered that idled drives and controllers would suck so much power on their own. It's a scaling issue. One or two drives you don't even notice the power. 12-24 drives, and it really adds up.

So your in the right ballpark, around 100w.

I have theories on how to lower it, but unfortunately the people who use SAS/SATA controllers rarely share power consumption info. Same for idle HDD per consumption, though you can read the manufacturers specs.

I think the only way to make a power efficient server is to use only a few high capacity drives (ie 20TB) connected to stock motherboard headers. With 6 drives, you could have a single parity 100TB server, and probably land in the 35-50w range, maybe less with extremely careful component selection. That's actually bigger than my current server, but I haven't fully scaled up yet.

Thanks for sharing your numbers. Sounds like your system is just about done and working great. So you can S3 sleep with vm's running, and they resume okay?
President, Chameleon Consulting LLC
Author, Chameleon MediaCenter

Manni
Posts: 389
Joined: Wed May 22, 2019 5:27 am

Re: What is Unraid and how to build an Unraid media server

Post by Manni » Mon Jan 24, 2022 1:36 pm

Yes, the VM resumes fine and very quickly as I set it to use hibernation and no login on resume.

I don't feel the need to investigate further as 100W was more or less what I was expecting, hence why I was set on using S3 sleep.

Sure less disks with higher capacity would help somewhat when the servers are active, but I have dozens of disks that I can use for now, and with S3 sleep it doesn't make that much of a difference given how little they are used (at most a few hours a day, most likely less than 10-15 hours a week). I have upgraded my servers to 6TB over the last couple of years, I have something like 250TB available, I'm not due an update for at least five years (if I ever need one). I'm only buying 4K UHD Blurays and there are not that many being released.

Manni
Posts: 389
Joined: Wed May 22, 2019 5:27 am

Re: What is Unraid and how to build an Unraid media server

Post by Manni » Fri Jan 28, 2022 6:05 am

Just a quick update to share some interesting findings re S3, as I have found a way to use automatic S3 Sleep and still get mover and parity check to work automatically daily/monthly. Here is what I do:

1) In the disk settings, I set the array to auto start and the default spin down delay to 15 minutes. The Windows VM is also set to auto start, but that doesn't really play on S3 resume as S3 sleep doesn't shutdown the VM.
2) In the S3 plugin settings, I set the execute function to sleep, excluded days to none, excluded hours to 01:00 - 02:00, and the wait for array inactivity to yes, exclude cache (so that a VM/Docker on idle doesn't keep the system active). I keep status and counters and I set the extra delay after array inactivity to 45 minutes. This means that it will take 60 minutes of array inactivity (excluding the cache) before S3 kicks in.
3) Then I also set "Wait for network inactivity" to yes, to make sure that if the VM is active (usually updating the Dune metadata or running a CCC) it doesn't go to sleep. Also If I'm ripping disks to the array, they will go to the cache so would be ignored, so I need the ethernet activity to keep the server alive during a rip. I will probably need to fine-tune the idle threshold, but for now I set it to Medium traffic (100kb/s).
4) Finally, I set the WOL options before sleep to g and I add the following script (found on the CMC forums) to wake the server up at 01:00am every day, so that mover can run automatically every night and parity check can run after it every month. This script uses the RTC clock to wake up the server at 01:00 every night if needed. That's the time my other servers are programmed to switch off if they are on, as I'm not watching anything or working by then. You can add more wake-up times in the array (below the 01:00) if needed. The main thing to remember is that for the scrip to work, the server has to be sent to sleep by the S3 plugin (automatically). If you request a manual sleep, the script won't run and the server won't wake up. Here is the script:

# #####################################
# ######### Settings ##################
# #####################################

times=(
01:00
)

# #####################################
# ######### Script ####################
# #####################################

# sort times
readarray -t times < <(for a in "${times[@]}"; do echo "$a"; done | sort)

# delete wakealarm
echo 0 > /sys/class/rtc/rtc0/wakealarm

# loop through times
for time in "${times[@]}"; do

now=$(date +%s)
fut=$(date -d $time +%s)

if [[ now -ge fut ]]; then
fut=''
continue
fi

# set wakealarm
echo $fut > /sys/class/rtc/rtc0/wakealarm
logger -t wakealarm "set wakealarm to "$(date -d "@$fut")

done

# set wakealarm for the next day
if [[ -z $fut ]]; then
fut=$(date -d "tomorrow ${times[0]}" +%s)
echo $fut > /sys/class/rtc/rtc0/wakealarm
logger -t wakealarm "set wakealarm to "$(date -d "@$fut")
fi

5) I schedule mover to run at 01:05 every night, and I schedule parity check to run at 02:00 every 1st day of the month. My parity check takes 8 hours on the server with 10 4TB (+2 parity drives), and 12 hours with the server with 4 6TB (no parity yet). It might be because these drives are slow, I'll test with other drives. The idea is that because it takes 60 minutes of inactivity before S3 kicks in, and I've excluded 01:00-02:00 anyway, it gives 55 minutes to mover to do its job (usually I'll have at most two UHD blurays to move at the end of a ripping day, if I have more then I'll move them manually). By the time we get to 02:00, either we're not the first and S3 sleep kicks in 60 minutes after mover is done, or we're the first and the parity check starts. It should be finished at the latest around 14:00, which is fine by me as I rarely watch films in the morning.

So with this set-up, the server goes to sleep after 60 minutes of array AND ethernet inactivity, wakes up at 01:00am every night to run mover, and does a parity check after that once a month. It goes to sleep automatically when that's done if there is no activity.

I've tested it last night with a parity check set to the 28th (today) and it worked fine.

Given that CMC supports WOL (thanks again Paul!), I don't even have to wake up the server(s) manually to play a film. If it's on the server, CMC wakes it up and plays the film. The only time I really need to wake up the servers is when I rip something manually or do some collection management. In that case I prefer to wake up all the servers anyway, as it speeds up MyMovies CM considerably. MyMovies is set to wake up all the servers when I launch CM on the main MM server (not when I launch CM from a client). If I need to do it manually, I use the Asus app for my router or I use the excellent WakeMeOnLAN windows app (https://www.nirsoft.net/utils/wake_on_lan.html) from a desktop/laptop.

I hope this will help someone.

User avatar
Pauven
Posts: 2303
Joined: Tue Dec 26, 2017 10:28 pm
Location: Atlanta, GA, USA
Contact:

Re: What is Unraid and how to build an Unraid media server

Post by Pauven » Wed Feb 02, 2022 2:45 pm

Hey Manni, thanks for sharing. That's really cool. I haven't played with S3 in so long, I didn't realize the plugin had advanced so much.

I do have a few comments (but of course I do, it wouldn't be me otherwise...).

Assuming I followed everything correctly, I think there is a potential gap in your logic. If you wake the server at 1am, but there is nothing to move, then the disks won't spin up from Mover activity. That means the server would go back to sleep at 2:00am on the dot (due to your exclusion window expiring) since it's been idle for over 45 minutes. That means that on the 1st, when the Parity Check should start at 2am, it's a race to see which command executes first, sleep or parity check. You can probably solve this by simply setting the parity check to start at 1:59am.

I looked at the script, and it seems overly complicated for your needs. Technically, I think you only need a few lines, since you don't have any variation in your wake schedule and only have a single wake time, 1am. The following would work so long as the server never goes to sleep between 12a and 1a (otherwise it won't wake until the following "tomorrow" day). It's probably a good idea to expand the exclusion window from your current 1a-2a to a larger 12a-2a window, which would prevent a shutdown in the final hour right before waking back up (worst case, it could shut down at 12:59 only to wake back up a minute later, and this might behave erratically).

Code: Select all

# delete wakealarm
echo 0 > /sys/class/rtc/rtc0/wakealarm

# set wakealarm for the next day
fut=$(date -d "tomorrow 01:00" +%s)
echo $fut > /sys/class/rtc/rtc0/wakealarm
logger -t wakealarm "set wakealarm to "$(date -d "@$fut")
Of course, the script as-is is perfectly fine, it works, but has a lot of logic in there to handle scenarios you currently don't experience (multiple wake schedules).

Now, it might be possible to make this script even smarter by checking to see if there is data to move before creating a wake timer. As-is, or even with the simplification I offered above, the script is going to wake the server every day at 1am, even if you've been on vacation for a month and there's nothing to move.

You could easily add a check to see if there is any data to move before creating the wake alarm. If there's no data to move, then create a wake alarm for 1:45am on the 1st, so it can run your scheduled parity check. That way, it will stay asleep the entire month, until you wake it manually to do some work, and in that case if you use the cache, the next time it auto-sleeps it will check to see if there's data to move, and since there is then it will create a 1am wake alarm for the mover.
President, Chameleon Consulting LLC
Author, Chameleon MediaCenter

Manni
Posts: 389
Joined: Wed May 22, 2019 5:27 am

Re: What is Unraid and how to build an Unraid media server

Post by Manni » Wed Feb 02, 2022 9:39 pm

Hi Paul,

Thanks for the feedback, very useful as always.

Re the timing, I'm sure it can be optimised, but I don't think there is a flaw in the logic because it doesn't wake up instantly. It will always take a minute or so for the system to wake up, given that it's resuming the windows VM etc. Then you add the 15min after the disks sleep. Then you add the 45 minutes for the S3 delay, which remember also takes into account ethernet activity, and you can be sure that the Windows VM will chekc a thing or two when it wakes up. So it's virtually impossible for the server to go to sleep at 2:00am on the dot, given that it can only sleep at least 60 minutes after the last disk array or network activity. Anyway, I'll see if it ever misses anything and I'll update if necessary. I don't want to expand the window unless it's absolutely necessary, because that's 50% more energy use for no reason most of the time.

I know that the script is overcomplicated for my current need, there was another simpler one with a single wake up time, but I picked this one with an array because it had two wake up times (I deleted one) so I know that if I want to, I can add one of more wake up times without changing anything else, which is cool. I like to future-proof a bit whenever possible, it's not like it costs any resources (RAM or CPU) or anything like that :)

I really like your idea of not waking up the server if there is nothing to move. In fact I wouldn't mind missing one parity check if that was the case by coincidence. I have zero time to figure out the script language though, I simply copied it over from a thread and took one of the wake up times out. If you ever decide to explore S3 further and want to suggest a better/cleverer script, I'll be happy to test it once you confirm it works, otherwise I'm happy as it is. I'll see how it goes but right now it's nice to know that the server is off most of the time, and only on when I need it. :)

Post Reply