I just recently bought a new computer with the purpose of
Replacing my dying HTPC
Setting up a VM Server for all my little projects
I wanted to be able to kill two birds with one stone on this purchase. So I turned to VT-d (also known as IOMMU, Directed I/O, and AMD-V). This allows a hypervisor to provide direct I/O access to a piece of hardware. You can get really excellent performance out of it as in this youtube video:
Yes, that’s one computer running two (really 3 if you count dom0) operating systems playing two games at once. Essentially it’s one computer acting as two computers. Notice the smooth (i.e. lag free) graphics.
Here’s the parts I picked up (~<$1000):
Intel Core i7 3770 (don’t get a K, as these don’t have VT-d)
ASRock Z77 Extreme4 (this mobo was shown to support VT-d here)
Here it is working. This is a screen shot of a Windows 7 VM running as domU on xen.
I passed through the HD 6450 video and audio (HDMI) pci devices to the Windows 7 VM. I also passed a usb controller so I could use a mouse and keyboard.
The result is that I have a VM that has pretty much no performance loss. I ran Furmark on this system, while native and while inside the VM on HDMI to my TV. There was no frame loss (granted Furmark only runs at 5 fps @ 1024×768 on this card).
You’ll notice that this card has a really low Aero performance. Not sure why, but I found that while running Windows natively as well. A quick check online shows it’s happening with others as well. I don’t really notice it so oh well.
There are a few issues with this setup. First off I couldn’t get my pci-passthrough’s to persist over restarts of the host dom0. So I wrote a script that detaches the pci devices from dom0 and then starts the VM.
#01:00.0 VGA compatible controller: ATI Technologies Inc NI Caicos [AMD RADEON HD 6450]
virsh nodedev-dettach pci_0000_01_00_0
#01:00.1 Audio device: ATI Technologies Inc NI Caicos HDMI Audio [AMD RADEON HD 6450]
virsh nodedev-dettach pci_0000_01_00_1
#00:1d.0 USB Controller: Intel Corporation Panther Point USB Enhanced Host Controller #1 (rev 04) -- 2x grey 2.0 ports on back.
virsh nodedev-dettach pci_0000_00_1d_0
xm start win777
Unfortunately, I couldn’t get this to work when I placed it int /etc/rc.d/rc.local as xend hadn’t started yet when rc.local was run. So I can only start my Win7 VM manually.
Another way I tried to fix the above issue is by using xen-pciback.hide feature on the dom0 kernel so it doesn’t take over these pci devices. I placed the following line in /etc/sysconfig/grub
That didn’t work either. As far as I can tell it has something to do with my kernel lacking modprobe modules.
The second issue is that the HDMI Audio crashes after the system has been up for a while. I plan on leaving this machine on all the time (running Rosetta@Home when I’m gone). This is supposedly a known issue, at least to Dizzy (not sure about Xen).
I got a little confused about the hard drive setup. My initial plan was to passthrough the SATA PCIe card I bought. This should have worked. In fact, the VM was able to detect the card and the SSD on it, but I couldn’t get it to boot my Win7 image instead of the empty SSD on the SATA Card. I also tried booting to a DVD Drive that I placed on the SATA Card. It recognized the dvd drive but kept on trying to boot the empty SSD and didn’t give me an option to boot the DVD.
Finally I figured out that Dizzy was just passing through the /dev/sda1, which was the SSD connected to dom0. This worked great. I initially had performance issues as seen below.
Crucial M4 on SATA2 controller. IDE emulation passed via /dev/sda1 to VM
But then I put the M4 on a SATA3 controller and performance went up. Again passed through to domU from dom0 as /dev/sda1 in IDE emulation
This was a really fun project and I’m glad I did it. But unfortunately the audio crashing after a while, combined with the lack of persistant pci passthrough which makes this VM have to be manually started, are deal breakers for me. I’m going to try VMware’s ESXi implementation of VT-d next. If that doesn’t work, I’ll settle with Windows 8’s Hyper-V.
Maybe in a few years the Xen VT-d experience will have improved. For now, Onwards!
I previously used Blank Your Monitor + Easy Reading on Firefox to change all pages on the browser to black background and white text. Now that I’m mainly using Chrome, I didn’t have this functionality. I just found a way around it.
Found a used 4.4 cu. ft. Danby DCR412BLS on craigslist for $65 bucks. Figured it’d be a good kegerator for my ball lock kegs I grabbed from Midwest Supplies (Brew Logic Dual Tap Draft System).
After reading this post on homebrewtalk I enlisted the help of my brew buddy and set to bending down the freezer section. Here’s a photo log.
Here’s the refrigerator before modifications. I yanked out the trays and let it get to room temp for about 4-5 days.
This is the freezer tray that we’ll be bending back. I plan on putting my CO2 tank and regulator outside the fridge so I don’t need to bend it back all the way.
This is the temp control unit. Three philips screws on it. I removed this to get the freezer tray to bend down.
The tray has 4 phillips screws holding it in place.
Another view of the freezer tray.
The temp controller line just slides out of the little clip. You might have to give it a good tug to get it out. Also you can see the pipe that you’ll be bending down. I heard from the forums to bend at the back of the pipe (near the wall). But more on that later…
Here we removed the temp controller. It just slid out (towards the fridge door). After that the freezer tray was freestanding.
Here we slid out the temp controller. We also unscrewed that clip in the back. Probably didn’t need to do that.
Now we were ready to start bending back the freezer section. Dum dum dum!
I read too much on the internet about freon and got a little paranoid. My brew buddy and I had some hefty gas masks lying around so we put em on before going any further. Probably overkill but hey– safety first right!
We heated up the pipe just a little to make it easier to bend. I could still touch it to move it. Took about 3-4 breaks in between and really concentrated on taking it easy.
Unfortunately we created *this* in the pipe. I’m still not positive if it’s just a paint crack or the pipe itself. All I can say is yikes!
We put some soapy water on it and didn’t see any movement (besides gravity). Then we plugged it in and heard a slight hissing. Still no movement on the soapy water. We left it hanging around for about an hour and it froze up all of the soapy water around the crease/hole. It also kept the fridge pretty cool (~40F).
So I’m thinking it’s not a hole but the paint cracking. Gonna leave it running in the garage for a while and see if it maintains temperature. Might have to run a cable down there and add it to my temp sensing network. (Muahaha).
So after running it for a while it seemed to be keeping things cold. It didn’t stop like I’d expect if it was cracked. I hooked up another temp sensor to it to monitor it’s temps. Below is a graph of my Magic Chef 2.7 cu. ft. bottle fridge (in green) compared to the Danby DCR412BLS Keg Fridge (in black). As you can see the Keg Fridge is running too cold for beer — 34.53F average. This is with the knob at it’s hottest setting. Bummer
So I did some more researching and ran across this post on HBT that talks about an adjustment screw. There should be two– one coarse and one fine. I looked around on the thermostat controller for the DC412BLS and I think I’ve identified it. Unfortunately it’s blocked by the casing.
WARNING!!! Disconnect your fridge before touching the metal on this controller. Trust me you don’t want to shock yourself.
Here’s a really bad view of the screws I’m talking about. There’s two there on the top. Look inside the oval.
After pulling the fridge power plug, I took a pic of the leads (black, red, yellow) to remember their position) and then disconnected them.
So I drilled a hole in the casing for easier access. In the process of doing that I accidentally partially decapitated the fine adjustment screw. Doh.
Anyhow after that hole was drilled in the plastic casing, I could get to the coarse screw. I rotated it one direction for a couple of turns. We shall see if it works in a few hours.
The adjustment screw worked great. You’re going to want to turn it clockwise to increase it’s temperature. Here’s a graph showing the increase in temperature after turning it clockwise. I believe this was two turns.
I fiddled around with the coarse adjustment to get it in the right state. Then it was on to removing the side paneling on the door. If you just pull back the rubber there are about 8 screws that you undo. Then the panel just pops off. Remember to keep the rubber seal as you’ll need it in the next steps.
We bought what Home Depot calls “White Panel Board”. It comes in huge dimensions but its only 12 bucks. We had them cut it down for easier transportation. We guestimated the size so we’d have extra space on the edges.
Then we took the side panel that we just yanked off the door and set it on top to get the dimensions and holes for the screws. And it was off to cutting with a electric saw blade.
Then we fitted the rubber gasket back onto our new whiteboard panel. Pay attention to the orientation of the rubber seal. We found it didn’t seal right on our first try. so we rotated it upside down, i.e. 180 deg, and it fit perfectly.
And screwed it back onto the door. This is harder than it seems but keep working on it and you’ll get there. This part is probably a two person job, with one person holding it in place.
Looking pretty good.
We then tried fitting the two kegs in there. It worked but it was a tight fit.
We then started shaving down the sides to provide more room for our two kegs. We did this with a razor blade knife. If you apply a thin amount of pressure and then carefully pull back you can cut through the plastic. It’s pretty thin. You’ll see a picture below.
So we decided to keep the CO2 tank outside of the refrigerator so that the regulators act right. There were reports of it not regulating correctly inside the fridge on HBT. Plus there’s the space issue. So we decided to drill a hole.
CorneliusAlphonse was kind enough to take a pic and show a diagram of where he ran his lines on the DCR412BLS. However he ran his lines right above the compressor. The beauty of his setup is that he didn’t have to punch through any metal as there was a plastic plug where he ran it. But it was right on top of the compressor so we were worried about heat.
So we decided to try and punch through the metal and shift it over to the left of the compressor (when looking from the back). There’s a nice empty space.
And now we get into ‘how not to do it’. That metal is harder than it seems. This was amplified by the fact that we just happened to drill our hole on the edge of the metal. We started drilling from the top. See below.
If you’re going to do it our way, move the hole back further so it’s not on the angle of the metal below. Better yet, get the right tools for cutting through metal. I’m sure there’s a specialized hole cutting drill for this metal. We used a plastic cutting hole for the top and then ended up using a nail and hammer on the metal until we could punch it out. Lots of work and jagged edges.
We taped up the jagged edges with duct tape and sealed everything up that way. There’s still a hole in the fridge. I’ll update later on how it functions with this hole.
A closer look. Notice you can see the coils in the back of the fridge. That might help you pinpoint where we drilled.
There were thoughts of using a rubber gasket cut in a star format to pass our lines through. (I believe they’re actually called grommets) Something like the water cooling on computer cases.
There’s also thoughts of foam insulation for piping to seal up the hole.
I wanted a way to graph the temperatures of my home brew and throw alarms at me if it goes out of the bounds. I know that’s not RDWHAHB, but I figured it’d be a fun project anyway.
So I settled on 1-wire as my sensing network. The beauty of 1-wire networks is their simplicity. Each device on the network has a unique ID. Then all you need is a ground and a data line. Since the temp sensor I used can work off parasitic power, I don’t need a third voltage line. So the software just does a query for the temps of all sensors and they start spitting out their unique id and the value. Pretty awesome.
I grabbed a couple of Dallas DS18S20 IC temp sensors and a Dallas DS9490R USB adapter. The adapter takes in RJ11 (really only two wires) and converts it to USB. The usb adapter is plugged into an old laptop running Ubuntu 11.10 and digitemp. On top of digitemp I have another software package called dtgraph making it oh so very pretty. More about how all these work and how to set up later. But first a few pictures!
Here is what the graphing system looks like. I have mine to log every 15 min. Below we’re seeing 13 hours with all three sensors. Notice that you can see when the fridge turns on and off. Nice!
Here I’ve set it to view 28 days. Again this logging every 15min and you can see that it captured 2,565 temperatures. It’s only showing 726 of them to save on render time. You can make it show all if you check the Repeats and All Data. Renders pretty fast on my 10 year old laptop.
Here’s the size of the mysql database after logging every 15 min for 29 days.
root@jdrews-M2Ne:/var/lib/mysql/digitemp# du -h
So really not too bad.
Here’s what the DS9490R 1-wire to USB adapter looks like plugged into my laptop
I have the beige RJ45 cable coming out of the DS9490R going into a 5 RJ11 breakout box as shown below.
All three cables have DS18S20 sensors at their ends. The grey cable is a telephone cable I hacked up and the blue ones are standard cat5 cables that I crimped a RJ11 onto the end. All you really need are two cables — data and ground. If you’re running really long cables you might need a voltage line, but if it’s less than 30-40ft you should be good.
Enough talk here’s the sensor taped onto my carboy. Got a American Pale Ale on the way!
And here’s one going into my refrigerator. I stripped back the insulation and extra wires to make the cable smaller. It seals pretty well like this as the cables are fairly small. One day I’ll drill a hole and caulk. Right now it’s taped up with electrical tape. We shall see how well that handles the cold.
Also note that there are 4 wires gong in, but I’m actually only using 2. The white ones just keep the sensor hooked onto the tray, and consequently centered in the middle of the fridge.
Here’s the outside sensor. I was able to slip it under the window sill and shut and lock the window. Make sure you put it in the shade or it might tell you it’s 138F outside. 😉 This part of the house stays shaded all day.
I wrapped it in a small plastic ziplock and then sealed up the end of the ziplock with more electrical tape. Then I sealed it up again with a rubber band. Close up below.
Now to the hardware details. If you’re just dealing with parasitic power (i.e. no Vdd line) you’ll just need two wires, data and ground. The DS18S20 has three pins as seen below
So for parasitic power you’ll solder the GND to Vdd. Grab a CAT5 cable and strip down two wires (I used orange and green). Solder a line on your CAT5 to the GND+Vdd and another line to the DQ (data line). Pay attention to your colors.
Now on the other end you’re going to crimp the CAT5 into a RJ11 (this is your standard telephone line). I don’t suggest using a telephone line as the wires are so thin that my solder gun burned through them (grr!).
Ok now that we have the reqs down lets set up the mysql database to hold our temps. In this case my database is called stats.
mysqladmin create stats
Then use dtgraph’s scripts to create the structure in your new database.
mysql -u -p stats < mysql_create_digitemp_metadata.sql
mysql -u -p stats < mysql_create_digitemp.sql
mysql -u -p stats < mysql_create_digitemp_alarms.sql
If you get a warning that looks like the following, just change your ‘TYPE=MyISAM’ to ‘ENGINE=MyISAM’. This is happening since we’re using a different version of mysql.
ERROR1064(42000)at line6:You have an error inyour SQL syntax;check the manual that corresponds toyour MySQL server version forthe right syntax tousenear'TYPE=MyISAM'at line13
Now we’ll create a user for digitemp and grant it privileges to our new stats database. Log into mysql.
mysql -u root stats
And grant the rights to your new user, dt_logger
GRANT SELECT,INSERT,UPDATE ON stats.*TOdt_logger@localhost
So the database should now be setup. Lets get the website going.
Copy the contents of the ‘www’ folder in your dtgraph folder (the one we untar’d) to /var/www/dtgraph. You might need to create this folder. Feel free to name it something else if you want.
mkdir -p /var/www/dtgraph
cp -r www/* /var/www/dtgraph
Set the permissions on your conf.php to read and write. Group should suffice.
You’ll want to edit the conf.php and add in all your configuration info. Here’s the first half of mine with all the important changes. Pay particular notice to the digitemp_conf, the sql username and password, and the jp_path.
//The dir path under which jpgraph.php and others can be found
//This may be relative or absolute (filesystem, not url)
Ok now that that’s done let’s make sure you can see your webpage. Go to http://localhost/dtgraph (or whatever you named your folder). You should see the webpage. If not check to make sure apache and mysql are running. You could also see a blank page if index.php is not a default page type. If so go to http://localhost/dtgraph/index.php. Lastly start reading through the INSTALL file in dtgraph and see if there’s something we missed. 😉
Now lets set up the logging. I’m going to be using the logger.php that’s included with dtgraph. It pulls it configuration values from the conf.php file so as long as that’s set up correctly you should be able to run the following and get it to insert data into your digitemp database.
Now log into your mysql database and see if you have data. If all went well it should look like this.
root@jdrews-M2Ne:/var/www/dtgraph# mysql -u dt_logger -p stats
Reading table information forcompletion of table andcolumn names
You can turn off thisfeature togetaquicker startup with-A
Welcome tothe MySQL monitor.Commands endwith;or\g.
Your MySQL connection id is459
Copyright(c)2000,2011,Oracle and/orits affiliates.All rights reserved.
Oracle isaregistered trademark of Oracle Corporation and/orits
affiliates.Other names may be trademarks of their respective
Type'help;'or'\h'forhelp.Type'\c'toclear the current input statement.
Horray we have data! So let’s add some more datapoints by running the logger.php script a few more times. Now go look at your website again and you should see plot points. If not, you most likely have an issue connecting to the database. Check your conf.php and make sure it’s all correct.
You set up the colors of your graph and the name of your sensors in the admin section. Here’s a helpful hint– Put your thumb and index finger on a sensor and watch the temp go up to figure out which is which.
You’ll notice I have alarms set for range and change amounts. To do this you’ll need to use sendmail or ssmtp (how I did it).
I’ll update this post later on how to set up ssmtp so your new fangled temperature monitoring system can send you alerts when your precious homebrew gets to warm/cold, or starts warming up/cooling down too fast.