July 11, 2013

How to Upgrade Your Linux PC Hardware

So there I was with a perfectly good desktop system running various flavors of Linux, and then I says to myself, I said "Self, it's time for an upgrade!" My old system ran on an AMD Phenom X3, a mere 4GB RAM, and a ragtag gaggle of external audio interfaces and multiple printers, all housed in a nice quiet Antec case. It was my main system for three years, a stout workhorse that handled every crazy thing I tried to do with it: audio and video production, server UEFI BIOS screen shotexperiments, and virtual machines galore. Multimedia and virtual machines are demanding of system resources, and that was all the excuse I needed to drop a few hundred clams on new innards: Intel i7-4770K quad-core CPU, 16GB memory, a flashy fancy Gigabyte GA-Z87X-UD3H motherboard, and a couple 2TB hard drives for just because. This is about four times more powerful than my old system.

Choose Hardware Components

So what's involved with a major upgrade like this for Linux users? Hardware compatibility isn't the problem it used to be, especially with better-quality components, and it's not unusual anymore for vendors to claim Linux support. The quickest way to learn of any Linux hassles is to search the user reviews on busy sites like Fry's, Amazon, and Newegg.

Watch your motherboard size. The trend is for smaller boards, but this Gigabyte board is a full-sized board that fills the Antec case. I like the bigger cases because they are easy to work in, quiet, and cool.

Choose your power supply wisely. I'm not a hardcore gamer with multiple video cards and overclocking, so I don't need some stadium-capable multi-fan mondo-watt monster. Newegg has a great article on calculating how much power you need, and picking a compatible PSU with the right connectors. A nice option is modular cabling, which lets you use just the connectors you need for a clean and uncluttered case.

New motherboards are very finicky about their RAM, and if you install the wrong memory modules your system will be unstable. The best resource for choosing the exactly correct RAM modules is the memory vendors' own compatibility databases, because motherboard vendors only test a limited number of modules and don't update their information. All the major RAM manufacturers have their own memory finders, like Kingston's for one example. Dual-channel modules come in pairs, and you must place them in the exactly correct slots. If you're hanging on to older internal expansion cards such as video, audio, network, or Firewire time is marching on-- PCIe is not backwards-compatible with AGP and PCI, and if you're clinging to any IDE drives they might not be supported either.

A Corsair DDR3 RAM moduleIntel vs. AMD is one of those endless debates. AMD costs less and delivers a lot of bang for your buck. Intel makes great processors with excellent Linux support. My Gigabyte board has onboard Intel gigabit Ethernet, HDMI audio and 3D video, and they just work. Probably the video is not adequate for an über gamer, but it plays Tux Racer and GL screensavers just fine, and handles Blender 3D animations without hiccups.

UEFI Secure Boot

There are two ways to dodge UEFI Secure Boot follies: buy your computers from ace independent Linux experts like System76 and ZaReason, or buy motherboards. Don't buy Windows 8 systems (unless you really want Windows 8); you can disable Secure Boot in the BIOS, but the the method varies with different vendors, and sometimes it takes more than just disabling it to boot Linux or external media because of tricksy "features" like malformed partition tables. The major Linux distributions have adapted to our sparkly new Secure Boot overlords in various ways, but it's still a pain in the keister. (Please read Matthew Garrett's journal to get the straight story on Secure Boot.)

UEFI-- Unified Extensible Firmware Interface-- replaces the stodgy, antiquated old PC BIOS which has long been entirely inadequate for modern systems. UEFI is a little operating system and is very flexible, and can support a raft of add-on applications. Which, in the case of my Gigabyte board only work in Windows, which is a testimonial to the inertia of market-dominant poo.

Identifying Hardware in Linux

Let's take a stroll down Identifying Hardware on Linux lane, because you can learn everything about your hardware without opening the case. Remember to update your pciidsdatabase regularly, so that the lspci command will give you current information. Do this by running the update-pciids command. The PCI ID repository is maintained by Martin Mares, Michal Vaner, and various volunteers, so you can send them thanks and product data if you have it.

Alrighty then, armed with updated information (/usr/share/hwdata/pci.ids and /usr/share/misc/pci.ids on Linux Mint) let us see what is connected to the PCI bus of my shiny new beast:

$ lspci                                                                                              
00:00.0 Host bridge: Intel Corporation 4th Gen Core Processor DRAM Controller (rev 06)                              
00:02.0 VGA compatible controller: Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor Integrated Graphics Controller (rev 06)                                                                                                     
00:03.0 Audio device: Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor HD Audio Controller (rev 06)         
00:14.0 USB controller: Intel Corporation 8 Series/C220 Series Chipset Family USB xHCI (rev 04)                     
00:16.0 Communication controller: Intel Corporation 8 Series/C220 Series Chipset Family MEI Controller #1 (rev 04)  
00:19.0 Ethernet controller: Intel Corporation Ethernet Connection I217-V (rev 04) 

And much more. lspci -v gives detailed information, and lspci -k names the kernel modules:

$ lspci -k
00:1b.0 Audio device: Intel Corporation 8 Series/C220 Series Chipset High Definition Audio Controller (rev 04)
        Subsystem: Gigabyte Technology Co., Ltd Device a002
        Kernel driver in use: snd_hda_intel
        Kernel modules: snd-hda-intel

What if you want to know more about a particular kernel module? Try the modinfo command to spit out a ton of information:

$ modinfo snd_hda_intel
filename:       /lib/modules/3.2.0-23-generic/kernel/sound/pci/hda/snd-hda-intel.ko
description:    Intel HDA driver
license:        GPL
srcversion:     E9BB291A81F648652C216F8
alias:          pci:v00001022d*sv*sd*bc04sc03i00*

The Gigabyte board supports SATA revision 3.0, which is (theoretically) 6 gigabits per second data transfer. If you've accumulated a stack of hard disks how do you know how fast they are? The hdparm command tells the tale:

$ sudo hdparm -I /dev/sdc | grep -i speed
           *    Gen1 signaling speed (1.5Gb/s)
           *    Gen2 signaling speed (3.0Gb/s)
           *    Gen3 signaling speed (6.0Gb/s)

All SATA standards are backwards-compatible, so this drive will work anywhere.

Finding Info on USB Devices

Now what about your USB devices? Yes, Linux has a command for those too, lsusb:

$ lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 004: ID 047f:0ca1 Plantronics, Inc. USB DSP v4 Audio Interface
Bus 003 Device 005: ID 0763:200f Midiman M-Audio MobilePre
Bus 003 Device 006: ID 058f:6254 Alcor Micro Corp. USB Hub
Bus 003 Device 007: ID 046d:c00e Logitech, Inc. M-BJ58/M-BJ69 Optical Wheel Mouse
Bus 003 Device 008: ID 03f0:3217 Hewlett-Packard LaserJet 3050
Bus 003 Device 009: ID 0bda:8187 Realtek Semiconductor Corp. RTL8187 Wireless Adapter

You can also learn extremely detailed information about your devices and USB buses with the -v switch. For example, the bcdUSB descriptor field tells your USB specification, which is 1.1, 2.0, or 3.0. 1.1 is dual-speed, either 1.5 Mbit/s "low speed" or 12 Mbit/s "full speed". 2.0 is 480 Mbit/s, and 3.0 is 4 Gbit/s. (Of course these are theoretical, and in real life your transfer speeds are lower.) I use my favorite awk incantation to get the detailed spec on a single device, like this abbreviated example that shows my MobilePre digital audio interface is bus-powered, USB 1.1, and it supports sampling rates from 8kHz to 48kHz:

$ sudo lsusb -v | awk '/MobilePre/,/^$/'
Bus 003 Device 005: ID 0763:200f Midiman M-Audio MobilePre
Device Descriptor:
  bcdUSB               1.10
  idVendor           0x0763 Midiman
  idProduct          0x200f M-Audio MobilePre
        (Bus Powered)
    MaxPower              200mA
      AudioStreaming Interface Descriptor:
        tSamFreq[ 0]         8000
        tSamFreq[ 1]         9600
        tSamFreq[ 2]        11025
        tSamFreq[ 3]        12000
        tSamFreq[ 4]        16000
        tSamFreq[ 5]        22050
        tSamFreq[ 6]        24000
        tSamFreq[ 7]        32000
        tSamFreq[ 8]        44100
        tSamFreq[ 9]        48000

There is a command to update your USB database too, update-usbids. This is maintained by Stephen Gowdy.

I have a great fondness for the USB bus because it's dead-easy to plug in anything anytime. Remember the bad old days of serial and parallel ports, and how hard it was to connect peripherals? Figure 3 shows the back of my PC with a gaggle of devices plugged in, and there is a front USB panel too.

That nice new Intel i7 processor with four physical cores? Thanks to hyperthreading it appears to your operating system as 8 cores. To see all your cores run top and then press the 1 key:

 $ top
top - 07:35:37 up  1:21,  3 users,  load average: 0.45, 0.56, 0.57
Tasks: 223 total,   2 running, 221 sleeping,   0 stopped,   0 zombie
Cpu0  :  1.0%us,  0.3%sy,  0.0%ni, 98.3%id,  0.3%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu1  :  4.3%us,  0.7%sy,  0.0%ni, 95.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu2  :  1.0%us,  0.3%sy,  0.0%ni, 98.7%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu3  :  0.3%us,  0.0%sy,  0.0%ni, 99.7%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu4  :  0.0%us,  0.3%sy,  0.0%ni, 99.7%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu5  :  0.0%us,  0.3%sy,  0.0%ni, 99.7%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu6  :  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu7  :  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:  16321076k total,  6266676k used, 10054400k free,   946456k buffers
Swap:  4485116k total,        0k used,  4485116k free,  2099644k cached

In our next installment ( Using the New GUID Partition Table in Linux ) we'll look at preparing a hard disk for a new Linux installation, and learn about the GUID Partition Table (GPT), and other issues related to UEFI.