ITS 2320 - Linux II

Chapter 3, Configuring Hardware

Objectives:

This lesson reviews issues relating to hard drives when running Linux. Objectives important to this lesson:

  1. Hardware settings
  2. Hard disk layouts
  3. Partitions and filesystems
  4. Maintaining filesystems
  5. Mounting and unmounting filesystems
Concepts:

This chapter is about hard drives and filesystems. It begins with a review of two types of firmware that affect security settings and what kind of hard drives you can install.

The text continues with software that is stored on the motherboard itself. Two types are mentioned:

  • BIOS - found on computers built before 2012, requires a bootloader program in the Master Boot Record of a hard drive
  • BIOS/UEFI - found on computers built after 2012, requires a bootloader program in the EFI System Partition on a had drive

Short version: UEFI supports more memory and larger storage devices at boot time. BIOS chips could only operate in 16-bit mode, so modern processors have to gear down to use them, at least until the main operating system is loaded. The discussion about the transition from BIOS (Basic Input-Output System) chips to UEFI (Unified Extensible Firmware Interface) is a little light. This article on howtogeek.com is a bit more readable and detailed. Another limitation of BIOS systems is that they call a bootloader program that has to fit in one sector. This limit can be overcome by having the required bootloader program call another one with more options in it. The text calls this chainloading.

For an explanation of BIOS systems in a video, take a look at this one. The video discusses the memory and storage device issues, but it goes to a commercial at about 3:55, which we can skip.


UEFI supports Secure Boot which is meant to protect your computer from having its operating system compromised. The system starts by verifying hardware, then verifying each layer of software in a chain of trust. Like most features, you can turn Secure Boot off, which you would want to do if you need your computer to be able to boot into multiple operating systems.

You can use either system to set security functions, change the boot order of your drives, and tell the system about new devices you've added to the computer. It is important to note that BIOS and UEFI systems are not dependent on the operating systems that are eventually loaded on the computers having those BIOS or UEFI components. Note the warning in the text, however, that not all Linux distros support UEFI, which forces them to use BIOS choices instead.

The chapter discusses PCI interfaces as being the most commonly used expansion card interfaces at this time (fourth quarter of 2021). Drivers are typically available for them, but you can run into trouble that may be resolved with the setpci utlity. Since the text does not discuss using setpci at this point, you may want to refer to this article on tutorialspoint.com.

The text briefly discusses the USB interface, which is probably familiar to you, and the GPIO interface, which may not be. GPIO is used on Raspberry Pi computers, and on some embedded devices.

The text moves on to discuss the /dev directory. We are informed that device files are created in this folder by the operating system, each of which can be treated like a typical Linux file: the system can read the files to gather data from the matching device, or write to the files to send data to the same matching device. Character device files are used to transfer data one character at a time. Block device files are used to stream large blocks of data at once.

The text continues with a discussion of several other directories and programs that use them. Review this material, which is slightly different from same topics covered in Linux I. We will skip ahead to find more information about storage devices.

The section of the chapter called Storage Basics finally begins the discussion of storage devices. We are told that Linux treats hard drives and solid state drives as the same kind of device, despite their technological differences. This is extended to cover hard drives that use PATA, SATA, and SCSI interfaces. This is as good a place as any to remark that installing such devices in a computer requires the right cables for power and data, and the right interfaces for the hardware you are trying to use. What the chapter is talking about is the logical way such devices are treated by the OS, not the phyical way they must be treated by the hardware of your system.

Logical treatment of drives leads to discussing partitioning. Let's start with a Windows perspective from our friend Linus Sebastian.


This longer video is from the Gary Explains web site. Gary discusses things from a Linux command line. He covers finding the device file, partitioning, and formatting.


The chapter gets more esoteric with a discussion of udev, which may be new to you. The usefulness of udev, in this context is that it can be used to make rules about what happens when a hot swappable device, such as a USB stick, is attached to your computer. This is different from the devices discussed so far because the previous instructions assumed that a device file would be assigned permanently. This method will allow the continued assignment of a device file based on a unique identifier for the device. (Cue the Urban Penguin.)


The text presents two long lists of file systems that Linux supports, separated into Linux and non-Linux systems.You typically create a file system with the mkfs (make filesystem) command. The text warns that you should be very careful using this command, because it requires you to specify a partition, and installing a file system on a partition will destroy anything already saved on it.

In the video below, from Salt Lake City Community College, the instructor demonstrates using the mkfs command to display available file system choices before committing to one of them.


It the video below, Mr. Walsh continues his file system lesson demonstrating the mount command.


You might be confused by the fact that the mount command can be used with arguments to mount an unmounted file system, and it can be use without arguments to list the currently mounted file systems. The mount command has temporary effects. A volume mounted with the mount command will not be mounted when the system reboots. To get that to happen, you should edit the /etc/fstab file to include the new file system, as demonstrated in the video above. Note that the command can use the UUID to identify the device, which is more efficient than taking a chance on what Linux will call the next device to be loaded.

You should review the df and du commands discussed at the end of the chapter.