Archive for the ‘virtualization’ Category

Migration to a new lowpower server (Thinkpad T420)

Monday, November 24th, 2014

I recently bought myself a spar’o’meter, (kill’a’watt like device) which is able to measure the power usage of electrical equipment. To my horror I found that my “lowpower” AMD fusion based server consumed around 50 watt! Clearely something had to be done.

Luckily I had the right piece of equipment at hand. A lenovo thinkpad T420 with a broken/shattered LCD. Any decent laptop is built to minimize power consumption, so using an T420 alone would save on the electrical bill, but I went a bit further. More precisely:

  • Took off the (broken) TFT and disconnected it from the mainboar
  • Took out the bluetooth module
  • Took out the wireless module
  • Disabled all unneeded peripherals, serial ports, usb ports,
  • Bouht myself a 1TB WD red 2.5″, which consumes around 1 watt.
  • Removed the DVD drive.
  • Enabled maximum power settings in the bios.

I then put in 2 x 4GB of memory and together with the core i5 cpu, this would be a nice server with a built-in “ups”. On the software part, I migrated away from one big server years ago. I run esxi on my servers now. There was a small issue here, as ESXi 5.5 does not have support for the Intel Gigabit 82579 LM chip out of the ISO file.

This is not a biggie. You patch the iso with the correct driver for the E1000E chip using the esxi-customizer script and then you boot the customized .iso file.

I ended up with a esxi host that consumes 12 watt. A factor 4 better than my old AMD fusion based setup. And it feel snappier as well. The trade-off: I had to go from 2 x 2TB disks to 1 x 1TB. But that alone saved 10-15 watt.

Restoring a wordpress site by scraping/crawling google

Sunday, January 13th, 2013

I love challenges, but once in a while the tend to be way tooo big! During my christmasholidays I accidently wiped my home server. I wanted to do some LVM stuff online, remotely, without console access, through the ESXi console. … and really thought that nothing could go wrong ;-). First assumption being wrong.

To make a long history short. I shot myself in the foot and was without a server for a 3-4 days. When I got home again, I thought a simple reboot and some LVM magic would make everything all right. Second assumption being wrong.

So in the very end I had to reinstall my server from scratch. Luckily I backup my stuff using and so should you! It will save your butt some time!

It turned out that, for some bizaro reason, my database had not been dumped to csv files. So in the end I came to these conclusions:

  • I lost my database.
  • I thus lost my wordpress blog.

🙁

But loving challenges I refused to let that be the end. I thought about using archive.org, but they did not really have a new crawl of my site.

I decided to crawl google! Not as easy as it might sound for a couple of reasons:

  • Google does not like being crawled …. at all. If googles infinite number of computers discover that you are crawling them, then your IP will be blocked from seeing their cached content.
  • When you enter keywords into google you normally get thousans of links to follow. I needed one. The correct one! The one that was a cached version of my site.

So I fired up my editor and utilized the great WWW::Mechanize. I ended up with this script, which do all the hard work of scraping google. It will take some time to complete — hours and days even! It will get there though. If you try to speed things up it will take longer as you will be blocked by google when they detect you are scraping them. Be warned. Been there. Tried that. Got blocked.

Having retrieved all of my old site through google I had to parse these pages and import them into wordpress. So again I fired up my editor and wrote this little script. For this to work, you have to have

    • a clean wordpress installation with a hello world post
    • XMLRPC writing enabled in WordPress, as the script uses WordPress::XMLRPC.
    • the following in wp-config.php
      define( ‘AUTOSAVE_INTERVAL’,    3600 );     // autosave 1x per hour
      define( ‘WP_POST_REVISIONS’,    false );    // no revisions
      define( ‘DISABLE_WP_CRON’,      true );
      define( ‘EMPTY_TRASH_DAYS’,     7 );        // one week

So in the end what did I loose and what did I learn? I lost my comments on my site. Or more preciesely: I have them,but I will postpone putting them back in until I get the time to fool around with coding again. And I learnt a lot about tripplechecking my backup for all their pieces before doing storage related work remotely without a proper console!

Installing OS-X on ESXi 5.0.0, 469512 running on an AMD Fusion APU

Monday, August 13th, 2012

I wanted to run OS-X at home, preferrably on my AMD Fusion based ESXi 5.0.0, 469512 host. If you search the net for that combination you will find a lot of posts about people having issues and not many about people having a great success. Digging into this it turned out to be relatively simple to do.

  1. Obtain OS-X Snow leopard ISO image
  2. Obtain Donks OS-X unlocker for vmware. I used unlock-all-v110.zip
  3. Backup you ESXi host and VMs before doing anything! I am not liable in any way for any issues you encounter! It worked for me. Your millage may vary and that is actually your problem ;-)
  4. Patch ESXi with Donks unlocker by unzipping the zip file on the ESXi host and running esxi/install.sh. Make sure to read the readme file beforehand and make sure that all the prereqs are in place before you start!
  5. Reboot your ESXi host and hope for the best.
  6. After a successful reboot of ESXi with Donks patches, create a new OS-X based VM. 64-bit, 4GB memory, 1 processor (and one processor only, otherwise you will get panics during installation), LSI Logic Parallel SCSI, E1000 network
  7. Do NOT power up the VM.
  8. Enter the ESXi cli.
  9. Browse to the location of the VM on the ESXi datastore
  10. type vi *.vmx <enter>
  11. remove all references to CPUID
  12. insert the following CPUID information (this will make ESXi present the VM as a core2duo based machine to the guest allowing OS-X to boot on the hardware)
    hostCPUID.0 = "0000000668747541444d416369746e65"
    hostCPUID.1 = "00500f100002080000802209178bfbff"
    hostCPUID.80000001 = "00500f1000001242000035ff2fd3fbff"
    guestCPUID.0 = "00000006756e65476c65746e49656e69"
    guestCPUID.1 = "000006f10000080080802209078bfbff"
    guestCPUID.80000001 = "00500f1000001242000003e92bd3fbff"
    userCPUID.0 = "0000000668747541444d416369746e65"
    userCPUID.1 = "00500f100002080080802209078bfbff"
    userCPUID.80000001 = "00500f1000001242000003e92bd3fbff"
    cpuid.0.ebx="0111:0101:0110:1110:0110:0101:0100:0111"
    cpuid.0.edx="0100:1001:0110:0101:0110:1110:0110:1001"
    cpuid.0.ecx="0110:1100:0110:0101:0111:0100:0110:1110"
    cpuid.1.eax="0000:0000:0000:0000:0000:0110:1111:0001"
  13. Save the vmx file
  14. Attach the Snow Leopard ISO to the VM and boot it.
  15. Perform a normal OS-X installation.

Nothing much actually. The final solution

And seen from vnc

 

 

Quite simple …. as promised :-)

Reducing RHEL5 idle cpu usage under esx

Tuesday, July 5th, 2011

Today I installed two RHEL5 servers on my ESXi rig. To my surprise they idled at around 300MHz?! My Debian 6.0 based server and my Win2k3 based server idles at around 50MHz, sowhat was the problem?!

Looking inside the vm showed that the vm was idle. So what was going on here? I tried to use vmxnet3 instead of E1000. I tried to stop a lot of services. To no avail.

It turns out that it is the frequency of the context switches. Edit /etc/grub.conf and add divider=10 to the ‘kernel’ line and reboot the beast. Usage will drop to sane levels!