Home Fileserver: Drive temps

With the summer coming on, the ambient room temperature is increasing, and so here’s a handy script to help you monitor your drive temperatures to help prevent heat-related data loss.

If your computer cannot monitor your drive temperatures and increase fan speed when required, you might be risking your drives reaching temperatures that will hasten their failure and potential loss of data. Even with redundancy in the form of mirroring, RAIDZ1 or RAIDZ2, it makes sense to take simple steps to keep your drives cool.

My file server’s case, an Antec P182, provides a dedicated wind tunnel and Antec TriCool 120mm fan for the drive bay. This fan has 3 settings: L, M and H — low, medium and high speeds.

Of course, when the weather was cooler, the ambient room temperature was lower, and so I could get away with running the fan at the lowest of the three speeds, for reduced acoustic noise.

Now that the weather is getting warmer, I decided to check out the heat of the drives whilst the OS was running.

The drives I use are SMART-capable, and things like drive temperature are recorded internally by the drive electronics. In order to access this data, I found some software called smartmontools.

To install this on OpenSolaris, do the following:

See: http://smartmontools.sourceforge.net/download.html and scroll to the Solaris section.

Download the source tarball from here:
http://sourceforge.net/project/showfiles.php?group_id=64297

Then unpack it:

bash-3.2$ gunzip smartmontools-5.38.tar.gz
bash-3.2$ tar xvf smartmontools-5.38.tar
bash-3.2$ cd smartmontools-5.38

And the usual compile and install:

bash-3.2$ ./configure
bash-3.2$ make
bash-3.2$ su
# make install

Then scan for your drive ids in your drive array:

# format
Searching for disks...done


AVAILABLE DISK SELECTIONS:
       0. c0d0 (DEFAULT cyl 20007 alt 2 hd 255 sec 63)
          /pci@0,0/pci-ide@4/ide@0/cmdk@0,0
       1. c1t0d0 (ATA-WDC WD7500AAKS-0-4G30-698.64GB)
          /pci@0,0/pci1043,8239@5/disk@0,0
       2. c1t1d0 (ATA-WDC WD7500AAKS-0-4G30-698.64GB)
          /pci@0,0/pci1043,8239@5/disk@1,0
       3. c2t0d0 (ATA-WDC WD7500AAKS-0-4G30-698.64GB)
          /pci@0,0/pci1043,8239@5,1/disk@0,0
Specify disk (enter its number): ^C
# 

From the above, record your drive ids and then feed them into this little script:

#!/usr/bin/bash

# is there a way to populate the array by querying the zfs pool directly?
drives=(c1t0d0 c1t1d0 c2t0d0)

temp=""

drivetemp () {
  drive=$1
#  printf "drive passed in = %s\n\n" $drive
  temp=`/usr/local/sbin/smartctl -a -d scsi /dev/rdsk/$drive | \
       grep Current | awk '{print $4 $5}'`
  return
}


drives_count=${#drives[@]}
index=0

while [ "$index" -lt "$drives_count" ]
do
  drivetemp ${drives[$index]}
  printf "Drive %s temp is %s\n" ${drives[$index]} $temp
  let "index = $index + 1"
done

When you run it, it will give you output like this:

# ./temps.sh
Drive c1t0d0 temp is 39C
Drive c1t1d0 temp is 39C
Drive c2t0d0 temp is 38C
# 

By using this script you can see which fan setting gives a reasonable balance between noise and cooling power to keep the drives at a safe temperature.

When we had a hot day recently, I had the drive fan on the lowest setting, and was horrified to see that the temperature of the drives had reached around 47 degrees C.

Ideally, I would have fans that monitored the SMART data heat values and ramped up the cooling on demand. Oh well, perhaps for a future setup…

For now, I’m running on the medium fan speed, with slightly increased noise, but happy data and temperature of around 40 degrees or less ๐Ÿ™‚

Google report on drive failure trends

There’s a Google research paper released called Failure Trends in a Large Disk Drive Population which seems to suggest there is little correlation between drive temperatures and failure rates.

I find this quite surprising, as I’m sure quite a few other people will too. One wonders how long they keep their drives for, and whether they keep the drives running permanently, or switch them off and on each day. I suspect the former, in which case, perhaps the usage pattern differs from your average drive in a home system.

The report does say though, that, ironically, keeping the drives very cool can dramatically reduce the drive’s reliability. And it also said that older drives frequently running hot have a much increased risk of failure.

When I get a spare few hours to digest that report, I will update this post with more information. For now though, I prefer to keep the drives reasonably cool.

Anecdotally, I have heard that drive manufacturers often quote a maximum recommended temperature of around 55 degrees C.

There’s a good article here which reflects on aspects of this report, and has a lot of feedback, including from NetApp.

Here’s more discussion about the Google report. From this, it seems that temperatures of 40 degrees C, or a little less, seem to be reasonable.

For more ZFS Home Fileserver articles see here: A Home Fileserver using ZFS. Alternatively, see related articles in the following categories: ZFS, Storage, Fileservers, NAS.

Join the conversation

24 Comments

  1. Have you considered using thin client SunRays connected to your server? They dont have any CPU nor RAM (that runs software). You can not upgrade them, impossible. They only transmit the mouse and keyboard data into the server, and the server sends back bitmaps to the SunRay. Totally secure.

    You plug in a SunRay into the hub and 10 secs later you get a login screen. Thats it. Looks exactly like you are sitting in front of the server. Each SunRay 2, uses 4 Watt. No fans. One server in the basement + 4 SunRay + ZFS = veeeery nice. With Virtualbox on the server you can run WinXP too. An refurbished SunRay can be found on Ebay for 40 USD. I use SunRays at home, and it is soooo sweet. You can listen to your MP3 collection on your ZFS pool from each room.

    There are lots of interesting blogs on SunRay from home users.

  2. Sounds very interesting — I will check them out. Thanks for the tip! I suppose you can’t watch video on them, can you?

  3. There are problems with watching video on them. The bandwidth is the problem. The SunRay 2 has a 100mbit NIC built in. If you watch video, 1024 x 768 at 24bits, then it is like 100MB/sec? That is too much, because the server sends bitmaps to the SunRay. But if you have a small windows, you can see flawless video. The greater you make the window, it will start to lag. I think ~640×480 video window is flawless.

    However, SUN is modifying the server SunRay SRSS software so it can show video fullscreen. I dont know when it is scheduled to be released. filibeto.org has a mailing list for SunRay.

    You just install SRSS software on the server, and answer like 4 questions, and you are done. Then you insert the SunRay into the hub and thats it. Dead simple. The SRSS software is free to download from sun.com.

    Ive heard of a bank that swithed to SunRays, and they saved 94% of their energy bill.

    One quad with some GB, and you can serve several SunRays doing heavy duty work. One machine with two quad cores and 16 GB RAM in the basement, and you can serve your whole neighbourhood. They can toss out all their computers, and have a SunRay from you. And several large discs with ZFS at your house, with quotas, and they can listen to music, see video (on small windows), surf, etc. 4 Watt each SunRay. You can not upgrade the SunRay, you upgrade the server instead, and all SunRays will be upgraded. To serve many SunRays, ive heard RAM is the most important. Maybe 300 MB RAM for each user, or so is sufficient. Each SunRay uses like 320kbit/sec bandwidth for normal use, which is less than Citrix. There is a blogg on Citrix vs Sunray bandwidth flash video, and SunRay wins. Citrix is unusable at 20kbit/sec – contrary to what citrix claims. See the blogg where they try first with 20kbit/sec on citrix.

    There are lots of user storys on blogs on SunRay. I love them. No one can mess the server up anymore. It is Solaris. And ZFS gives them a quota. Totally safe and top notch security. SunRay can also use cards (like Visa card) and support hot desking. Pull it out, and into another SunRay and continue where you left off. SUN has like 19.000 SunRay deployed worldwide, and have 38 administrators for them in total. Where small work.

  4. Maybe you can lower the resolution on one SunRay down to 640×480 and then you have full video? Lower the bit plan from 24 bit to 12 bit?

    The SunRay 2 is 0.380 kg, and the size of a video VHS cassette. You can have dozens of them in a drawer, if the need should arise, for dozens of new workstations to work on.

  5. But if SRSS is fixed so it can show video full screen, then I shall get a OH projector connected to SunRay so I can watch movies on the entire wall. A quad core with 8GB RAM should suffice for my entire household, and several discs in ZFS raid. And the movies on it, plus the MP3 collection. Sweeeeeet!

    SunRay 2FS has dual Screen dvi, each 1920 x 1200.

    (No I dont work at SUN, I am just a SUN fanboy, i like the best technology. Right now, it is SUN having the best technology).

  6. Well, they really do sound like cool devices. I had heard the name SunRay but so far I’ve never seen one. I’m off to Google to take a look. Four watts power consumption is incredibly low power, and for what most people use a computer for, it sounds quite sufficient, assuming you have a server to connect it to.

    Thanks a lot for the tips!

  7. And thanx a lot for your blogg! Tons and tons of useful information. Godsend. I had problems setting up CIFS, but now I will try again with that. We all help each other. You give us tips. And we give tips back. Together we all prosper. This is the open community. The more we give, the more we get back. Easy.

    Would be cool if you tried SunRays and blogged about them too. :o)

  8. Thanks, and glad you found the info useful. I spent a lot of time finding all this stuff out, so I’m happy for others to benefit from it. I found a lot of info on other bloggers’ sites to help me too.

    And thanks again for the SunRay info — sounds good, and if I’m ‘allowed’ to obtain any more hardware, like a SunRay, I’ll be sure to write something about it. Cheers! I’ll take a peek on ebay now or craigslist ๐Ÿ™‚

  9. Thanks Simon for the write up. I found it very useful, having just built a 4 disk zfs pool, in a case which doesn’t have the best airflow…the temps ended up being lower than I expected (approx 30 degrees) :o) I did have some initial problems compiling, but I was originally compiling with suncc. I installed gcc and no problems with the compile.

    Regards
    Tim

  10. Hi!
    im a super newbie at this, and i have troubles running the script.
    it says:
    โ€œDrive./temps.sh: line 23: let: โ€œindex: syntax error: operand expected (error token is “โ€œindex”)
    in a neverending loop until i hit ctrl+c

    have tried with just one drive in the drives=() array

    ????

  11. Don’t know why that didn’t work for you — perhaps a typo? You could maybe try copying and pasting the whole text into a file and re-running it.

  12. Yes, you need to edit the code in a text editor. The last printf and let lines have slanted double-quotes, instead of regular double-quotes, thus the operand error.

  13. Hello,

    I am also new to *nix world (OpenSolaris 2009.06). I have installed smartmontools and created/copied your script, but i only get following output (no temperatures are listed):

    Kren@model:~/Scripts# ./Temp.sh
    Drive c7d0 temp is
    Drive c7d1 temp is
    Drive c8d0 temp is
    Drive c8d1 temp is

    Thank you and kind regards,
    Mark

  14. Thank you Gustavo! i replace the slanted quotes with regular and:

    ~# ./temps.sh
    Drive c0t0d0 temp is 29C

    weee!

    Simon, thank you very much for the script!

  15. Mark, what type of sata controller are you using? I seem to remember reading that SMART isn’t supported with Intels ICHx controllers. Perhaps this has changed, but something to look into.

    Excellent work on the articles Simon. I purchased a 1tb WD green drive and an integrated Jetway board a little over a year ago with the intent to eventually do raid 5 under Ubuntu. Soon after I learned about ZFS and shot that plan to heck.
    Unfortunately, with my college student budget I haven’t been able to purchase a new chip or the rest of the drives yet, but when the day comes I’m sure I will be referring to your site quite often.

  16. Glad it worked ono, I must fix that script as it is presented here — I think the quotes got translated when displayed on this page…

    And thanks Gustavo for the fix !

  17. I had the same problem as “Mark on July 8th, 2009 at 19:56”. So then I did this command, and got this output:

    # /usr/local/sbin/smartd -q onecheck
    smartd version 5.38 [i386-pc-solaris2.11] Copyright (C) 2002-8 Bruce Allen
    Home page is http://smartmontools.sourceforge.net/

    Opened configuration file /usr/local/etc/smartd.conf
    Drive: DEVICESCAN, implied ‘-a’ Directive on line 23 of file /usr/local/etc/smartd.conf
    Configuration file /usr/local/etc/smartd.conf was parsed, found DEVICESCAN, scanning devices
    Device: /dev/rdsk/c13d0s0, opened

    #######################################################################
    ATA command routine ata_command_interface() NOT IMPLEMENTED under Solaris.
    Please contact smartmontools-support@lists.sourceforge.net if
    you want to help in porting smartmontools to Solaris.
    #######################################################################

    Device: /dev/rdsk/c13d0s0, not ATA, no IDENTIFY DEVICE Structure
    Unable to register ATA device /dev/rdsk/c13d0s0 at line 23 of file /usr/local/etc/smartd.conf
    Device: /dev/rdsk/c7d1s0, opened
    Device: /dev/rdsk/c7d1s0, not ATA, no IDENTIFY DEVICE Structure
    Unable to register ATA device /dev/rdsk/c7d1s0 at line 23 of file /usr/local/etc/smartd.conf
    Device: /dev/rdsk/c8d0s0, opened
    Device: /dev/rdsk/c8d0s0, not ATA, no IDENTIFY DEVICE Structure
    Unable to register ATA device /dev/rdsk/c8d0s0 at line 23 of file /usr/local/etc/smartd.conf
    Device: /dev/rdsk/c8d1s0, opened
    Device: /dev/rdsk/c8d1s0, not ATA, no IDENTIFY DEVICE Structure
    Unable to register ATA device /dev/rdsk/c8d1s0 at line 23 of file /usr/local/etc/smartd.conf
    Unable to monitor any SMART enabled devices. Try debug (-d) option. Exiting…

  18. Hey meow, did you enable AHCI in the BIOS? Try typing ‘format’ and then CTRL-C out of it, and look at the drive listing to see if it is showing your drives as legacy IDE devices — i.e. not running in proper PCI mode. Did that change anything?

    Cheers,
    Simon

  19. Simon,

    Great set of guides thusfar, though I am having a few issues with your script, and have grown bored of googleing.

    I have copy pasted your script into a file, edited in my drive ID’s and chmodded the file to make it executable. Though upon execution i receive the following error “xxx@xnet:/tank1/dump/temp# ./test.sh
    bash: ./test.sh: /usr/bin/bash^M: bad interpreter: No such file or directory”

    I have confirmed that my default shell is Bash, as well as tryed changing to the sh shell and it gives the same error.

    Removing that line from the script also nets me the following error;
    “./test1.sh
    : command not found
    : command not found
    ‘/test1.sh: line 5: syntax error near unexpected token `{
    ‘/test1.sh: line 5: `drivetemp () {

    Hope that you can point me in the right direction as I am kind of at a loss here ๐Ÿ™

  20. Simon,

    I am not sure how that managed to sneek into my copy paste but it’s not in the file, I found a workaround and have just manually polled each drive.

    Being none critical I just wanted to see what the drives were running at since i built the new box, 20x hotswap rackmount case, drives are averaging 32*C…. not bad at all ๐Ÿ˜€

Leave a comment

Your email address will not be published. Required fields are marked *