hardware CPU issue

One of the early complaints about Linux was hardware compatibility. If you were starting out with Linux 7 to 10 years ago, you would frequently encounter situations where your hardware simply was not supported by Linux. This is becoming less of a problem with each passing year. Currently, Linux offers support for a wide range of hardware; however, there are still some issues that need to be addressed. In this chapter, we will discuss those issues.

Also in this chapter, we will discuss some fundamental hardware concepts. It is most likely that you already know some of this material; however, I frequently encounter network administrators who do not have a good understanding of the hardware their servers run on. So we will also cover some fundamental hardware knowledge. Even though some readers will already know some of this material, I encourage all readers to at least give a quick read through this chapter. You may find some gaps in your knowledge that can be filled in.

Specific Hardware

In this section, we will look at specific hardware elements in your server. In some cases, there is no issue with Linux support. But when a given piece of hardware can have issues with Linux, we will discuss that.

Motherboard/CPU

The motherboard is the main circuit board on your computer. All other devices ultimately have to plug into the motherboard, either directly or indirectly. This is also where RAM will be plugged into, as well as expansion cards.

The CPU or Central Processing Unit is the “brains” of all computers. Most people in IT know this, but may not be aware of the architecture of the CPU itself. This is often unimportant for standard desktops, but in the case of high performance servers, it can be an issue.

The first fact to be aware of is that the CPU is not a monolithic item. It has subparts that communicate with each other. Those parts are:

  • Arithmetic Logic Unit: This part of the CPU is responsible for basic mathematical operations. All computation can eventually be broken down into basic arithmetic.

  • Floating Point Unit: This portion of the CPU is responsible for calculations involving decimal numbers (for example, floating point numbers). Early CPUs did not have this, but for many years it has been a standard part of CPUs. At one point these were separate from the CPU and were called math coprocessors.

  • I/O Unit: The input/output unit is responsible for managing traffic of data into and out of the CPU.

  • Control Unit: The control unit coordinates all CPU processing.

  • Registers: These are small storage areas ranging from 8 bits for the original x86 processors to 128 bits for the Itanium processors. There are several types of registers, including data registers, address registers, and general purpose registers. The CPU uses these to temporarily store data during calculations.

In addition to the parts of the CPU, there is the cache memory. These are very small amounts of memory designed for the CPU to store information temporarily. While smaller than RAM, these are significantly larger than registers. There are three types of caches. L1 cache is actually located on the CPU chip. L2 cache is found in the case with the CPU. Finally, L3 cache is located on the motherboard. Now this may seem like an esoteric topic for a network administrator; however, caches can affect the performance of your server. Essentially, the larger the caches, the more effectively your processor can operate. This is irrelevant for most desktop applications, but if you have a server that is handling a heavy workload, performance can be improved by using a motherboard/CPU combination with a larger cache size.

An important issue to consider is whether to have one or more CPUs. It is commonplace today to have a CPU that is dual core or quad core. That means that the CPU has two or four actual CPU chips in the case/chip you buy. This means two to four independent CPUs, each with its own control unit, arithmetic logic unit, registers, and L1 cache; however, the cores share an L2 cache. The cores also share the connectivity to the motherboard. These two and four core processors are the norm in modern computers and do provide enhanced performance. But for servers, there is a better option: the use of multiple processors.

Servers will often use motherboards that allow for two, four, or even more separate processors. These are completely separate CPUs, each with its own L2 cache and its own bus connections to the motherboard and RAM. Obviously, this would improve performance, even beyond the dual and quad core processors. And, of course, it is more expensive. However, you do not truly realize the performance boost from this without something called processor affinity. This is a method for telling a particular application to run exclusively on a single processor. The advantage of doing this is relatively simple. Consider a Web server running openSUSE Linux and Apache Web server. Obviously, the primary purpose of this server is to handle Web page requests; however, the operating system itself has various processes running continuously using up CPU resources. You can set the Apache Web server to run exclusively on processor two, thus the Web server will not have to compete with the operating system for system resources.

Having multiple processors and setting processor affinity is a very important part of getting the best performance for any server. For a long time, Linux did not support processor affinity; the Linux kernel 2.5 introduced this ability. Prior to kernel 2.5, this was a significant shortfall for Linux.

There are several ways to set processor affinity. The first thing to examine is what is called a bit mask. For a 32-bit processor, the bit mask is 32 bits. For a 64-bit processor, it will be 64 bits. If all the bits are set to 1, this means that the process in question can run on any CPU. One of the easiest ways to set processor affinity is through the use of the taskset utility. You can identify or set the current processor affinity for a particular task or process using this utility. You can use this utility with bitmasks. This utility has only a few options, listed here:

  • -p, --pid: The ID of the process you want to alter.

  • -c, --cpu-list: This option lets you specify a bit mask or the CPU. For example, 0 is the first CPU, 1 is the second.

  • -h, --help: As with many shell commands, this will display usage information and exit.

If you want to use bitmasks they are relatively simple:

  • 0x00000001 is processor #0 (1st processor)

  • 0x00000002 is processor #1 (2nd processor)

  • 0x00000004 is processor #2 (3rd processor)

With taskset, you can use a CPU number, as shown in Figure 7.1.

Image from book
Figure 7.1: Using taskset.

Hard Drives/RAID

A hard drive is obviously an important component for your server. The most common hard drives today are SATA drives. There is a lot of confusion on the Internet about whether or not Linux supports SATA drives. If you do a Web search on the topic, you will get conflicting information. Let me first say that all of the examples in this book were done on Linux machines with SATA hard drives. Linux did not support SATA when it first came out, and many websites you find will discuss work-arounds for that scenario. But since kernel 2.6.19, which was released in November 2006, Linux has had support for SATA, so you should have no problems with Linux and SATA.

  • If you are running an older version of the Linux kernel (regardless of what distribution), you will have some issues with SATA. My advice is to upgrade your kernel to the newer version, but barring that there are some things you can do.

  • If you boot into the BIOS you can select “legacy ATA mode,” which means the SATA drive will communicate with the motherboard as if it were a legacy drive, rather than SATA. Of course, this solution pre-supposes that your BIOS supports legacy ATA mode, but many do.

  • You can also download libATA, which is a library in the Linux kernel that provides support for ATA host controllers and devices.

One of these solutions should work for you, and you will be able to install and use Linux on your SATA hard drive.

When you work with drives from the shell, IDE drives will be listed as hd0, hd1, hd3, and so on. SATA drives will be sda, sdb, sdc, and so on.

Aside from the issue of what drive to use, there is the issue of RAID. Many readers will be familiar with this term, but for those who are not, RAID is an acronym for Redundant Array of Independent Disks. The idea is that you have more than one disk containing the data, so if one drive crashes, the computer can still run. There are different levels of RAID that implement this in slightly different ways. Table 7.1 gives a brief description of the various RAID levels.

Table 7.1: RAID Levels
Open table as spreadsheet

RAID Level

Description

0

This level is called striping. Unlike the other levels, it does not provide redundancy, and your computer will not keep operating after a hard drive crash. Striping is spreading data out to multiple drives. Then when the data is required, pieces can be retrieved from the various drives simultaneously. This improves speed and performance.

1

This level is called mirroring. It is the simplest of the RAID levels. With RAID 1, you have two (or more drives), and what is written to one drive is copied to the other. These evenly paired drives are exact duplicates. If one crashes, the computer can still run using the second drive. Then you can replace that drive at a convenient time, outside normal business hours.

2

With RAID 2, the data is spread over three or more disks, with some disks containing error checking and correcting information.

3

This type uses striping and uses one drive for storing parity information. The embedded error checking information is used to detect errors. If one of the drives crashes, the data can be restored via calculating the exclusive OR (XOR) of the information recorded on the other drives.

4

This level is another form of striping.

5

RAID 5 uses the striping of RAID 0, along with the parity found in RAID 3 so you get increases in performance and data redundancy. This is very popular for servers.

1 + 0

This RAID level is really just a combination of RAID 1 (mirroring) with RAID 0 (striping).

There are other types of RAID, but these are the standard RAID levels that are most widely used. The other issue is software RAID vs. hardware RAID. Basically, in software RAID, the operating system itself uses the disk drivers to create a RAID array of logical disks. In hardware-based RAID, the disk driver controller card handles the RAID array.

You can find out about your hard drive via the desktop, whether you are using GNOME, KDE, or some other desktop. For example, with Fedora you can open Computer and see the properties of any drive, as shown in Figure 7.2.

Image from book
Figure 7.2: Fedora drive information.

Fdisk

This utility was mentioned in Chapter 2, “Installing Linux,” but we did not delve into it at that time. Now it is appropriate for us to spend some time discussing this utility. It is commonly used to partition hard drives. It is often the case that when you install a new hard drive, you will need to partition it. The basic options for fdisk are shown here:[1]

  • -b sectorsize: This option will indicate the sector size of the disk. You simply cannot select just any value; valid values are 512, 1024, or 2048. Many systems use a sector size of 512 and if your drive is already formatted that is most likely going to be its sector size.

  • -C cyls: This option allows you to identify the quantity of cylinders of the disk. Most often, you can skip this option. You may even be wondering what a cylinder is. At one time, space on a drive was designated by a cylinder, sector, and head. Most often, modern drives simply reference a sector.

  • -H heads: You can use this option to identify the quantity of heads of the disk. As with cylinders, you should feel free to skip this setting.

  • -S sects: You can use this option to identify the quantity of sectors per track of the disk. While many people use this one, it is not mandatory.

  • -l: This option is used to identify the partition tables for the specified devices. The devices specified in the /proc/partitions directory are used if no devices are defined.

  • -u: Use this option to specify sizes in sectors instead of cylinders. I recommend using this option since sectors is probably more familiar to most people than cylinders.

  • -s partition: This option will print the size of the partition (in blocks).

Before you start partitioning, you may need to list the partitions. There are several commands that will do this for you, starting with fdisk:


fdisk -l

But you can also do this with:


parted -l

Once you have gathered information about the current partitions, you can make decisions about how you would like to partition a given drive. Fdisk -l is shown in Figure 7.3.

Image from book
Figure 7.3: fdisk -l.

After you have determined what your current partitions are, fdisk can be used to repartition, if necessary. Keep in mind that when you repartition, you will be wiping the existing data on those partitions that you delete. This is why it is important to partition your computer appropriately during installation.

CD/DVD Drives

Modern Linux distributions have support for a wide range of CD and DVD drives. You should not have an issue with this. The only likely issue may be related to SATA support in your Linux distribution, which we discussed in the section on hard drives. You can find out your CD or DVD’s properties with a simple command


dmesg | grep cd

or


dmesg | grep dvd

This is shown in Figure 7.4.

Image from book
Figure 7.4: Drive information -dmesg command.

Most desktop systems give you the option to examine hard drives, CD drives, and DVD drives via graphical utilities. For example, in Ubuntu using GNOME (the default desktop for Ubuntu), you can select System, then Administration, and finally Disk Utility to view disk properties (see Figure 7.5.).

Image from book
Figure 7.5: Browsing to the Disk Utility.

The actual utility is shown in Figure 7.6.

Image from book
Figure 7.6: Drive information.
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章