Facebook Twitter Gplus LinkedIn RSS
 
 
Home » Bitcoin » Mining Bitcoins in ESXi using an XFX 7970

Mining Bitcoins in ESXi using an XFX 7970

Published on December 24th, 2013

This is a very specific article meant to target a very small subset of geeks out there. Sure, there are many of us geeks, and a large number have heard of this craze the last few years called Bitcoin. After Bitcoin became popular, like tv news popular, a number of crypto-coin spinoffs have surfaced. I’m not going to go into the merits (or scams) of the various altcoins out there, but a very popular one called Litecoin is what got me started in the mining hobby.

cryptcoins

As anyone getting into mining learns quickly, cpu mining is not very popular because quite frankly it sucks. Using your GPU is where it is at for the home user, yielding easily 10 times the speeds of the CPU. Bitcoin is now mined only using dedicated miners, so if you are planning to mine Bitcoin this late in the game, don’t bother. However, there appears to be some speculative profit in mining other scrypt-based coins, like Litecoin.

If you decide to mine with your GPU, use whatever you have until you truly know what you are doing. It is easy to think the whole thing is a slam dunk money fest, and done right, it might be, but don’t spend thousands of dollars up front for naught. For example, ATI video cards are much better at mining then nvidia, which is why they are sold out everywhere!

If you can get your hands on an ATI video card, XFX is probably the brand you will land, because they suck, haha. I have a XFX AMD HD 7970 that I got for gaming for around $300 a little while ago. I got lucky because since as of today (a day before Christmas), they are moving for $450+ on eBay. The problem with this particular brand is two fold, they run hot as hell, and they seemed crippled when you start mining, getting half the speeds of other brands with the same model of chip.

Using the default cgminer 3.7.2, I pulled a mere 450 KH/s with:

cgminer -I 13

After a lot of research on the Internet, it seems other people with 7970 cards were getting 700+ KH/s. I was not pleased with a mere 450 KH/s. After a ton of command line tweaking, I was able to get into the 530 KH/s area with:

cgminer -I 13 -g 2 -w 256 –thread-concurrency 8192

Still not pleased, being I was getting less than 700, a lot of Googling lead me to someone who swapped the XFX firmware bios on the card with a Gigabyte version. Flashing the firmware can be a dangerous proposition as it can lead you to brick your card, but a majority of the time, you can just boot up on another video card (hope you have one handy) and flash back your old bios. So be sure to back it up using GPU-Z and do your homework.

I downloaded the Gigabyte bios after backing up my current XFX bios to a safe place. I can’t stress enough to backup your bios! There are a lot of writeups to boot to a dos disk, but I was lazy and used the ATIWinFlash tool to avoid all of that. A little warning though, it failed the first time I tried to flash, but all I had to do was hit the flash button again and voila, success!

After rebooting, I was now getting right around 700 KH/s with the following:

cgminer -I 13 -g 2 -w 256 –thread-concurrency 8128 –gpu-powertune 20 –gpu-engine 1040 –gpu-memclock 1825

For most people, they’d be done now, but I wanted to run this GPU in my ESXi farm. Why? Because I already run an ESXi farm and don’t want to leave a 300W gaming rig running all day. Mining is already a gamble. If you can remove most of the power costs, it is only profit left!

In vSphere 5.5, VMware really improved the passthrough capabilities of ESXi. They still suck, but one thing added was GPU support for View. I tried very hard to get my nvidia GTX 470 working with ESXi, and failed. Once again, ATI shines and I’m able to get it working with the following tips:

  • Make sure you are not using the video card as the ESXi Host’s boot device. Change it in the bios to boot to another video card (like the onboard one) or this whole thing will not work.
  • Enable passthrough for all the devices that ESXi detects. In my case, there is a video and audio driver.
  • Load the correct driver before setting up passthrough.

After three reboots, I was able to see the AMD HD 7970 in the device manager. However, when I used the same cgminer commands:

cgminer -I 13 -g 2 -w 256 –thread-concurrency 8128 –gpu-powertune 20 –gpu-engine 1040 –gpu-memclock 1825

I began getting a crappy 500 KH/s again. I loaded a GPU-Z, and noticed that my VM could not see memory clock speeds, core clock speeds, or even GPU temperature. This makes sense from a virtualization point of view; however, it means the VM is ignoring cgminer’s overclock settings.

In my searching, I stumbled across an ATI bios editor. With this, I’m able to download the firmware from my card (using GPU-Z) and then edit the base core clock and memory speeds! If this whole topic hasn’t scared you yet, and you are still feeling brave, do double check you have those firmware backups handy. Using the tool, I change my gpu core clock speed to 1040 and the memory clock speed to 1825.

And there you have it, ~700 KH/s on an XFX AMD HD 7970 graphics card, in an ESXi virtual machine!

cgminer

About the Author: Sprawl

Stephen Russell is a Mobile App developer and all around IT geek that spends his days running data centers and his nights coding. This site is the go to place for all of zSprawl’s work and the infamous development blog. In his free time, he enjoys tinkering with web code, playing video games, and otherwise plotting to take over the Internets.


 

17 Responses

  1. Fred

    Google brought me here, this is actually an idea I’ve been tossing around for a while.

    Well, originally the idea was to have low-end cards, using HDMI-over-Cat5 to pump video to my living room and two bedrooms, and similarly USB-over-Cat5 (or USB-over-ethernet) for keyboards and such. When Bitcoin started taking off a few months ago I began using my old 6950 to get a couple bucks profit per day (plus a little extra from trading and such).

    Now, I’m considering an idea such as yours using a few R9 280X cards and adapting my idea to mine when I am not on the “computers” (i.e. at sleep, at work, or in a different room).

    Meanwhile, I would have other VM’s running for various things around the house (fileserver, AD, Plex, thinking about running pfSense, etc).

    A few questions:
    – Do you game on this card when it isn’t mining?
    – What’s the performance like in gaming?
    – Do you have issues with input lag over USB?
    – Is the ESX box in your office/computer room or is it stashed out of the way? If it’s stashed out of the way, how do you get video and USB up to your terminal?
    – I know XenDesktop/XenServer has had amazing VGA passthrough support for quite a while now. Although doing this in ESXi would probably be much more worthwhile for me professionally (mostly-Cisco network engineer with dabblings in VMware, Netapp, and MS), have you heard of anyone doing this through Xen?

    • I will try my best to answer your questions, but I’ve done what you are suggesting. I don’t have cable TV for example, but I use an HDHomerun to pickup TV. I use Plex. I got mrtg running. I got another box downloading content, and now a VM mining (well two).

      – I do not game on these cards because they are in an ESXi box and I wouldn’t game in a VM. Some people put ESXi on a USB stick, so they can remove it and reboot into Windows for gaming, but I have a gaming rig for this that I leave powered off. It has an nvidia card in it, so it isn’t worth the utility costs to mine.

      – I have no issues with input lag over USB because the cards are not the primary graphics driver. For example on my gaming rig, when I run cudaminer (the nvidia miner) it lags my mouse heavily. But in the VM, I am using the onboard video as the primary and the ATI card is just another PCI device.

      – These ESXi boxes are headless, since ESXi boots to a barebones console. I use remote desktop and since these ATI cards are not the primary display, it works fine.

      – When I started researching at first, Xen was the only thing that anyone talked about for passthrough. A few threads on ESXi basically talked about failure. I tried with my nvidia GTX470, and could not get it to work. Then I found a wiki article where someone got an ATI to work (older model), so I bought one to try, and it did, but limited. I can not access the core clock, temperature speeds, etc. hence the flashing of the firmware.

  2. Adrian

    Hi Sprawl,
    just to let you know, I am successfully mining on a R9 290 card which is in my ESXi environment.
    I didn’t try windows, but tried BAMT 1.2 (https://litecointalk.org/index.php?topic=2924.0).
    Cgminer in BAMT had no problems with adjusting the clock speeds (both gpu-engine and gpu-memclock). No need to flash the GPU bios with overclocked settings.
    ESXi doesn’t detect the GPU properly (reports it as “Unknown VGA device” but the passthrough worked.

    P.S. I’m using ESXi 5.1, and a MSI R9 290 GPU.
    P.P.S. I do have an issue where if the VM is rebooted, BAMT’s can’t detect the card anymore. I have to reboot the whole ESXi server for BAMT to detect the card again.

    • Interesting. Thanks for the information! I’ve been wondering if it is worth using BAMT in ESXi. I may just try for giggles.

    • nwbz

      Hi Adrian, I’am planning to buy R9 290 very soon, is your hashrate 940KH/s?
      If that’s your hashrate, I am looking through your config.

      1.Could you please provide more detail on your system?
      2.Is BAMT OK for running in your opinion?
      3.’MSI R9 290 GAMING 4G’ AND your ‘MSI R9 290’ are the same ?

      Thank you in advance.

      • Adrian

        nwbs,
        Remember that every card is different. That being saif I was able to push that MSI card to 940Kh/s.
        I have on oreder some ASUS and Powercolor R9 290 cards and will experiment with those to see what I can get out of them.
        I prefer BAMT since it can be set up VERY quickly and it has all the tools you need right there. It has been for me at least.

        As for the MSI card, I think the GAMING 4G one is the new design that has 2 large fans on the side of the card. I am using the older card (reference design) with one fan.

        I don’t know if the performance is the same.

    • Dilbert

      How do you get the .img file into esxi?

  3. Ant

    Hello,

    great blogpost.What hardware do you use besides the xfx radeon 7970.Which motherboard , cpu and secondary grafics card etc?

    Cheers
    Ant

  4. Steve

    Hi

    I think i am happy i found this blog. lets hope so, i have not tried your fix for the xfx card yet but i am aiming to.
    I have just bought 3 XFX HD7970 Black edition 1000/1425, with the reference single fan.
    Do you think that the Gigabyte BIOS will work on these babies as well.

    Thankful for an answer

  5. RpR

    Hi,

    you ever tried to run BAMT or SMOS in esxi?
    How did you install the vmware tools?

Leave a Reply

© 2012 zSprawl's zApps

Fork me on GitHub