A20-OLinuXino-LIME server with 320GB HDD works on LiPo battery over 6 hours


We have server rack with several x86 servers running Linux with our work file repositories, the ERP and etc.

They are quite power hungry as lot of HDDs are connected to them in RAID mirrors to prevent data loss.

We are located in industrial area and power supply glitches are not uncommon, specially during the winter.

To keep the servers alive during power downs, we had to buy expensive 2000 EUR UPS, which actually keep them no more than 20-30 minutes up when power is down, so basically just to allow you 10-15 minutes to finish your work and then to shut them down properly before the battery is drained.

This UPS has lead-acid batteries inside which has to be changed every 3 years and cost almost as much as the UPS itself.

Initially we kept our all Olinuxino Linux images on Gdrive, but there were few issues with this, the images grew to many Gigabytes, and Gdrive start to restrict the access to the files after some limits were reach, so we decided to host these images by us on torrent. We decided to make separate server for this due to security reasons, we just wanted to keep our local network private and to allow external access only to this isolated server which we access also from outside like other users.

To keep it as low power as possible we setup one A20-LIME + HDD320GB + 6600mAh LiPo battery. This configuration works well several years already.

Yesterday our power supply provider EVN warned us that they will change mains high voltage cables in our area and Olimex will have power supply cut from 9.00 to 15.00, so we had to take day off.

We came today and sure we found all x86 servers down, but to our surprise the LIME with the HDD was working fine all these 6 hours of power blackout and didn’t shut down!

We know that with 6600mAh battery the LIME will last at least 10 hours as it uses 1.5-2W, but the HDD is rated 5W (5V/1A), so we were expecting less time stand alone operation.

It was good surprise to see that actual consumption is less, maybe the HDD enters stand-by mode when not used?

35 Comments (+add yours?)

  1. Александр Луцай (@SL_RU_Dev)
    Jan 07, 2016 @ 17:10:29

    Awesome! :3

    BTW, how is business with laptop?


  2. Александр Луцай (@SL_RU_Dev)
    Jan 07, 2016 @ 17:15:15


    BTW, how is business with your laptop?


  3. progmetalbg
    Jan 07, 2016 @ 17:33:23

    Last year I tried A10-OLinuXno-LIME + old 40 GB Toshiba rated 5V/1A + 4400 mAh battery – it kept the board & disk alive for 7 hours; 14 hours without disk.


  4. PaceyIV
    Jan 07, 2016 @ 18:51:19

    Where is the rootfs: on the SD card or the SATA hard drive?


    • OLIMEX Ltd
      Jan 07, 2016 @ 22:30:14

      rootfs is on the SATA drive


    • LinuxUser
      Jan 12, 2016 @ 00:30:50

      Btw, Olimex spotted fairly obvious thing :). Using OlinuxinoLime and somesuch one can make quite a fancy “mini-CDN” thing at dirt-cheap price, yet working very reasonably. “UPS” solution has never been cheaper, and with righ SW and tuning, e.g. by using nginx or lighttpd as HTTP server, these little things can actually handle quite a lot of traffic. Allwinner isn’t very good at write speeds, but for read-mostly things like server(s) serving linux images, etc it sounds very reasonable. And even more fun to have gigabit link on your side, as long as you have got decent Internet uplink.

      To get more speed one can use e.g. DNS round-robin to distribute load. Single device do not have to be huge and power hungry, if you go for dstributed structures. It also inherently fault-tolerant if you do it right.


  5. Thomas
    Jan 07, 2016 @ 22:34:10

    A 5V/1A rating for a 2.5″ disk defines peak consumption while spinning up. When just spinning it’s way lower and in sleeping/standby state nearly nothing.

    You should both emphasize that on your Lime boards a SATA disk will be fed through battery/PMU (most other A20 based boards can not power the disk when running on battery) and you should try out my sunxi add-on for RPi-Monitor since then you would know precicesly how much the disk and the whole board consumes (should work with your Debian image flawlessly and takes 5 minutes to install): http://forum.armbian.com/index.php/topic/155-testers-wanted-sunxi-adjustments-for-rpi-monitor/


  6. Matija „hook“ Šuklje
    Jan 08, 2016 @ 00:25:54

    That’s *really* cool! 😀

    I’m thinking of using the Lime 2 for my private server as well, but sadly I have two 3.5″ HDDs to plug into it. How would you power them along with the Lime 2?


    • OLIMEX Ltd
      Jan 08, 2016 @ 08:38:50

      3.5″ HDD require 12V and it’s possible to implement but this is not good option as additional step-up from 5V to 12V is necessary like https://www.olimex.com/Products/Breadboarding/BB-PWR-3608/open-source-hardware


      • Matija „hook“ Šuklje
        Jan 08, 2016 @ 10:49:09

        I know that bit, that’s why I’m asking.

        Would it make sense to add a separate power supply for the disks and if so, (how) can I connect them to a battery/UPS?

        I realise my use case is more hackish than your proposed solution. But I can’t just throw away two perfectly fine 2 TB disks.

      • Thomas
        Jan 08, 2016 @ 12:12:36

        Most 3.5″ disks need up to 2A on the 12V rail alone at startup/spin-up. Could this peak power consumption be compensated somehow eletronically (with a large capacitor or something like this)? Since this would translate to 5A/5V when using a DC-DC step-up converter and I really doubt the AXP209 can handle that?

      • LinuxUser
        Jan 12, 2016 @ 00:11:15

        …and making 12V for 3.5″ motor sounds like waaaay too power hungry thing for LiPo battery. Whatever, 3.5″ HDDs were never designed with real power saving in mind. And their startup current can be quite large. Possibly dropping battery voltage below critical levels and so on.

    • Thomas
      Jan 08, 2016 @ 11:02:38

      Forget about powering 2 3.5″ disks through the LIME2’s AXP209 PMU (necessary when running on battery). Therefore you need a 12V PSU anyway for the disks and a separate UPS if you care about power outages. Next problem: How to connect the disks: The A20 is able to be used with SATA port multipliers but it’s wrong to do so (see the linux-sunxi link).

      Best use case for 2 disks: Use the 2nd as backup device for the first (connected to another LIME in another location)


      • Matija „hook“ Šuklje
        Jan 08, 2016 @ 11:55:27

        The two disks two devices idea is not bad at all.

        I could simply have one 3.5″ HDD on the Lime and use the BB-PWR-3608 to have that disk on the battery as well. That box would then be the new web/… server.

        For the second disk I could simply reuse my DreamPlug and turn it into a backup server. The only trouble is I have no bloody idea how to get emergency power to that one.

      • Matija „hook“ Šuklje
        Jan 08, 2016 @ 12:07:59

        /me slaps his forehead

        I just remembered that I need a UPS for the router and modem in the first place, so I can just attach the DreamPlug+HDD to that UPS as well. Silly silly silly me.

        Any suggestions?

      • LinuxUser
        Jan 12, 2016 @ 01:01:34

        >> Matija „hook“ Šuklje: Suggestion is: UPS converts low battery voltage to mains voltage. Then power supply converts mains back to low voltage. Needless to say, double conversion warrants you a poor efficiency. And lead-acid batteries aren’t really good in their lifetime in UPS, power density and so on. Your setup would work, but it quite large, costly and inefficient overall. Only makes sense if you need mains voltage for something else. E.g. to shut down some large computer correctly.

      • Matija „hook“ Šuklje
        Jan 12, 2016 @ 10:05:45

        OK, so it seems that:
        – two 3.5″ HDDs powered by one OLinuXino are out of the question
        – one 3.5″ HDD powered by one OLinuXino is still very likely not doable, since it needs more than 1A (in my case the WD Red needs max 1,73 A)
        – a conventional UPS for a low-powered device is very inefficient

        (partial) solution so far:
        – one 3.5″ HDD on one OLinuXino with external power for the HDD and BtrFS
        – one 3.5″ HDD on another OLinuXino (or the old DreamPlug) with external power for the HDD and BtrFS, which stores filesystem snapshots from the first device

        crazy ideas, that still need feedback:
        – rip the electronics out of the HDD tower I use for now (Chieftec CEB-2235S to connect both disks as JBOD to the SATA PMP of the DreamPlug) and use re-assemble it in a new DIY box to power the two HDDs
        – hack some powerbanks to connect between the power supplies and the devices (router, modem, disks) to for some kind of a UPS

        Would a powerbank be able to power a 12V 3A (that’s what the HDD tower currently needs) or does that need some serious tweaking? Does something like this exist? If not, how can I hack one up using mostly parts on Olimex?

      • LinuxUser
        Jan 13, 2016 @ 08:19:46

        >> Matija „hook“ Šuklje
        Two 3.5″ HDDs are actually far larger and take far more power than Lime itself, which would be strange solution to my taste. 2.5″ HDDs are usually targeting notebooks and so they have drasticaly better power management and able to start using 5V only. Though it can take special care, for server use one may want to limit power saving to sane behavior: HDDs can withstand only limited number of startups and head load/unload cycles.

        Worst part about all HDDs is startup current. It much higher than average one, lasts for about 1-2 seconds and I doubt your monitoring got adequate resolution to spot these. At spin-up HDD consumes far more current than written on its label. It only lasts a few moments. But it puts serious demand on power supply and so on. Should supply voltage drop below critical, even for second, system could lock up or reboot, etc. On large servers it goes as bad they have to use staggered spinup. Else bunch of drives starting at once can consume such a high current power supply trips short circuit protection, or power rails voltage just drops below acceptable limits.

        SSDs are good for in quite many regards: they do not need mechanic actions for power save, state transitions are fast, they do not have to waste power on rotation, and they do not have inrush currents anyhow close to HDDs. But hey are quite expensive per gigabyte, sure. And can withstand only limited amount of writes. Which isn’t major trouble on read-mostly upload servers, etc. But can be nasty in other cases.

  7. dbdavidtwn
    Jan 08, 2016 @ 04:47:19

    how about to give us a lesson to build a A20-based DNS, NAS


  8. zoobab
    Jan 08, 2016 @ 14:58:21

    “It was good surprise to see that actual consumption is less, maybe the HDD enters stand-by mode when not used?”

    Actually it depends on the firmware on the HDD controller. Years ago I investigated how I could make an HDD sleep (because it should have slept 99pc of the time), and I ended up with hd-idle and some hdparm tricks:


    Furthermore, if it is acting as a file server, you could cache the most popular files in RAM. I used that feature of lighttpd, but you could also think at more complex approaches, such as caching first from an SSD, and then only hitting the woken up spinning disk:


    But by making it sleep, you will save a lot of energy.


  9. zoobab
    Jan 08, 2016 @ 16:19:15

    You could/should combine a spinning-on-demand HDD with an SSD in front that does not spin and consumes less energy. You could use dm-cache so that the SSD is a big cache to the bigger HDD.

    Nslu wiki had some interesting instructions on hiw to make your disk drive spindown when not in use:


    I think those tricks to spin it down should also be valid for SATA disks.

    You could also think of using the spare RAM to cache the most frequent files in RAM (lighttpd does this), but you could also combine dm-cache for a RAMdisk and an spinning disk.

    Lighttpd has some features to cache the most frequent files in RAM.


    • Thomas
      Jan 08, 2016 @ 16:56:50

      There exist even SATA drives that ignore spindown settings. In this case a script checking diskstats helps like this one: https://github.com/lynix/hdd-spindown.sh

      But it’s really not necessary since the difference between an idling 2.5″ disk and one in standby/sleeping state isn’t that big. And unlike other A20 boards on every LIME you can measure consumption through AXP209/I2C/sysfs. This is 2TB drive: when spinning idle it’s just 0.6W more than in standby: http://kaiser-edv.de/tmp/WNQG19/hdd_consumption.png

      And even when disk accesses happen from time to time it’s still just 0.5W more. Even when both CPU cores are 100% busy and heavy random access patterns to the disk occur the whole consumption seldomly exceeds 5.5W on a LIME/LIME2.


  10. zoobab
    Jan 08, 2016 @ 17:09:25

    Also, another radical way to save power consumption is to put your server in suspend-to-ram mode, and for each packet knocking at the door, you could have a openwrt router in front of it waking up the server. I did it with knockd waking up a Dell laptop sleeping, and it was taking up 2 or 3 secs to wake up (with an SSD). The power consumption was greatly reduced.


  11. Jiri Wiesner
    Jan 11, 2016 @ 15:40:12

    Folks at Olimex, I applaud your enthusiasm!


  12. LinuxUser
    Jan 12, 2016 @ 00:04:33

    I guess using SSD (or maybe reasonably fast USB stick) can lower power consumption by heck a lot. It do not haves power-hungry spindle motor, after all.

    Also, most setups use relatively high lowest CPU clocks. By letting lowest clocks to lower value and reducing core voltage, one can get quite some extra reduce in power consumption. Caveat it potentially higher latency, but it can be improved by proper tweaking cpufreq things, etc.


    • Thomas
      Jan 12, 2016 @ 13:44:09

      @LinuxUser: Guessing is not necessary with any LIME/LIME2 since you can monitor ALL this stuff easily! And reality looks different: http://kaiser-edv.de/tmp/UhHm0C/Lamobo_R1_2TB_disk.png

      (This is a Lamobo R1 featuring an additional switch IC and Wi-Fi therefore consumption is always 1.0-1.2W higher compared to a LIME2). A 2TB disk just rotating needs only 0.6W more compared to standby/idle. And at 9:45 the device starts to record 5 video streams with 40% CPU load and cpufreq increased from 144 MHz to 912 MHz: Just another increase in consumption of just 0.5W. And at 10:00 transcoding of the 5 raw video streams to MP4 happened: High disk I/O and 80% CPU utilisation: Just another 1.7W increase in consumption.

      If this would’ve been a LIME2 then consumption even under full load with 2.5″ disk would not exceed 5W in such situations. Before I used RPi-Monitor and added the thermal/consumption stuff from A20/AXP209 I also thought you wouldv’e to adjust this and that. But reality looks different and it’s so easy to get a clue on any LIME/LIME2 since all this stuff can be monitored easily 🙂


      • LinuxUser
        Jan 13, 2016 @ 08:33:36

        Well, I guess your graphs only give some very rough idea about what really goes on. Properly monitoring switched power supplies is tricky thing. But still, gives overall idea.

        And 2Tb disk – I guess you really mean 2.5″. Because 3.5″ can easily take about 5-10W just to keep rotation and much more than that during spin-up.

        And as for transcoding streams: have you used HW encoder? And 5W is quite a lot, if we have 6600ma*h battery, we can expect about 24W*h of power. So it would last for maybe 5 hours. Not so bad, but if we compare against e.g. tablet, idling for few days using same battery… and Allwinner itself is of this kind.

  13. Thomas
    Jan 13, 2016 @ 09:41:40

    @LinuxUser: This is the output of RPi-Monitor using the *internal* measurements of the AXP209 PMU every LIME/LIME currently relies on. Of course it’s a 2.5″ disk, HW encoder ist not available since it’s just transcoding from ‘raw h.264’ to MP4 and the 5W mean heavy disk I/O and CPU load.

    Also as already written: A LIME/LIME2 is more power efficient than Lamobo R1 since there’s no Wi-Fi and no switch IC on the board. Normal ‘server consumption’ of a LIME/LIME2 with a power efficient 2.5″ HDD is very low. And as also already written: Monitoring is easy (RPi-Monitor with sunxi adjustments — I wonder why Olimex doesn’t include that into their OS images)


  14. Thomas
    Jan 13, 2016 @ 09:44:09

    @Matija „hook“ Šuklje: I stumbled across this power bank that features 5V and 12V output and _might_ be sufficient as UPS for LIME/LIME2 and 3.5″ disks: http://www.cnx-software.com/2016/01/11/multi-function-power-banks-can-start-your-car-beside-charging-your-phone/


  15. Khalil Gibran
    Mar 07, 2016 @ 12:09:54

    Please get FreeBSD working on this… FreeBSD is closest to Debian in terms of packages, has excellent filesystem, and lightweight containers.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: