[1/2] From Amazon to Windows 10 on a KVM
Part one — from Amazon to a running computer
How it all started
I have had a dual boot for quite some time, as many of us do. It is always convenient to have a Linux-based OS for flexibility, especially when we are regularly coding stuff. But as a gamer, I find myself almost always running the Windows partition, and end up coding on Windows instead (ugh).
As my current laptop is dying after an unfortunate yet frustrating mechanical rupture of the LCD display holding structure, I realized it was well past time I updated my setup. My previous laptops often fell short of my expectations regarding their life expectancy, so I decided I would rather build a desktop. I would put more money into it, with the expectation that it would last significantly longer and, in the end, turn out to be a better investment.
A new desktop is the perfect excuse for some nerdy experimentation. Incidentally, a friend told me recently about this magical thing called KVM. It’s apparently a VM (Virtual Machine) with seamless access to hardware components through IOMMU. Albeit not expert enough to understand in details how does such a technology work, I get that it makes for a VM with almost bare-metal performance. Which means I can have a Linux-based and a Windows-based machine working concurrently on the same desktop with good performance for both, which is an appealing concept.
What I want my computer to do
The first and foremost feature I want is to be able to run Windows and Linux at the same time on the same computer. But what for? Here are the different things I would like to be able to do with that kind of setup:
- Having a 24/7 Linux-based machine running on my local network, offering different services to the other machines, notable a Synergy server for mouse and keyboard sharing and a Samba server for file sharing,
- Setting up remote access to my Linux system through VPN on my router using OpenVPN, with SSH access and VNC through SSH tunneling,
- Setting up Wake On LAN for both my Linux and Windows systems,
- Using NVidia GameStream to play on my TV from the Windows system (and ideally, from anywhere in the world; talking about portability).
In this first part, I will describe how I built my computer and installed Ubuntu 16.04 LTS on it.
Chapter 1 — A brand new setup
I wanted to go with a gaming setup, with a reasonable budget of about 1,600€, with extra-RAM to run smoothly two concurrent OSes. Here is my shopping list:
- [Case] Cooler Master Force 500 (48€)
- [PSU] Textorm TX600M+ 600 W (58€)
- [Motherboard] MSI Z270-A PRO (106€)
- [CPU] Intel Core i7–7700K 4.2 GHz (327€)
- [Cooling] be Quiet! Pure Rock (33€)
- [Paste] ARCTIC MX-4 4g (5€)
- [RAM] G.Skill 16 GB + 8 GB DDR4 2400 MHz (205€)
- [SSD] Samsung EVO 850 500 GB (150€)
- [HDD] Toshiba P300 2 TB (70€)
- [GPU] Gigabyte GeForce GTX 1060 G1 6 GB (315€)
With a couple additional accessories and software:
- [Mouse] Logitech MX Master (63€)
- [Keyboard] Logitech K800 (78€)
- [USB key] QUMOX 32 GB (9€)
- [Adapter] Mounting frame 2.5"-3.5" (2x 6€)
- [Fans] be Quiet! Pure Wings 2 120 mm (2x 10€)
- [Card reader] ICY BOX 3.5" multi card reader (25€)
- [OS] Windows 10 Family Edition (135€)
- [Keyboard sharing] Synergy Pro (26€)
This setup adds up to a total of 1,685€, slightly above my target. I saved a couple dozen euros waiting for Amazon to suggest lower prices for the most expensive elements (though I probably could have saved even more); I already have a monitor, so I did not need to buy one, this would have brought the total price up to about 1,800€ with a simple full HD monitor.
Fans and PSU
Regarding fans in general, we want to first decide which way we want the air to flow through the case. In most setup, the air flows from the front towards the back; one might wants to choose otherwise, but in the end it doesn’t even matter. What really matters however, is to make sure all our fans are facing the same direction: either all sucking from the front towards the back, or the other way around. I personally chose the former.
Let’s start by customizing a little bit our case, setting up the couple of 120 mm fans in the front for a better ventilation. After taking off the front of the case (there was a handle underneath), I started screwing in my two 120 mm fans. I would recommend passing the fans power cables on the right when you look at the front of the case, this way they will pass behind the 3.5" bays.
Let’s now install the PSU (Power Supply Unit), the power provider of our computer. I would recommend installing it so that the fan is facing upwards if it is mounted on the top of the case and downwards if it is at the bottom of the case: this way, it will suck fresh air from outside for a more efficient cooling. There is not much more to say about it, just make sure it is tightly screwed to the case.
The motherboard and CPU
Here comes the central part of our computer: the motherboard. It’s this thing that will connect all the elements of our computer together, making sure they can effectively communicate to each other. Let’s start by removing both sides of our case and screw the supporting screws for our motherboard. Follow the case instructions to make sure to screw the right ones.
Generally speaking, choosing a computer with fixed budget is a trade-off between portability and flexibility; a smaller setup will comes at the cost of a more constrained build, with fewer ports, less powerful hardware (especially the GPU), less efficient cooling. When choosing our setup, this is an important question to ask ourselves: does the size of the desktop matter? Laptops (especially notebooks) are typically the extreme version of choosing portability over flexibility.
Motherboards come in different sizes, which are technically called form factors: the typical large one is the ATX format, which is a bit large but comes with the most connectors for better flexibility. The micro-ATX is a more compact mainstream alternative, which we would rather choose would we want to have a smaller computer. Because I wanted a rather unconstrained setup, I chose an ATX motherboard, which is the reason why I had to choose a medium-size case. There still exists larger case, but it remains a pretty large one which cannot be easily transported and is not meant to be moved around.
Before anything, we need to set up the CPU (Central Processing Unit) in its case on the motherboard. The CPU is the very core of a computer: it’s the thing that computes all the elemental operations required for the computer to run. Please be careful with this step: a CPU is a small but expensive piece of hardware, and we do not want to damage it.
First, press and move right the metal handle holding down the CPU case on the motherboard, then lift it up. Now, put the CPU in place, while making sure to orient it as shown in the CPU and motherboard manuals; there was in my case a small triangle in the bottom-left corner for that. Now we can close the case. It is a bit tight, on purpose: we absolutely don’t want the CPU to move when the computer is running. Remove the plastic protection on top of the case afterwards.
Before installing the motherboard in the case, we first want to set up the metal plate holding the back panel connectors. We will have to push the motherboard against the plate to screw it to the motherboard; be cautious with the motherboard, but don’t hesitate to push it to align the holes. We can now screw the motherboard to the case. Be careful here: do not screw tightly the motherboard, this would damage it. On the contrary, as soon as the screw is touching the motherboard, stop right there and leave it like that.
The CPU is the component that warms up the most (with the GPU) in a computer. It is essential to provide it with a proper and efficient cooling system. Water-cooling has been quite popular among gamers for its good cooling performance, low noise and great look with LEDs and stuff. But I still prefer a more classic air cooling system, what we call in France a ventirad, which is a big metal structure (the heat sink) to extract the CPU heat with a fan to dissipate it. Setting up the ventirad is the last step that requires careful attention.
Around the CPU, we can see four holes in a square disposition. We will use them to setup the support that holds our heat sink. If we look at the cooling fan manual, there should be instructions describing how to setup the holding plate behind motherboard through these holes. We just have to screw it as instructed.
After that, before going any further, let’s first check how we will set it up: we want the heat sink oriented left-right, with the fans eventually fixed on the right of it. Once we know how to do that, let’s start screwing the structure to hold the heat sink until we are ready to set it up on the CPU. Now is the time to use our thermal paste. We want to spread the paste all over the surface of the CPU to maximize thermal transfer, but with the thinnest possible layer to ensure maximal efficiency. It is a tough step to do perfectly: I have been quite generous with the paste, I probably should have used less than what I did. After making sure there is no dust on the CPU, start spreading.
Once we are satisfied with our layer of thermal paste, let’s install the heat sink on it: make sure to squeeze the thermal paste against the CPU for maximal surface of contact, without overdoing it. That leaves us with the CPU fan to install (if it’s not already fixed to the heat sink), and we’re done with our CPU!
Let’s proceed with our HDD (Hard Disk Drive) and SSD (Solid-State Drive) installation. Those are the long-term memory of the computer, the place where it can store persistently files and data. The main practical difference between SSD and HDD is that the former will be faster with blazing fast read/write speeds, at the cost of being more expensive. Most modern cases have plastic holders to quickly install drives. If you don’t, don’t forget your screwdriver.
This step is usually very simple and quick. We just have to remove the plastic holders on both sides, slide our drives it the desired bay (I always fill them from top to bottom) with the plugs oriented towards the motherboard, and finally put the holders back (or screw it to the bay if we do not have those plastic holders).
I did a mistake that made me lose some time: when using an adapter to install a 2.5" drive in a 3.5" bay, make sure to first screw the 2.5" drive to the adapter before sliding the adapter in the bay.
The process is also the same for any external drive we want to setup; I myself installed a 3.5" external multi-card reader, in addition to my 3.5" 2 TB hard drive and my 2.5" 500 GB SSD.
Now the hard drives are installed, we won’t need to access the back of our motherboard anymore; let’s close the right side of the case.
RAM and GPU
These are the last pieces of hardware we need to setup. RAM (Random Access Memory) is the short-term memory of the computer, the place where programs can store temporary data to run properly; RAM is meant to be accessed very quickly by the computer and more specifically by the CPU, with very fast read/write speed and low latency.
GPU (Graphics Processing Unit) is a piece of hardware dedicated to computing graphical data; it has a specific design to be able to compute very efficiently the mathematical operations required to render the successive images displayed by the computer, which requires the ability to manipulate high-dimensional vectors and matrices. Apart from some more specific uses, the GPU is mostly important in games, where a better one will allow for enhanced graphics and a more fluid frame rate.
The RAM modules go into these long plugs called DIMM slots. Motherboards typically have a preferred order to fill them, please refer to the motherboard manual to be sure where to install the first modules. Before we can install them, we need to open the slots by pushing the plastic holders on both ends of each slot. Once opened, align the module (specifically the little nick on the modules) with the slot and start pushing it downwards, while slightly pulling the holders back at the same time to help engage the modules.
Finally, let’s install the GPU. If the motherboard has one, it’s better to install it on a reinforced PCI slot, as they tend to be large and heavy; this would increase its durability.
Take the GPU, remove the metal plates on the back panel in front of the PCI slot where we will plug it in, press the plastic holder at the right side of the PCI slot, then proceed to insert the GPU in it, while slightly pulling back the holder, in a similar fashion as for the RAM modules. Do not forget to remove the plastic caps on your GPU if there are some.
There usually are holes on the back panel of the GPU to screw it to the back of the case. If so, screw it: the GPU will be more tightly mounted, which is important for such a heavy piece of hardware.
Plugging everything together
The last step before we can turn on our computer is to plug everything to the motherboard. I would recommend to start with all the wires coming from the front: as there should be many of them, it’s a good idea to start with them to avoid any cable mess. Please refer to the motherboard documentation to know exactly where the different connectors are.
The most annoying wires to plug are the front panel header connectors, which include HDD and power LEDs, as well as the power and reset switches. They should be gathered together in an 8-pins shape; it is more convenient to plug them one after the other. Be careful to plug them all in the right pins, following the motherboard manual. On mine, they had to be plugged in the JFP1 pins.
I would go next with the audio, fans and USB. USB3 connectors (called JUSB3~4 on my motherboard) are quite hard to plug in, we should absolutely make sure the pins are oriented correctly (identify the missing pin) before plugging them in. Next, I would plug the audio HD and the USB2 in (on my motherboard, into respectively JAUD1 and JSUB1~2). Next are the case and CPU fans: there are three pins and four pins models, for respectively DC and PWM power control. They both fit into the four pins plugs on the motherboard. If you need to install a three-pin connector, align it with the small plastic holder along the connector to plug it in correctly. I plugged the case fans into SYS_FAN1~3 and the CPU fan into CPU_FAN1.
It is quite easy to incorrectly plug these different connectors: do not hesitate to double check that the connectors are correctly facing the pins. Specifically, it often happens that a connector is shifted one pin to the side, with a few pins not inserted inside the connector.
Let’s install now our power cables: first, make sure the PSU is unplugged and turned off. There should be first two main power connectors for the motherboard: an 8-pins one to power the CPU and a 24-pins one to power the rest of the board. We have to plug them both for our motherboard to work properly. On mine, the connectors are called CPU_PWR1 and ATX_PWR1.
We then have to connect our drives. They actually require two connectors: one from the PSU, a large and flat one, which is a SATA power connector, and one to the motherboard, a shorter one, the SATA data connector. With a modular or semi-modular PSU, there should be a cable to plug to the PSU with the proper SATA power connectors. Plug the power connector before the data connector. With a right angle SATA cable, it is recommended to plug the right angle to the drive for better cable management.
In addition, most GPUs also require a specific power supply (mine required an 8-pin connector); if so, add a cable from the PSU to the GPU with the right connector to supply it with power.
Finally, a little bit of cable management cannot hurt: with a couple cable ties in hand, grab together cables that are close to each other and tie them together for a cleaner layout. I tied together the power cables from my PSU and the numerous cables coming from the front panel.
Chapter 2 — BIOS setup
Now that the system is starting properly, let’s set up a couple things in the BIOS of the motherboard. The BIOS is a basic system installed on the motherboard to allow for some basic configuration and control. To access it, there should be a key bind displayed in the boot screen; for me, it was the “Del” key. Modern BIOS (called UEFI) have USB and mouse support, which makes it more convenient and user-friendly. After checking that the motherboard recognizes every piece of hardware installed to make sure everything is plugged and working correctly, I tweaked a couple things:
- My two 120 mm front fans have PWM connectors to adapt their speed, while the motherboard uses DC control by default; I changed my BIOS settings to use PWM control instead with them,
- The RAM modules were recognized as running at 2133 MHz by the motherboard, while they were supposed to run at 2400 MHz; I hence updated their clock speed to 2400 MHz,
- I also activated XMP to improve performances.
There were also a couple of features to enable that we will need afterwards:
- Enable Intel VT-d (it’s called AMD-V for AMD CPUs) for my CPU, to enable the computer to use the IOMMU technology, which I found under “OC > CPU Features > Intel VT-d tech” on my motherboard,
- Enable Wake On LAN, to ensure the integrated Ethernet controller would be able to listen to the network even when the motherboard is turned off, which was under “Settings > Advanced > Wake Up Event Setup > Resume By PCI-E Device”.
Finally, as we want to dedicate the GPU to Windows, we probably want to boot with the Integrated Graphics Display (IGD) for Ubuntu; on my motherboard, this option was found under “Settings > Advanced > Integrated Graphics Configuration”.
Once this is all done, save and reboot the machine.
Chapter 3 — Installing Ubuntu
Because I am lazy and used to it, I decided to install Ubuntu 16.04 LTS as my primary OS. To do that, I downloaded UNetbootin on another computer, plugged in the USB drive, chose the Ubuntu 16.04 LTS 64 bits distribution and installed it on the said USB drive.
Once the bootable USB key ready, simply plug it in the newly built desktop and turn it on. This will boot the system from the USB drive and ask if we want to install Ubuntu (we do). After a couple easy steps (keyboard layout and stuff), the installer will ask if we want a custom install (we do). I wanted to choose myself my partitioning layout, especially to dedicate my 500 GB SSD to Windows, so I installed it on my 2 TB HDD with the following setup:
/dev/sda150 GB ext4, mount point
/, for the Ubuntu system,
/dev/sda28 GB swap, for swap memory,
/dev/sda3500 GB ext4, mount point
/srv/samba/share, for a shared folder on my local network,
/dev/sda41.44 GB ext4, mount point
/home, for my home documents.
/dev/sda and leaving
/dev/sdb (the SSD) unused. Once confirmed, this should smoothly install Ubuntu. If it warns about some UEFI stuff, don’t worry about it.
After doing it, I realized it was not optimal: I should have set the
/home partitions next to each other, to ensure I can easily resize the partitions if need be. Or better yet, I should have used LVM for a more dynamic setup.
Because I want direct access to the
/home/username folder from my Samba share, I added a symlink
/srv/samba/share/username -> /home/username, where
username is the name I chose for my account. This will allow me to also share my home documents across the local network.
This was the first part of the story about how I built and set up my brand new desktop. The second parts details how I configured the computer to enable the different features I want: keyboard and mouse sharing, file server, and most importantly the Windows KVM itself. You can find the second part of this story here.