Chapter 14

Managing Storage

The following topics are covered in this chapter:

The following RHCSA exam objectives are covered in this chapter:

  • List, create, delete partitions on MBR and GPT disks

  • Configure systems to mount file systems at boot by universally unique ID (UUID) or label

  • Add new partitions and logical volumes, and swap to a system non-destructively

  • Create, mount, unmount, and use vfat, ext4, and xfs file systems

Working with storage is an important task for a Linux administrator. In this chapter, you acquire the first set of essential storage skills. You learn how to create and manage partitions, format them with the file system you need to use, and mount these file systems.

“Do I Know This Already?” Quiz

The “Do I Know This Already?” quiz enables you to assess whether you should read this entire chapter thoroughly or jump to the “Exam Preparation Tasks” section. If you are in doubt about your answers to these questions or your own assessment of your knowledge of the topics, read the entire chapter. Table 14-1 lists the major headings in this chapter and their corresponding “Do I Know This Already?” quiz questions. You can find the answers in Appendix A, “Answers to the ‘Do I Know This Already?’ Quizzes and Review Questions.”

Table 14-1 “Do I Know This Already?” Section-to-Question Mapping

Foundation Topics Section

Questions

Understanding MBR and GPT Partitions

1–2

Managing Partitions and File Systems

3–6

Mounting File Systems

7–10

1. Which of the following is not an advantage of using a GUID partition table over using an MBR partition table?

  1. Access time to a directory is quicker.

  2. A total amount of 8 ZiB can be addressed by a partition.

  3. With GUID partitions, a backup copy of the partition table is created automatically.

  4. There can be up to 128 partitions in total.

2. Which of the following statements about GPT partitions is not true?

  1. You can easily convert an existing MBR disk to GPT by using gdisk.

  2. You can use fdisk to write a GPT disk label.

  3. Partition types in GPT are four characters instead of two characters.

  4. GPT partitions can be created on MBR as well as EFI systems.

3. Which partition type is commonly used to create a swap partition?

  1. 81

  2. 82

  3. 83

  4. 8e

4. What is the default disk device name you would expect to see in KVM virtual machines?

  1. /dev/sda

  2. /dev/hda

  3. /dev/vda

  4. /dev/xsda

5. Which of the following statements is not true?

  1. You should not ever use gdisk on an MBR disk.

  2. fdisk offers support to manage GPT partitions as well.

  3. Depending on your needs, you can create MBR and GPT partitions on the same disk.

  4. If your server boots from EFI, you must use GPT partitions.

6. Which of the following file systems is used as the default in RHEL 9?

  1. Ext4

  2. XFS

  3. btrfs

  4. Ext3

7. Which command enables you to find current UUIDs set to the file systems on your server?

  1. mount

  2. df -h

  3. lsblk

  4. blkid

8. What would you put in the device column of /etc/fstab to mount a file system based on its unique ID 42f419c4-633f-4ed7-b161-519a4dadd3da?

  1. 42f419c4-633f-4ed7-b161-519a4dadd3da

  2. /dev/42f419c4-633f-4ed7-b161-519a4dadd3da

  3. ID=42f419c4-633f-4ed7-b161-519a4dadd3da

  4. UUID=42f419c4-633f-4ed7-b161-519a4dadd3da

9. Which command can you use to verify the contents of /etc/fstab before booting?

  1. fsck --fstab

  2. findmnt --verify

  3. mount -a

  4. reboot

10. While creating a systemd mount unit file, different elements are required. Which of the following is not one of them?

  1. The mount unit filename corresponds to the mount point.

  2. An [Install] section is included to set the default runlevel.

  3. A what statement is included to indicate what should be mounted.

  4. A where statement is included to indicate where the device should be mounted.

Foundation Topics

Understanding MBR and GPT Partitions

To use a hard drive, it needs to have partitions. Some operating systems install everything to one partition, while other operating systems such as Linux normally have several partitions on one hard disk. Using more than one partition on a system makes sense for multiple reasons:

  • It’s easier to distinguish between different types of data.

  • Specific mount options can be used to enhance security or performance.

  • It’s easier to create a backup strategy where only relevant portions of the OS are backed up.

  • If one partition accidentally fills up completely, the other partitions still are usable and your system might not crash immediately.

Note

Instead of using multiple different partitions, you can also use LVM logical volumes or Stratis file systems. Managing logical volumes and Stratis file systems is covered in Chapter 15, “Managing Advanced Storage.

On recent versions of RHEL, two different partitioning schemes are available. Before creating your first partition, you should understand these schemes.

Understanding the MBR Partitioning Scheme

When the personal computer was invented in the early 1980s, a system was needed to define hard disk layout. This system became known as the Master Boot Record (MBR) partitioning scheme. While booting a computer, the Basic Input/Output System (BIOS) was loaded to access hardware devices. From the BIOS, the bootable disk device was read, and on this bootable device, the MBR was allocated. The MBR contains all that is needed to start a computer, including a boot loader and a partition table.

When hard disks first came out for PCs in the early 1980s, users could have different operating systems on them. Some of these included MS-DOS/PC-DOS, PC/IX (IBM’s UNIX for 8086 PCs), CPM86, and MPM86. The disk would be partitioned in such a way that each operating system installed got a part of the disk. One of the partitions would be made active, meaning the code in the boot sector in the MBR would read the first sector of that active partition and run the code. That code would then load the rest of the OS. This explains why four partitions were deemed “enough.”

The MBR was defined as the first 512 bytes on a computer hard drive, and in the MBR an operating system boot loader (such as GRUB 2; see Chapter 17, “Managing and Understanding the Boot Procedure”) was present, as well as a partition table. The size that was used for the partition table was relatively small, just 64 bytes, with the result that in the MBR no more than four partitions could be created. Since partition size data was stored in 32-bit values, and a default sector size of 512 bytes was used, the maximum size that could be used by a partition was limited to 2 TiB (hardly a problem in the early 1980s).

In the MBR, just four partitions could be created. Because many PC operating systems needed more than four partitions, a solution was found to go beyond the number of four. In the MBR, one partition could be created as an extended partition, as opposed to the other partitions that were created as primary partitions. Within the extended partition, multiple logical partitions could be created to reach a total number of 15 partitions that could be addressed by the Linux kernel.

Understanding the Need for GPT Partitioning

Current computer hard drives have become too big to be addressed by MBR partitions. That is one of the main reasons why a new partitioning scheme was needed. This partitioning scheme is the GUID Partition Table (GPT). On computers that are using the new Unified Extensible Firmware Interface (UEFI) as a replacement for the old BIOS system, GPT partitions are the only way to address disks. Also, older computer systems that are using BIOS instead of UEFI can be configured with globally unique ID (GUID) partitions, which is necessary if a disk with a size bigger than 2 TiB needs to be addressed.

Using GUID offers many benefits:

  • The maximum partition size is 8 zebibyte (ZiB), which is 1024 × 1024 × 1024 × 1024 gibibytes.

  • In GPT, up to a maximum number of 128 partitions can be created.

  • The 2-TiB limit no longer exists.

  • Because space that is available to store partitions is much bigger than 64 bytes, which was used in MBR, there is no longer a need to distinguish between primary, extended, and logical partitions.

  • GPT uses a 128-bit GUID to identify partitions.

  • A backup copy of the GUID partition table is created by default at the end of the disk, which eliminates the single point of failure that exists on MBR partition tables.

Understanding Storage Measurement Units

When talking about storage, we use different measurement units. In some cases, units like megabyte (MB) are used. In other cases, units like mebibyte (MiB) are used. The difference between these two is that a megabyte is a multiple of 1,000, and a mebibyte is a multiple of 1,024. In computers, it makes sense to talk about multiples of 1,024 because that is how computers address items. However, confusion was created when hardware vendors a long time ago started referring to megabytes instead of mebibytes.

In the early days of computing, the difference was not that important. The difference between a kilobyte (KB) and a kibibyte (KiB) is just 24 bytes. The bigger the numbers grow, the bigger the difference becomes. A gigabyte, for instance, is 1,000 × 1,000 × 1,000 bytes, so 1,000,000,000 bytes, whereas a gibibyte is 1,024 × 1,024 × 1,024 bytes, which makes a total of 1,073,741,824 bytes, which is over 70 MB larger than 1 GB.

On current Linux distributions, the binary numbers (MiB, not MB) have become the standard. In Table 14-2, you can see an overview of the values that are used.

An icon reads, Key Topic.

Table 14-2 Disk Size Specifications

Symbol

Name

Value

Symbol

Name

Value

KB

Kilobyte

10001

KiB

Kibibyte

10241

MB

Megabyte

10002

MiB

Mebibyte

10242

GB

Gigabyte

10003

GiB

Gibibyte

10243

TB

Terabyte

10004

TiB

Tebibyte

10244

PB

Petabyte

10005

PiB

Pebibyte

10245

EB

Exabyte

10006

EiB

Exbibyte

10246

ZB

Zettabyte

10007

ZiB

Zebibyte

10247

YB

Yottabyte

10008

YiB

Yobibyte

10248

In the past, KB, MB, and so on were used both in decimal and binary situations; sometimes they were even mixed. For example, 1-Mbps line speed is one million bits per second. The once famous “1.44 MB” floppy disk was really 1,440,000 bytes in size (80 tracks × 2 heads × 9 sectors × 512-byte sectors), creating a mixed meaning of MB: 1.44 × (decimal K) × (binary K).

Managing Partitions and File Systems

As discussed in the previous section, two different types of partitions can be used on RHEL. To match the different partition types, there are also two different partitioning utilities. The fdisk utility has been around for a long time and can be used to create and manage MBR as well as GPT partitions. The gdisk utility is used to create GPT partitions. In this section, you learn how to use both.

Apart from fdisk and gdisk, there are other partitioning utilities as well, of which parted is probably the most important. Some people like it, as it is relatively easy to use, but at the same time it hides some of the more advanced features. For that reason, this chapter focuses on working with fdisk and gdisk and introduces parted only briefly.

For both MBR and GPT partitions, you need to specify the name of the disk device as an argument. Use the lsblk command to print a list of all disk devices available on your system. Table 14-3 shows the most common disk device names that you work with on RHEL.

An icon reads, Key Topic.

Table 14-3 Common Disk Device Types

Device Name

Description

/dev/sda

A hard disk that uses the SCSI driver. Used for SCSI and SATA disk devices. Common on physical servers but also in VMware virtual machines.

/dev/nvme0n1

The first hard disk on an NVM Express (NVMe) interface. NVMe is a server-grade method to address advanced SSD devices. Note at the end of the device name that the first disk in this case is referred to as n1 instead of a (as is common with the other types).

/dev/hda

The (legacy) IDE disk device type. You will seldom see this device type on modern computers.

/dev/vda

A disk in a KVM virtual machine that uses the virtio disk driver. This is the common disk device type for KVM virtual machines.

/dev/xvda

A disk in a Xen virtual machine that uses the Xen virtual disk driver. You see this when installing RHEL as a virtual machine in Xen virtualization. RHEL 9 cannot be used as a Xen hypervisor, but you might see RHEL 9 virtual machines on top of the Xen hypervisor using these disk types.

As you can see in Table 14-3, almost all disk device names end with the letter a. The reason is that it is the first disk that was found in your server. The second SCSI disk, for instance, would have the name /dev/sdb. If many disks are installed in a server, you can have up to /dev/sdz and even beyond. After /dev/sdz, the kernel continues creating devices with names like /dev/sdaa and /dev/sdab. Notice that on NVMe devices, numbers are used instead of letters. So the first NVMe disk is nvme0n1, the second NVMe disk is nvme0n2, and so on.

Creating MBR Partitions with fdisk

To create an MBR disk partition, you have to apply a multiple-step procedure, as shown in Exercise 14-1.

Exercise 14-1 Creating MBR Partitions with fdisk

This exercise has been written to use an installation of RHEL that contains an unused disk. You can easily add a second disk to your environment. This can be a virtual disk that is added through your virtualization program, or a USB flash drive if you’re working on a physical installation. In that case, make sure to replace the device names in this exercise with the device names that match your hardware.

  1. Open a root shell and type lsblk. This lists the block devices that are available.

  2. Open a root shell and run the fdisk command. This command needs as its argument the name of the disk device where you want to create the partition. This exercise uses /dev/sdb. Change that, if needed, according to your hardware.

    [root@server1 ~]# fdisk /dev/sdb
    Welcome to fdisk (util-linux 2.37.4).
    Changes will remain in memory only, until you decide to write
      them.
    Be careful before using the write command.
    
    Device does not contain a recognized partition table.
    Created a new DOS disklabel with disk identifier 0x2c00c707.
    Command (m for help):
  3. Before you do anything, it is a good idea to check how much disk space you have available. Press p to see an overview of current disk allocation:

    Command (m for help): p
    Disk /dev/sdb: 20 GiB, 21474836480 bytes, 41943040 sectors
    Disk model: VMware Virtual S
    Units: sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    Disklabel type: dos
    Disk identifier: 0x2c00c707

    In the output of this command, in particular look for the total number of sectors and the last sector that is currently used. If the last partition does not end on the last sector, you have available space to create a new partition. In this case, that shouldn’t be an issue because you are supposed to use a new disk in this exercise.

  4. Type n to add a new partition:

    Command (m for help): n
    Partition type
       p   primary (0 primary, 0 extended, 4 free)
       e   extended (container for logical partitions)
    Select (default p):
  5. Press p to create a primary partition. Accept the partition number that is now suggested, which should be /dev/sdb1.

  6. Specify the first sector on disk that the new partition will start on. The first available sector is suggested by default, so press Enter to accept.

  7. Type +1G to make this a 1-GiB partition. If you were to just press Enter, the last sector available on disk would be suggested. If you were to use that, after this exercise you would not have any disk space left to create additional partitions or logical volumes, so you should use another last sector. To use another last sector, you can do one of the following:

    • Enter the number of the last sector you want to use.

    • Enter +number to create a partition that sizes a specific number of sectors.

    • Enter +number(K,M,G) to specify the size you want to assign to the partition in KiB, MiB, or GiB.

    Command (m for help): n
    Partition type
       p   primary (0 primary, 0 extended, 4 free)
       e   extended (container for logical partitions)
    Select (default p): p
    Partition number (1-4, default 1):
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    First sector (2048-41943039, default 2048):
    Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-41943039,
      default 41943039): +1G
    Created a new partition 1 of type ‘Linux’ and of size 1 GiB

    After you enter the partition’s ending boundary, fdisk will show a confirmation.

  8. At this point, you can define the partition type. By default, a Linux partition type is used. If you want the partition to be of any other partition type, use t to change it. For this exercise there is no need to change the partition type. Common partition types include the following:

    • 82: Linux swap

    • 83: Linux

    • 8e: Linux LVM

  9. If you are happy with the modifications, press w to write them to disk and exit fdisk.

  10. Type lsblk to verify that the new partition has been created successfully.

Using Extended and Logical Partitions on MBR

In the previous procedure, you learned how to add a primary partition. If three MBR partitions have been created already, there is room for one more primary partition, after which the partition table is completely filled up. If you want to go beyond four partitions on an MBR disk, you have to create an extended partition. Following that, you can create logical partitions within the extended partition.

Using logical partitions does allow you to go beyond the limitation of four partitions in the MBR; there is a disadvantage as well, though. All logical partitions exist within the extended partition. If something goes wrong with the extended partition, you have a problem with all logical partitions existing within it as well. If you need more than four separate storage allocation units, you might be better off using LVM instead of logical partitions. If you’re on a completely new disk, you might just want to create GPT partitions instead. In Exercise 14-2 you learn how to work with extended and logical partitions.

Note

An extended partition is used only for the purpose of creating logical partitions. You cannot create file systems directly on an extended partition!

Exercise 14-2 Creating Logical Partitions

  1. In a root shell, type fdisk /dev/sdb to open the fdisk interface.

  2. Type n to create a new partition. To create a logical partition, when fdisk prompts which partition type you want to create, enter e. This allows you to create an extended partition, which is necessary to later add logical partitions.

    Command (m for help): n
    Partition type
       p   primary (1 primary, 0 extended, 3 free)
       e   extended (container for logical partitions)
    Select (default p): e
  3. If the extended partition is the fourth partition that you are writing to the MBR, it will also be the last partition that can be added to the MBR. For that reason, it should fill the rest of your computer’s hard disk. Press Enter to accept the default first sector and press Enter again when fdisk prompts for the last sector (even if this is not the fourth partition yet).

    Select (default p): e
    Partition number (2-4, default 2):
    First sector (2099200-41943039, default 2099200):
    Last sector, +/-sectors or +/-size{K,M,G,T,P} (2099200-41943039,
    default 41943039):
    
    Created a new partition 2 of type 'Extended' and of size 19 GiB.
  4. Now that the extended partition has been created, you can create a logical partition within it. Still from the fdisk interface, press n again. Because all of the space in the drive has been allocated to partitions, the utility will by default suggest adding a logical partition with partition number 5.

    Command (m for help): n
    All space for primary partitions is in use.
    Adding logical partition 5
    First sector (2101248-41943039, default 2101248):
  5. Press Enter to accept the default first sector. When asked for the last sector, enter +1G:

    First sector (2101248-41943039, default 2101248):
    
    Last sector, +/-sectors or +/-size{K,M,G,T,P} (2101248-41943039,
    default 41943039): +1G
    
    Created a new partition 5 of type 'Linux' and of size 1 GiB.
  6. Now that the logical partition has been created, enter w to write the changes to disk and quit fdisk.

Tip

In some cases, fdisk will print a message after writing the partitions to disk, stating that it could not update the partition table. If that happens, you can try using the partprobe command to manually update the partition table. Use lsblk to verify that it now is visible. If this is not the case, use reboot to restart your system.

Creating GPT Partitions with gdisk

If a disk is configured with a GUID Partition Table (GPT), or if it is a new disk that does not contain anything yet and has a size that goes beyond 2 TiB, you need to create GUID partitions. The easiest way to do so is by using the gdisk utility. This utility has a lot of similarities with fdisk but also has some differences.

Notice that you can only decide which type of partition table to create when initializing an unused disk. Once either MBR or GPT partitions have been created on a disk, you cannot change its type. The preferred utility for creating GPT partitions is gdisk. Alternatively, after starting fdisk on a new disk, you can use the g command to initialize a GPT. Exercise 14-3 shows how to create partitions in gdisk on a disk that doesn’t have any partitions yet.

Warning!

Do not ever use gdisk on a disk that has been formatted with fdisk and already contains fdisk partitions. gdisk will detect that an MBR is present, and it will convert this to a GPT (see the following code listing). Your computer most likely will not be able to boot after doing this! When you see the following message, use q to quit gdisk immediately, without saving anything!

[root@server1 ~]# gdisk /dev/sda
GPT fdisk (gdisk) version 1.0.7

Partition table scan:
  MBR: MBR only
  BSD: not present
  APM: not present
  GPT: not present
***************************************************************
Found invalid GPT and valid MBR; converting MBR to GPT format
in memory. THIS OPERATION IS POTENTIALLY DESTRUCTIVE! Exit by
typing 'q' if you don’t want to convert your MBR partitions
to GPT format!
***************************************************************
Warning! Secondary partition table overlaps the last partition by
33 blocks!
You will need to delete this partition or resize it in another
utility.
Command (? for help):

To save you the hassle of going through this, I verified it does what it says. After converting an MBR to a GPT, your machine will not start anymore.

Exercise 14-3 Creating GPT Partitions with gdisk

To apply the procedure in this exercise, you need a new disk device. Do not use a disk that contains data that you want to keep, because this exercise will delete all data on it. If you are using this exercise on a virtual machine, you may add the new disk through the virtualization software. If you are working on a physical machine, you can use a USB thumb drive as a disk device for this exercise. Note that this exercise works perfectly on a computer that starts from BIOS and not EFI; all you need is a dedicated disk device.

  1. To create a partition with gdisk, open a root shell and type gdisk /dev/sdc. (Replace /dev/sdc with the exact device name used on your computer.) gdisk will try to detect the current layout of the disk, and if it detects nothing, it will create the GPT and associated disk layout.

    [root@server1 ~]# gdisk /dev/sdc
    GPT fdisk (gdisk) version 1.0.7
    
    Partition table scan:
      MBR: not present
      BSD: not present
      APM: not present
      GPT: not present
    
    Creating new GPT entries in memory.
    
    Command (? for help):
  2. Type n to enter a new partition. You can choose any partition number between 1 and 128, but it is wise to accept the default partition number that is suggested.

    Command (? for help): n
    Partition number (1-128, default 1): 1
  3. You now are asked to enter the first sector. By default, the first sector that is available on disk will be used, but you can specify an offset as well. This does not make sense, so just press Enter to accept the default first sector that is proposed.

    First sector (34-2097118, default = 2048) or {+-}size{KMGTP}:
  4. When asked for the last sector, by default the last sector that is available on disk is proposed (which would create a partition that fills the entire hard disk). You can specify a different last sector, or specify the disk size using +, the size, and KMGTP. So to create a 1-GiB disk partition, use +1G.

    Partition number (1-128, default 1): 1
    First sector (34-41943006, default = 2048) or {+-}size{KMGTP}:
    Last sector (2048-41943006, default = 41943006) or {+-}size{KMGTP}: +1G
    Current type is 8300 (Linux filesystem)
    Hex code or GUID (L to show codes, Enter = 8300):
  5. You now are asked to set the partition type. If you do not do anything, the partition type is set to 8300, which is the Linux file system partition type. Other options are available as well. You can press l to show a list of available partition types.

    Current type is 'Linux filesystem'
    Hex code or GUID (L to show codes, Enter = 8300): l
    0700 Microsoft basic data  0c01 Microsoft reserved  2700 Windows
      RE
    3000 ONIE boot             3001 ONIE config           3900 Plan 9
    4100 PowerPC PReP boot     4200 Windows LDM data      4201 Windows
       LDM      metadata
    4202 Windows Storage Spac  7501 IBM GPFS              7f00 ChromeOS
      kernel
    7f01 ChromeOS root         7f02 ChromeOS reserved     8200 Linux
       swap
    8300 Linux filesystem      8301 Linux reserved        8302 Linux
      / home
    8303 Linux x86 root (/)    8304 Linux x86-64 root (/  8305 Linux
       ARM64        root (/)
    8306 Linux /srv            8307 Linux ARM32 root (/)  8400 Intel
      Rapid         Start
    8e00 Linux LVM             a000 Android bootloader    a001 Android
       bootloader 2
    a002 Android boot          a003 Android recovery      a004 Android
      misc
    a005 Android metadata      a006 Android system        a007 Android
       cache
    a008 Android data          a009 Android persistent    a00a Android
      factory
    a00b Android fastboot/ter  a00c Android OEM           a500 FreeBSD
       disklabel
    a501 FreeBSD boot          a502 FreeBSD swap          a503 FreeBSD
       UFS
    a504 FreeBSD ZFS           a505 FreeBSD Vinum/RAID    a580 Midnight
      BSD data
    a581 Midnight BSD boot     a582 Midnight BSD swap     a583 Midnight
       BSD UFS
    a584 Midnight BSD ZFS      a585 Midnight BSD Vinum    a600 OpenBSD
       disklabel
    a800 Apple UFS             a901 NetBSD swap           a902 NetBSD
       FFS
    a903 NetBSD LFS            a904 NetBSD concatenated   a905 NetBSD
       encrypted
    a906 NetBSD RAID           ab00 Recovery HD           af00 Apple
       HFS/HFS+
    af01 Apple RAID            af02 Apple RAID offline    af03 Apple
      label

    The relevant partition types are as follows:

    • 8200: Linux swap

    • 8300: Linux file system

    • 8e00: Linux LVM

    Notice that these are the same partition types as the ones that are used in MBR, with two 0s added to the IDs. You can also just press Enter to accept the default partition type 8300.

  6. The partition is now created (but not yet written to disk). Press p to show an overview, which allows you to verify that this is really what you want to use.

    Command (? for help): p
    Disk /dev/sdc: 41943040 sectors, 20.0 GiB
    Model: VMware Virtual S
    Sector size (logical/physical): 512/512 bytes
    Disk identifier (GUID): 49433C2B-16A9-4EA4-9D79-285E3AF7D133
    Partition table holds up to 128 entries
    Main partition table begins at sector 2 and ends at sector 33
    First usable sector is 34, last usable sector is 41943006
    Partitions will be aligned on 2048-sector boundaries
    Total free space is 39845821 sectors (19.0 GiB)
    
    Number  Start (sector)    End (sector)  Size       Code  Name
       1            2048         2099199   1024.0 MiB  8300  Linux
    filesystem
    
    Command (? for help):
  7. If you are satisfied with the current partitioning, press w to write changes to disk and commit. This gives a warning which you can safely ignore by typing Y, after which the new partition table is written to the GUID partition table.

    Command (? for help): w
    
    Final checks complete. About to write GPT data. THIS WILL
    OVERWRITE EXISTING
    
    PARTITIONS!!
    
    
    Do you want to proceed? (Y/N): Y
    OK; writing new GUID partition table (GPT) to /dev/sdc.
    
    
    The operation has completed successfully.
  8. If at this point you get an error message indicating that the partition table is in use, type partprobe to update the kernel partition table.

Creating GPT Partitions with parted

As previously mentioned, apart from fdisk and gdisk, the parted utility can be used to create partitions. Because it lacks support for advanced features, I have focused on fdisk and gdisk, but I’d like to give you a quick overview of working with parted.

To use parted, you need to know that it has an interactive shell in which you can work with its different options. Exercise 14-4 guides you through the procedure of creating partitions using parted. This exercise assumes you have a new and unused disk device /dev/sdd available.

Exercise 14-4 Creating Partitions with parted

You need a new disk to work with this procedure. This exercise assumes that the new disk name is /dev/sdd.

  1. From a root shell, type parted /dev/sdd. This opens the interactive parted shell.

  2. Type help to get an overview of available commands.

  3. Type print. You will see a message about an unrecognized disk label.

  4. Type mklabel and press Enter. parted will now prompt for a disk label type. Press the Tab key twice to see a list of available disk label types. From the list, select gpt and press Enter.

  5. Type mkpart. The utility prompts for a partition name. Type part1 (the partition name doesn’t really matter).

  6. Now the utility prompts for a file system type. This is a very confusing option, because it suggests that you are setting a file system type here, but that is not the case. Also, when using Tab completion, you’ll see a list of file systems that you’ve probably never used before. In fact, you could just press Enter to accept the default suggestion of ext2, as the setting isn’t used anyway, but I suggest using a file system type that comes close to what you’re going to use on the partition. So type xfs and press Enter to continue.

  7. Now you are prompted for a start location. You can specify the start location as a number of blocks, or an offset from the start of the device. Notice that you can type 1M to specify the start of the partition at 1 megabyte, or type 1 MiB to have it start at 1 MiB. This is confusing, so make sure you specify the appropriate value here. At this point, type 1MiB and press Enter.

  8. Type 1GiB to specify the end of the partition. After doing so, type print to print the current partition table, and type quit to quit the utility and commit your changes.

  9. Type lsblk to verify the new partition has been created. It should show as /dev/sdd1.

  10. Use mkfs.ext4 /dev/sdd1 to format this partition with the Ext4 file system.

Creating File Systems

At this point, you know how to create partitions. A partition all by itself is not very useful. It only becomes useful if you decide to do something with it. That often means that you have to put a file system on top of it. In this section, you learn how to do that.

Different file systems can be used on RHEL 9. Table 14-4 provides an overview of the most common file systems.

An icon reads, Key Topic.

Table 14-4 File System Overview

File System

Description

XFS

The default file system in RHEL 9.

Ext4

The default file system in previous versions of RHEL; still available and supported in RHEL 9.

Ext3

The previous version of Ext4. On RHEL 9, there is no need to use Ext3 anymore.

Ext2

A very basic file system that was developed in the early 1990s. There is no need to use this file system on RHEL 9 anymore.

BtrFS

A relatively new file system that is not supported in RHEL 9.

NTFS

A Windows-compatible file system that is not supported on RHEL 9.

VFAT

A file system that offers compatibility with Windows and macOS and is the functional equivalent of the FAT32 file system. Useful on USB thumb drives that exchange data with other computers but not on a server’s hard disks.

To format a partition with one of the supported file systems, you can use the mkfs command, using the option -t to specify which specific file system to use. Alternatively, you can use one of the file system–specific tools such as mkfs.ext4 to format an Ext4 file system.

Note

If you use mkfs without any further specification of which file system you want to format, an Ext2 file system will be formatted. This is probably not what you want to use, so do not forget to specify which file system you want to use.

To format a partition with the default XFS file system, use the command mkfs.xfs. Example 14-1 shows the output of this command.

Example 14-1 Formatting a File System with XFS

[root@server1 ~]# mkfs.xfs /dev/sdb1
meta-data=/dev/sdb1            isize=512    agcount=4, agsize=65536 blks
         =                     sectsz=512   attr=2, projid32bit=1
         =                     crc=1        finobt=1, sparse=1, rmapbt=0
         =                     reflink=1    bigtime=1 inobtcount=1
data     =                     bsize=4096   blocks=262144, imaxpct=25
         =                     sunit=0      swidth=0 blks
naming   =version 2            bsize=4096   ascii-ci=0, ftype=1
log      =internal log         bsize=4096   blocks=2560, version=2
         =                     sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                 extsz=4096   blocks=0, rtextents=0

In Exercise 14-5, you create a file system on the previously created partition /dev/sdb1.

Exercise 14-5 Creating a File System

In Exercise 14-1, you created a partition /dev/sdb1. In this exercise, you format it with an XFS file system. This exercise has one step only.

  1. From a root shell, type mkfs.xfs /dev/sdb1

Changing File System Properties

When working with file systems, you can manage some properties as well. File system properties are specific for the file system you are using, so you work with different properties and different tools for the different file systems.

Managing Ext4 File System Properties

The generic tool for managing Ext4 file system properties is tune2fs. This tool was developed a long time ago for the Ext2 file system and is compatible with Ext3 and Ext4 also. When you’re managing Ext4 file system properties, tune2fs -l is a nice command to start with. Example 14-2 presents the output of this command where different file system properties are shown. Notice that you first have to create an Ext4 file system, using mkfs.ext4, before you can use tune2fs.

Example 14-2 Showing File System Properties with tune2fs -l

[root@server1 ~]# tune2fs -l /dev/sdd1
tune2fs 1.46.5  (30-Dec-2021)
Filesystem volume name:   <none>
Last mounted on:          <not available>
Filesystem UUID:          5d34b37c-5d32-4790-8364-d22a8b8f88db
Filesystem magic number:  0xEF53
Filesystem revision #:    1 (dynamic)
Filesystem features:      has_journal ext_attr resize_inode dir_index filetype extent 64bit flex_bg sparse_super large_file huge_file dir_nlink extra_isize metadata_csum
Filesystem flags:         signed_directory_hash
Default mount options:    user_xattr acl
Filesystem state:         clean
Errors behavior:          Continue
Filesystem OS type:       Linux
Inode count:              65536
Block count:              262144
Reserved block count:     13107
Overhead clusters:        12949
Free blocks:              249189
Free inodes:              65525
First block:              0
Block size:               4096
Fragment size:            4096
Group descriptor size:    64
Reserved GDT blocks:      127
Blocks per group:         32768
Fragments per group:      32768
Inodes per group:         8192
Inode blocks per group:   512
Flex block group size:    16
Filesystem created:       Thu Sep 15 11:56:26 2022
Last mount time:          n/a
Last write time:          Thu Sep 15 11:56:26 2022
Mount count:              0
Maximum mount count:      -1
Last checked:             Thu Sep 15 11:56:26 2022
Check interval:           0 (<none>)
Lifetime writes:          533 kB
Reserved blocks uid:      0 (user root)
Reserved blocks gid:      0 (group root)
First inode:              11
Inode size:               256
Required extra isize:     32
Desired extra isize:      32
Journal inode:            8
Default directory hash:   half_md4
Directory Hash Seed:      ba256a6f-1ebe-4d68-8ff3-7a26064235bf
Journal backup:           inode blocks
Checksum type:            crc32c
Checksum:                 0x49ee65b4

As you can see, the tune2fs -l command shows many file system properties. One interesting property is the file system label, which shows as the Filesystem volume name. Labels are used to set a unique name for a file system, which allows the file system to be mounted in a consistent way, even if the underlying device name changes. Also interesting are the file system features and default mount options.

To change any of the default file system options, you can use the tune2fs command with other parameters. Some common usage examples are listed here:

  • Use tune2fs -o to set default file system mount options. When set to the file system, the option does not have to be specified while mounting through /etc/fstab anymore. Use, for instance, tune2fs -o acl,user_xattr to switch on access control lists and user-extended attributes. Use a ^ in front of the option to switch it off again, as in tune2fs -o ^acl,user_xattr.

  • Ext file systems also come with file system features that may be enabled as a default. To switch on a file system feature, use tune2fs -O followed by the feature. To turn a feature off, use a ^ in front of the feature name.

  • Use tune2fs -L to set a label on the file system. As described in the section “Mounting File Systems” later in this chapter, you can use a file system label to mount a file system based on its name instead of the device name. Instead of tune2fs -L, the e2label command enables you to set a label on the file system.

Managing XFS File System Properties

The XFS file system is a completely different file system, and for that reason also has a completely different set of tools to manage its properties. It does not allow you to set file system attributes within the file system metadata. You can, however, change some XFS properties, using the xfs_admin command. For instance, use xfs_admin -L mylabel to set the file system label to mylabel.

Adding Swap Partitions

You use most of the partitions on a Linux server for regular file systems. On Linux, swap space is normally allocated on a disk device. That can be a partition or an LVM logical volume (discussed in Chapter 15). In case of an emergency, you can even use a file to extend the available swap space.

Using swap on Linux is a convenient way to improve Linux kernel memory usage. If a shortage of physical RAM occurs, non-recently used memory pages can be moved to swap, which makes more RAM available for programs that need access to memory pages. Most Linux servers for that reason are configured with a certain amount of swap. If swap starts being used intensively, you could be in trouble, though, and that is why swap usage should be closely monitored.

Sometimes, allocating more swap space makes sense. If a shortage of memory occurs, this shortage can be alleviated by allocating more swap space in some situations. This is done through a procedure where first a partition is created with the swap partition type, and then this partition is formatted as swap. Exercise 14-6 describes how to do this.

Exercise 14-6 Creating a Swap Partition

  1. Type fdisk /dev/sdb to open your disk in fdisk.

  2. Press n to add a new partition. Specify start cylinder and size to create a 1-GiB partition.

  3. Type t to change the partition type. If you are using fdisk, type swap to set the swap partition type to 82. If you are using gdisk, use partition type 8200. Press w to write and exit.

  4. Use mkswap to format the partition as swap space. Use, for instance, mkswap /dev/sdb6 if the partition you have just created is /dev/sdb6.

  5. Type free -m. You see the amount of swap space that is currently allocated. This does not include the swap space you have just created, as it still needs to be activated.

  6. Use swapon to switch on the newly allocated swap space. If, for instance, the swap device you have just created is /dev/sdb6, use swapon /dev/sdb6 to activate the swap space.

  7. Type free -m again. You see that the new swap space has been added to your server.

  8. Open the file /etc/fstab with an editor and, on the last line, add the following to ensure the swap space is also available after a reboot: /dev/sdb6 none swap defaults 0 0

Adding Swap Files

If you do not have free disk space to create a swap partition and you do need to add swap space urgently, you can use a swap file as well. From a performance perspective, it does not even make that much difference if a swap file is used instead of a swap device such as a partition or a logical volume, and it may help you fulfill an urgent need in a timely manner.

To add a swap file, you need to create the file first. The dd if=/dev/zero of=/swapfile bs=1M count=100 command would add 100 blocks with a size of 1 MiB from the /dev/zero device (which generates 0s) to the /swapfile file. The result is a 100-MiB file that can be configured as swap. To do so, you can follow the same procedure as for swap partitions. First use mkswap /swapfile to mark the file as a swap file, and then use swapon /swapfile to activate it. Also, put it in the /etc/fstab file so that it will be initialized automatically, using a line that looks as follows:

/swapfile  none swap  defaults  0 0

Mounting File Systems

Just creating a partition and putting a file system on it is not enough to start using it. To use a partition, you have to mount it as well. By mounting a partition (or better, the file system on it), you make its contents accessible through a specific directory.

To mount a file system, some information is needed:

  • What to mount: This information is mandatory and specifies the name of the device that needs to be mounted.

  • Where to mount it: This is also mandatory information that specifies the directory on which the device should be mounted.

  • What file system to mount: Optionally, you can specify the file system type. In most cases, this is not necessary. The mount command will detect which file system is used on the device and make sure the correct driver is used.

  • Mount options: Many mount options can be used when mounting a device. Using options is optional and depends on the needs you may have for the file system.

Manually Mounting File Systems

To manually mount a file system, you use the mount command. To disconnect a mounted file system, you use the umount command. Using these commands is relatively easy. To mount the file system that is on /dev/sdb5 on the directory /mnt, for example, use the following command:

mount /dev/sdb5 /mnt

To disconnect the mount, you can use umount with either the name of the device or the name of the mount point you want to disconnect. So, both of the following commands will work:

umount /dev/sdb5
umount /mnt

Using Device Names, UUIDs, or Disk Labels

To mount a device, you can use the name of the device, as in the command mount/dev/sdb5 /mnt. If your server is used in an environment where a dynamic storage topology is used, this is not always the best approach. You may today have a storage device /dev/sdb5, which after changes in the storage topology can be /dev/sdc5 after the next reboot of your server. This is why on a default RHEL 9 installation, universally unique IDs (UUIDs) are used instead of device names.

Every file system by default has a UUID associated with it—not just file systems that are used to store files but also special file systems such as the swap file system. You can use the blkid command to get an overview of the current file systems on your system and the UUID that is used by that file system.

Before the use of UUIDs was common, file systems were often configured to work with labels, which can be set using the e2label command, the xfs_admin -L command, or, while creating the file system, the mkfs.xxxx -L command. This has become more uncommon in recent Linux versions. If a file system has a label, the blkid command will also show it. In Example 14-3 you can see an example of blkid output.

Example 14-3 Using blkid to Find Current File System UUIDs

[root@server1 ~]# blkid
/dev/mapper/rhel-swap: UUID="3f377db9-7a25-4456-bdd4-0bac9aa50515"
  TYPE="swap"
/dev/sdd1: PARTLABEL="part1" PARTUUID="97ddf1cb-6f5e-407e-a9d1-
  e4345862283d"
/dev/sdb5: UUID="5d34b37c-5d32-4790-8364-d22a8b8f88db" BLOCK_
  SIZE="4096" TYPE="ext4" PARTUUID="e049881b-05"
/dev/sdb1: UUID="1e6b3b75-3454-4e03-b5a9-81e5fa1f0ccd" BLOCK_
  SIZE="512" TYPE="xfs" PARTUUID="e049881b-01"
/dev/sdb6: UUID="b7ada118-3586-4b22-90db-451d821f1fcf" TYPE="swap"
  PARTUUID="e049881b-06"
/dev/sr0: BLOCK_SIZE="2048" UUID="2022-04-19-20-42-48-00" LABEL="RHEL-
  9-0-0-BaseOS-x86_64" TYPE="iso9660" PTUUID="3a60e52f" PTTYPE="dos"
/dev/mapper/rhel-root: UUID="1e9d930d-4c05-4c91-9bca-a1b13b45ee24"
  BLOCK_SIZE="512" TYPE="xfs"
/dev/sdc1: PARTLABEL="Linux filesystem"
  PARTUUID="c021ce85-8a1b-461a-b27f-d911e2ede649"
/dev/sda2: UUID="bKb2nd-kGTl-voHS-h8Gj-AjTD-fORt-X53K9A" TYPE="LVM2_
  member" PARTUUID="908faf3e-02"
/dev/sda1: UUID="6c2b4028-1dcb-44cb-b5b7-c8e52352b06c" BLOCK_
  SIZE="512" TYPE="xfs" PARTUUID="908faf3e-01"

To mount a file system based on a UUID, you use UUID=nnnnn instead of the device name. So if you want to mount /dev/sdb5 from Example 14-3 based on its UUID, the command becomes as follows:

mount UUID="5d34b37c-5d32-4790-8364-d22a8b8f88db" /mnt

Manually mounting devices using the UUID is not exactly easier. If mounts are automated as discussed in the next section, however, using UUIDs instead of device names does make sense.

To mount a file system using a label, you use the mount LABEL=labelname command. For example, use mount LABEL=mylabel /mnt to temporarily mount the file system with the name mylabel on the /mnt directory.

Automating File System Mounts Through /etc/fstab

Normally, you do not want to be mounting file systems manually. Once you are happy with them, it is a good idea to have them mounted automatically. The classical way to do this is through the /etc/fstab file. Example 14-4 shows what the contents of this file may look like.

Example 14-4 Sample /etc/fstab File Contents

[root@server1 ~]# cat /etc/fstab
#
# /etc/fstab
# Created by anaconda on Thu Sep  1 12:06:40 2022
#
# Accessible filesystems, by reference, are maintained under '/dev/
  disk/'.
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more
   info.
#
# After editing this file, run 'systemctl daemon-reload' to update
   systemd
# units generated from this file.
#
/dev/mapper/rhel-root   /               xfs     defaults        0 0
UUID=6c2b4028-1dcb-44cb-b5b7-c8e52352b06c /boot                  xfs
   defaults         0 0.
/dev/mapper/rhel-swap   none            swap    defaults        0 0
/dev/sr0                 /repo          iso9660 defaults        0 0

In the /etc/fstab file, everything is specified to mount the file system automatically. For this purpose, every line has six fields, as summarized in Table 14-5.

An icon reads, Key Topic.

Table 14-5 /etc/fstab Fields

Field

Description

Device

The device that must be mounted. A device name, UUID, or label can be used.

Mount Point

The directory or kernel interface where the device needs to be mounted.

File System

The file system type.

Mount Options

Mount options.

Dump Support

Use 1 to enable support to back up using the dump utility. This may be necessary for some backup solutions.

Automatic Check

This field specifies whether the file system should be checked automatically when booting. Use 0 to disable automated check, 1 if this is the root file system and it has to be checked automatically, and 2 for all other file systems that need automatic checking while booting. Network file systems should have this option set to 0.

Based on what has previously been discussed about the mount command, you should have no problem understanding the Device, Mount Point, and File System fields in /etc/fstab. Notice that in the mount point not all file systems use a directory name. Some system devices such as swap are not mounted on a directory, but on a kernel interface. It is easy to recognize when a kernel interface is used; its name does not start with a / (and does not exist in the file system on your server).

The Mount Options field defines specific mount options that can be used. If no specific options are required, this line will just read “defaults.” To offer specific functionality, a large number of mount options can be specified here. Table 14-6 gives an overview of some of the more common mount options.

An icon reads, Key Topic.

Table 14-6 Common Mount Options

Option

Use

auto / noauto

Mounts/does not mount the file system automatically.

acl

Adds support for file system access control lists (see Chapter 7, “Permissions Management”).

user_xattr

Adds support for user-extended attributes (see Chapter 7).

ro

Mounts the file system in read-only mode.

atime / noatime

Disables/enables access time modifications.

noexec / exec

Denies/allows execution of program files from the file system.

The fifth column of /etc/fstab specifies support for the dump utility, which was developed a long time ago to create file system backups. On modern file systems this option is not needed, which is why you will see it set to 0 in most cases.

The last column indicates if the file system integrity needs to be checked while booting. Enter a 0 if you do not want to check the file system at all, a 1 if this is the root file system that needs to be checked before anything else, and a 2 if this is a non-root file system that needs to be checked while booting. Because file system consistency is checked in another way, this option is now commonly set to the value 0.

After adding mounts to /etc/fstab, it’s a good idea to check that you didn’t make any errors. If /etc/fstab contains errors, you won’t be able to boot your system anymore, and on the RHCSA exam the result could be that you fail the exam. The following options can be used to verify /etc/fstab contents:

  • findmnt --verify Verifies /etc/fstab syntax and alerts you if anything is incorrect.

  • mount -a Mounts all file systems that have a line in /etc/fstab and are not currently mounted.

In Exercise 14-7, you learn how to mount partitions through /etc/fstab by mounting the XFS-formatted partition /dev/sdb5 that you created in previous exercises.

Exercise 14-7 Mounting Partitions Through /etc/fstab

  1. From a root shell, type blkid. Use the mouse to copy the UUID=“nnnn” part for /dev/sdb5.

  2. Type mkdir -p /mounts/data to create a mount point for this partition.

  3. Open /etc/fstab in an editor and add the following line:

    UUID="nnnn"    /mounts/data    xfs    defaults 0 0
  4. Before you attempt an automatic mount while rebooting, it is a good idea to test the configuration. Type mount -a. This command mounts everything that is specified in /etc/fstab and that has not been mounted already.

  5. Type df -h to verify that the partition has been mounted correctly.

Using Systemd Mounts

The /etc/fstab file has been used to automate mounts since the earliest days of UNIX. In recent RHEL versions it is used as an input file to create systemd mounts, as ultimately systemd is responsible for mounting file systems. You can find the files generated by /etc/fstab in the directory /run/systemd/generator. In Example 14-5 you can see what its contents may look like.

Example 14-5 Sample Systemd Mount File

[root@server1 ~]# cat /run/systemd/generator/repo.mount
# Automatically generated by systemd-fstab-generator

[Unit]
Documentation=man:fstab(5) man:systemd-fstab-generator(8)
SourcePath=/etc/fstab
Before=local-fs.target
[email protected]

[Mount]
What=/dev/sr0
Where=/repo
Type=iso9660

As mounts are taken care of by systemd, you could also choose to mount your file systems this way. To do so, you need to create a mount file in /etc/systemd/system, meeting the following requirements:

  • The name of the file corresponds to the directory where you want to mount its device. So if you want to mount on /data, the file is data.mount.

  • The file contains a [Mount] section that has the lines What, Where, and Type.

  • The file has an [Install] section, containing WantedBy=some.target. Without this section the mount cannot be enabled.

In Exercise 14-8 you’ll create a mount file for the /dev/sdc1 device that was previously created.

Exercise 14-8 Creating a Systemd Mount File

  1. Use mkfs.ext4 /dev/sdc1 to format /dev/sdc1 with an Ext4 file system.

  2. Type mkdir /exercise to create the mount point

  3. Use vim /etc/systemd/system/exercise.mount and give the file the following contents:

    [Unit]
    Before=local-fs.target
    
    [Mount]
    What=/dev/sdc1
    Where=/exercise
    Type=ext4
    
    [Install]
    WantedBy=multi-user.target
  4. Use systemctl enable --now exercise.mount to enable and start the mount unit.

  5. Type mount | grep exercise to verify the mount was created.

  6. Use systemctl status exercise.mount to verify the unit file.

Summary

In this important chapter, you learned how to work with partitions and file systems on RHEL 9. You learned how to create partitions for MBR and GPT disks and how to put a file system on top of the partition. You also learned how to mount these partitions manually and automatically through /etc/fstab or by using systemd unit files.

Exam Preparation Tasks

As mentioned in the section “How to Use This Book” in the Introduction, you have several choices for exam preparation: the end-of-chapter labs; the memory tables in Appendix C; Chapter 27, “Final Preparation”; and the practice exams.

Review All Key Topics

Review the most important topics in the chapter, noted with the Key Topic icon in the margin of the page. Table 14-7 lists a reference for these key topics and the page numbers on which each is found.

An icon reads, Key Topic.

Table 14-7 Key Topics for Chapter 14

Key Topic Element

Description

Page

Table 14-2

Disk Size Specifications

316

Table 14-3

Common Disk Device Types

317

Table 14-4

File System Overview

328

Table 14-5

/etc/fstab Fields

336

Table 14-6

Common Mount Options

337

Complete Tables and Lists from Memory

Print a copy of Appendix C, “Memory Tables” (found on the companion website), or at least the section for this chapter, and complete the tables and lists from memory. Appendix D, “Memory Tables Answer Key,” includes completed tables and lists to check your work.

Define Key Terms

Define the following key terms from this chapter and check your answers in the glossary:

partition

Master Boot Record (MBR)

Basic Input/Output System (BIOS)

extended partition

primary partition

logical partition

GUID Partition Table (GPT)

Unified Extensible Firmware Interface (UEFI)

XFS

Ext4

Ext3

Ext2

BtrFS

VFAT

mount

umount

universally unique ID (UUID)

label

fstab

Review Questions

The questions that follow use an open-ended format that is meant to help you test your knowledge of concepts and terminology and the breadth of your knowledge. You can find the answers to these questions in Appendix A.

1. Which tool do you use to create GUID partitions?

2. Which tool do you use to create MBR partitions?

3. What is the default file system on RHEL 9?

4. What is the name of the file that is used to automatically mount partitions while booting?

5. Which mount option do you use if you want a file system not to be mounted automatically while booting?

6. Which command enables you to format a partition that has type 82 with the appropriate file system?

7. You have just added a couple of partitions for automatic mounting while booting. How can you safely test if this is going to work without actually rebooting?

8. Which file system is created if you use the mkfs command without any file system specification?

9. How do you format an Ext4 partition?

10. How do you find UUIDs for all devices on your computer?

End-of-Chapter Lab

To perform this end-of-chapter lab, you’ll need to add a new and unused disk device. Create this new disk device using the virtualization software you’re using, or by adding an empty USB thumb drive.

Lab 14.1

  1. Add two partitions to your server. Create both partitions with a size of 100 MiB. One of these partitions must be configured as swap space; the other partition must be formatted with an Ext4 file system.

  2. Configure your server to automatically mount these partitions. Mount the Ext4 partition on /mounts/data and mount the swap partition as swap space.

  3. Reboot your server and verify that all is mounted correctly. In case of problems, read Chapter 18, “Essential Troubleshooting Skills,” for tips on how to troubleshoot.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset