204: Advanced Storage Device Administration

204.1 Configuring RAID (weight: 3)

Undrestanding RAID and RAID Levels

RAID stands for Redundant Array of Independent Disks and is a storage solution that is used to organize or combine a group of disks into one or more logical units.

  • Mirroring

  • Striping

  • Parity

RAID 0: Striping

RAID 1: Mirroring

RAID 5: Block-Level Stripping with Distributed Parity

Files and Utilities for Interacting with RAID

  • mdadm.conf: Main configuration file for the management of software raid with the mdadm utility

  • /proc/mdstat: Display a snapshot of the kernel's RAID/md stat.

  • 0xFD partition type: Type ID number that signifies a RAID partition.

  • mdadm: A utility for creating, managing, and monitoring RAID devices using the md driver in Linux.

Option
Description

-C

Create a new array

-l

Set a RAID level

-n

Specify number of devices

-x

Specify number of spare devices

-D

Print details of one or more md devices

-a

Add one or more devices to the array

-f

Mark listed devices as faulty

-r

Remove listed devices

-s

Scan the map file for arrays

-v

Increase verbosity

Creating a Software RAID

Failing Active RAID Devices

Adding Devices to an Existing RAID

Updating the mdadm.conf File

204.2 Adjusting Storage Device Access (weight: 2)

Direct Memory Access (DMA) and Interrupts Handling

Direct Memory Access allows hardware devices (e.g. disk drivers, network cards, sound cards, etc.) to effectively bypass the CPU and send or recive data directly from the main system memory rather than taking up large quantities of proccessing time. This process is managed by a DMA controller (DMAC).

A hardware interrupt or interrupt request (IRQ) is a signal that informs the processor that a hardware device (e.g. mouse, keyboard, etc.) needs attention. The interrupt suspends the current activity of the processor in order to handle the external event.

The hdparm Utility

This utility is used to view information about or set SATA/IDE device parameters. Devices of this type will be /dev/hd*.

Command
Description

hdparm -I /dev/hda

Display information about the drive

hdparm -d# /dev/hda

Get or set the using_dma flag for the drive

hdparm -t(-T) /dev/hda

Test timings of device reads (or cache with -T) for comparison

hdparm --help

View commands and syntax

The sdparm Utility

List or change SCSI/SATA device parameters and send simple SCSI commands. Devices of this type will be /dev/dd*.

Command
Description

sdparm -I /dev/sda

List all known fields for a device

sdparm --command=CMD /dev/sda

Send a SCSI command to the device (e.g. eject, start, stop, etc.)

sdparm --help

View commands and syntax

The nvme Utility

A command line utility for managing PCI Express-based devices. Devices of this type will be /dev/nvme*.

Command
Description

nvme help

Display a list of available commands

nvme list

List all NVMe controllers

nvme smart-log /dev/nvme0n1

Retrieve the smart log

nvme read/write /dev/nvme0n1 [options]

Issue IO read or write command

The fstrim Utility

A command line utiliy for discarding unwanted block on a mounted filesystem.

  • Discards all unused blocks by default but provides options to modify this behavior based on range or size.

  • Systemd provides a timer for fstrim called fstrim.timer that runs on a weekly basis when enabled.

  • The -a option will run fstrim against all mounted file systems.

  • The discard option can be set in /etc/fstab for automatic online TRIM (not recommended).

iSCSI

  • iSCSI (Internet Small Computer System Interface): A protocol that allows SCSI commands to be sent over a TCP/IP network. Communication takes place between an initiator (the cliant) and a target (a server).

  • ATA over Ethernet (AoE): Allows the Advanced Technology Attachment (ATA) protocol over an ethernet network

  • Fiber Channel over Ethernet (FCoE): Allows the Fiber Channel (FC) protocol over an ethernet network

  • targetcli: A shell for viewing, editing and saving the configuration of the kernel's target subsystem.

Creating an iSCSI Target:

  • Create a backstore using nvme1n1.

  • Create a target with a unique iSCSI Qualified Name (IQN).

  • Create an ACL, LUN, and portal within the target portal group (TPG)

    • ACLs: Access control lists

    • LUN: Logical unit number

    • Portal: The IP and TCP port pair for an iSCSI target

Files and Utilities for the iSCSI Initiator

  • iscsid.conf: The default configuration file for iSCSI. It contains settings used by iscsid and iscsiadm.

  • initaltorname.iscsi: Contains the iSCSI initiator name. This should mirror the name from the ACL of the iSCSI target.

  • iscsid: A system daemon that manages iSCSI connections.

  • scsi_id: A utility used to retrieve and generate a unique SCSI identifier. This is primarity used by other utilities such as udev.

  • iscsiadm: The open-iscsi administration utility.

Option
Description

-m

Specify the mode

-t

Specify the discovery type

-T

Specify the target name

-l

Login to a specified record

-p

Use target portal with IP address and port

-P

Print in tree format

204.3 Logical Volume Manager (weight: 3)

LVM Architecture

Working with Physical Volumes

Command
Purpose

pvcreate

Create (initialize) a physical volume from a block device

pvs

Display info about physical volumes

pvdisplay

Display verbose info about physical volumes

pvscan

Scan all supported LVM block devices

pvresize

Update the size of a physical volume

pvremove

Remove a physical volume

Working with Volume Group

Command
Purpose

vgcreate

Create a volume group from physical volumes

vgextend

Add a physical volume to a volume group

vgreduce

Remove a physical volume from a volume group

vgs

Display information about volume groups

vgdisplay

Display verbose information about volume groups

vgscan

Display information about volume groups and rebuild the LVM cache

vgchange

Modify attributes of a volume group

vgrename

Change the name of a volume group

vgremove

Remove a volume group

Working with Logical Volumes

Command
Purpose

lvcreate

Create a logical volume from a volume group

  • -L - Specify the size

  • -l - Specify the number of extends or extent percentage

lvs

Display info about logical volumes

lvdisplay

Display verbose info about logical volumes

lvscan

List all logical volumes in all volume groups

lvrename

Change the name of a logical volume

lvchange

Adjust the parameters of a logical volume

lvremove

Remove a logical volume from a volume group

Resizing Logical Volumes

Command
Purpose

lvextend

Grow the size of a logical volume

  • -L - Specify the size

  • -l - Specify the number of extens or extent percentage

  • -r - Resize the underlying file system

lvs

Display info about logical volumes

resize2fs

Resize an ext2/ext3/ext4 filesystem

xfs_growfs

Expand an XFS filesystem

lvreduce

Reduce the size of a logical volume

Creating and Managing Snapshots

Command
Purpose

lvcreate

Create a logical volume

  • -L - Specify the size

  • -l - Specify the number of extents or extent percentage

  • -s - Create a snapshot

lvs

Display info about logical volumes

lvextend

Increate the size of a logical volume or snapshot (COW table)

lvreduce

Reduce the size of a logical volume or snapshot (COW table)

lvremove

Remove a logical volume or a snapshot

lvchange

Adjust the parameters of a logical volume

lvconvert

Change logical volume layout

  • --merge - Merge a snapshot logical volume into its origin

Sample Questions

1. Which of the following are protocols used in a Storage Area Network (SAN)? (Choose three.)

2. What command is used to initialize a physical volume?

3. What command is used to add a physical volume to a volume group?

4. What option for the sdparm utility lists all known fields for a device?

5. What is the default configuration file for iSCSI?

6. What are two ways to gain information about a RAID? (Choose two.)

7. What subcommand for the nvme utility will display all NVMe controllers?

8. What option for the hdparm utility will retrieve or set parameters the using_dma option?

9. What mode is used to log in to an iSCSI target?

10. What component in a target portal group is added to initiatorname.iscsi for security?

11. What option is used to designate a logical volume as a snapshot?

12. What option is used to resize the underlying filesystem of a logical volume?

13. What option is used to specify the number of extents for a logical volume?

14. What type of technology allows hardware devices to bypass the CPU and communicate with system memory?

15. What partition type specifies a RAID partition?

16. What option is used to specify a RAID device as faulty?

17. What RAID level uses mirroring to prevent data loss?

18. What is the main configuration file for the management of software RAID with the mdadm utility?

19. What command is used to discard unwanted blocks on a mounted filesystem?

Last updated

Was this helpful?