What about a virtualization server at home

Why virtualization at home

I personally think that virtualization is the absolute grown up toy, except better. When you’re a kid you broke your toy and that’s it, maybe your dad can fix it once, even twice but then what? But with virtualization, nooooo… you can break it, tear it apart again and again and it’s still there, brand new and ready to be broken again. And you won’t even get bored of it, because possibilities are endless !

It’s good to play with, to learn new stuffs, to practice, to experiment work related things, and it’s free, so why not?

What hardware to buy


So this is how I built my virtualization server. The good thing about virtualization is that there are some components you don’t need too fancy, so we can manage to keep the server affordable. You don’t need graphic card at all, the embedded one is more than enough (except if you want to do some pass-through but see my other post for that), processor and hard drive depend on how fast you want your virtual machines to be, and you can forget any kind of player device. The only thing you really need is memory, a lot of it, because how many machines you can run at the same time depends on it!

So here is the list of what I bought, it is not cheap because I wanted a good processor but that stays affordable. Keep in mind I wanted a box supporting pass-though and 32 Go RAM so some of the choices are based on that, but you can get cheaper if you don’t need these features.

  • Asrock H87M Pro4 (This one is because it supports pass-through, you can fin cheaper if you don’t mind)
  • Intel i7-4770 (I guess AMD works find too for a lot cheaper, I was undecided for a long time but finally choose Intel because I though it would be quicker, still don’t know if it worth the price but it is really fast !)
  • Kingston DDR3 1600 8Go x 2 (at least 16 Gigs, I might buy another 16 gigs but price drop again)
  • Western Digital WD Blue SATA III 1 To (this is not slow, not fast but it’s enough for now)
  • Kingston DataTraveler Micro 8 Go (to install ESXi, though 4 Gigs is enough)
  • Corsair CX Bronze – 430W (you don’t need 1000w for this, especially without graphic card !)

This is pretty much what you need for a nice virtualization server, no more than that, you can even lower the processor and the motherboard if you are prepared to wait a little bit longer when you work.

So now you bought everything you need, you just have to install ESXi 5.5. I did it a certain way because I wanted to be able to use my box also with Windows when not working, but you cab just install ESXi the normal way if you prefer. We will :

  • use the usb key to install ESXi 5.5 so we don’t lose space on the hard drive, and it will be easier to switch between windows and ESXi at boot time. ESXi run everything in RAM anyway so don’t worry about performance.
  • use the disk to install Windows, create a datastore and a data partition for windows. In this way we can use our server as a normal windows computer when we need too. (We will see in another post how to use windows and the ESXi server at the same time). Yes I don’t have to much money, and when I buy a brand new 900$ computer, I intend to use it for everything!

Installation

Step 1 : Prepare ESXi iso

After register at VMWare and downloading ESXi 5.5 iso, you still have one more step to do before installing. Indeed, our server being a desktop computer and not officially supported, the network interface, which is intel I217v on this motherboard, is not supported and won’t work as it is. You need to download WMWare customizer, the intel driver e1000e already packaged as a VMWare bundle (.vib) and use customized your the iso to include the I217v driver. I recommend you this blog which explains this really well.

esxi-customizer

Embedding I217v’s driver in ESXi iso

 

Step 2 : Install Windows

If you plan to have also windows on your disk, this is the right moment to install it, using let’s say a 100 Gigs partition. If you don’t want to have dual boot on your computer, you can skip this and go straight step 3.

 

Step 3 : Install ESXi

You can know copy your newly created iso on an bootable usb key to install it on your server (actually on the usb key). To do so you can use UNetBootIn, but don’t forget to format your key using fat32 filesystem, not ntfs if you’re using windows. Then boot on the key, you should be able to install ESXi, and the I217v network controller should work.

Step 4 : Create your datastore

If you don’t have windows install on your disk this step is fairly easy, connect to your brand new ESXi using VMWare vSphere Client ant create the new datastore. This will erase everything on the disk (which means nothing) to create a 1 To datastore.

However if you have installed Windows and intend to keep it, this will be a bit trickier because VMWare vSphere client wants to erase everything while creating a new datastore. So at this moment you will have to create the datastore partition using a VMWare command line tools. First set up the ssh service so we can connect to the ESXi. Using the VMWare vSphere Client, go to TODO TODO. You can connect the root user. True we should create a new user dedicated to ssh access but keep in mind this is a lab server…

Now connect with your ssh client and let’s see what partition already exist. Execute this command :

partedUtil getptbl /vmfs/devices/disks/t10.ATA_____WDC_WD10EZEX2D60ZF5A0_______________________WD2DWCC1S7945775

Of course don’t forget to replace t10.ATA_____WDC_WD10EZEX2D60ZF5A0_______________________WD2DWCC1S7945775 with your disk using auto-completion (don’t use the :1 et :2 variation which are the partition)

You’ll see an output looking like this :

121601 255 63 1953525168
1 2048 718847 7 128
2 718848 209715199 7 0
partedUtil list

List all partition with partedUtil

We don’t care about the first line. The second and third line are your two current partitions. First number is partition number, second is starting sector, third ending sector, fourth is partition type (7 is NTFS, 251 will be VMFS datastore) and fifth is some attributes. You can refear to the partedUtil’s help to find more information.

Now you’ll have to use some math to calculate the starting sector and ending sector depending of the size you want. This is pretty easy, you only need to know your sector’s size, usually 512 bytes.

If you don’t know your sector’s size, you can figure it out knowing your windows partition’s size. For me it’s 100 Gigs. So 209715199 – 718848 is 208,996,351 sectors. (100 * 1024 * 1024 * 1024) / 208,996,351 = 513.76, i.e. 512 bytes per sector.

So anyway, just divide the size you want in bytes by 512 (or your sector’s size) and you have your number of sectors. Example: I wanted a 400 Gigs datastore, so 400 * 1024 * 1024 * 1024 is 429,496,729,600 bytes, divided by 512, which lead to 838,860,800 sectors. So we will create a partition starting one sector after the second partition ending sector and ending 838,860,800 sectors later. that is starting at sector 209,715,200 and ending at 1,048,576,000 (209,715,200 + 838,860,800). So with that, let’s create our datastore partition, using the following command. You need to rewrite every existing partition accurately, if you don’t do any mistake, it will not change anything and your data will be safe but I think at this point doing a backup is a good thing to do!

partedUtil set "/vmfs/devices/disks/t10.ATA_____WDC_WD10EZEX2D60ZF5A0_______________________WD2DWCC1S7945775" "1 2048 718847 7 128" "2 718848 209715199 7 0" "3 209715200 1048576000 251 0"

Of course adapt to your partitions.

partedUtil create

Create new partition with partedUtil

The final step to create your datastore is to format the freshly created partition. To do so use the following command:

vmkfstools -C vmfs5 -b 1m -S NewDatastore /vmfs/devices/disks/t10.ATA_____WDC_WD10EZEX2D60ZF5A0_______________________WD2DWCC1S7945775:3

The disk name :3 are to adapt as usual. The 3 is the partition’s number you use when you’ve created the datastore partition. You can also change the datastore name if you like.

vkmfstools

Format a partition using vkmfstools

Now you just have to connect to your ESXi using vSphere client and refresh your datastores.

vSphere Client new datastore

That’s it! Your ESXi hypervisor server is up and running. Boot on your usb key where ESXi is installed and everything should work. If you want, you can also boot using windows and create a partition after the datastore to fully use your disk and store some data on windows.

Leave a Reply