1.4 Given a scenario, manage storage in a Linux environment Flashcards
Where were traditional partition tables stored?
Traditional partition tables were stored on the Master Boot Record (MBR)
What are raw devices?
A raw device is a device file that is associated with a block device file (partition, hard disk, and so on). When you create this association, direct access to the block device is available. To create a raw device, use the raw command
What command can you use to create a copy of an entire hard disk?
The dd command is often used to create copy of an entire hard disk
Describe GPT
GPT stands for GUID Partition table (GPT)
GPT is a partitioning scheme that is designed to overcome the limitations of MBR.
GPT is not limited to four primary partitions like MBR and there is also isnt a need for extended or logical partitions
GPT supports up to 128 partitions per hard disk drive
What is MBR?
MBR partition tables are often referred to as “traditional” partitions, as opposed to newer partition tables such as the GUID partition table. An MBR partition table has the restriction of only permitting four partitions by default. This is an extremely limiting factor for operating systems such as Linux.
However, one of the primary partitions in an MBR partition table can be converted into an extended partition. Within this extended partition, additional partitions can be added. These additional partitions are called logical partitions
Describe real file systems
A real filesystem is a filesystem that is placed on a physical storage device, such as a partition, software RAID device, or LVM logical volume. Typical real filesystems include ext3, ext4, and xfs
Virtual Filesystems
Once a real filesystem has been placed on a physical device, it needs to be grafted onto the virtual filesystem. The virtual filesystem starts from the root directory (the / directory) and contains a collection of physical filesystems. The root directory itself is one of the real filesystems. Others are found under directories called “mount points.”
Common mount points include the /usr, /var, and /home directories; however, these directories may also contain data from the root filesystem. This depends on how the partitioning scheme was laid out during the installation process
What is a relative path?
If you use a path name that is relative to the current directory, it is called a relative path
Here are some examples:
cd test: Move to the test directory under the current directory.
ls abc/xyz: List files in the xyz directory, which is under the abc directory, which is under the current directory.
cd ..: Move one level up from the current directory (the .. characters represents the directory above the current directory).
cp data/abc.txt .: Copy the abc.txt file, which is under the data directory, which is under the current directory into the current directory (a single . represents the current directory)
Absolute Paths
A path is how you refer to a file or directory. If you use a path name that is relative to the root directory (/), it is called a absolute path. Here are some examples:
cd /etc/skel
ls /usr/bin
cp /etc/hosts /tmp
Note that an absolute path always begins with the / character, and relative paths never begin with the / character
Describe regular partitions
Regular partitions are assigned device names that are predictable and automatically assigned. The first disk on the system is assigned to /dev/sda (unless it is an older IDE device, in which case it is assigned the device file of /dev/hda). The second disk on the system is assigned to /dev/sdb
LVM
Unlike regular partitions, Logical Volume Managers aren’t predictable and don’t automatically assign device names.
Instead they use a feature called a device mapper
LVM consists of one or more physical devices merged into a single container of space that can be used to create partition-like devices. The physical devices can be entire hard disks, partitions on a hard disk, removable media devices (USB drives), software RAID devices, or any other storage device
What issues does LVM solve?
Regular partitions are not “resizable.” LVM provides the means to change the size of partition-like structures called logical volumes.
The size of a regular partition cannot exceed the overall size of the hard disk on which the partition is placed. With LVM, several physical devices can be merged together to create a much larger logical volume.
Active filesystems pose a challenge when you’re backing up data because changes to the filesystem during the backup process could result in a corrupt backup. LVM provides a feature called a “snapshot” that makes it easy to correctly back up a live filesystem
What command would you use to create an LVM?
The first step in creating an LVM is to take existing physical devices and convert them into physical volumes (PVs). This is accomplished by executing the pvcreate command. For example, if you have three hard drives
pvcreate /dev/sdb /dev/sdc /dev/sdd
Next, place these PVs into a volume group (VG) by executing the following command
vgcreate vol0 /dev/sdb /dev/sdc /dev/sdd
mdadm
Use the command madm to create a software raid device
mdadm -C /dev/md0 -l 1 -n 2 /dev/sdb /dev/sdc
The preceding command uses the following options:
- C: Used to specify the device name for the RAID device
- l: Used to specify the RAID level
- n: Used to specify the number of physical storage devices in the RAID
What is the purpose of multipath?
Some storage devices will be available only through the network. This creates a point-of-failure: the network itself. If you lose network access to a remote storage device, perhaps because a router went down or a new firewall rule was implemented, then applications on your system may fail to function properly.
The concept of Multipath is to create different network paths to a remote storage device. This requires additional network setup, including configuring different routes to the network storage device
XFS Tools
The xfs_metadump command dumps (copies) metadata from an unmounted XFS filesystem into a file to be used for debugging purposes
The xfs_info command is used to display the geometry of an XFS filesystem, similar to the dumpe2fs command for ext2/ext3/ext4 filesystems. There are no special options for the xfs_info command
LVM Tools
vgremove: Deletes a VG. The VG must not have any LVs.
vgreduce: Deletes a PV from a VG.
vgextend: Adds a PV to an existing VG.
vgdisplay: Displays information about a VG.
pvdisplay: Displays information about a PV.
lvdisplay: Displays information about an LV.
lvextend: Extends the size of an LV. Note that this only resizes the LV, not the filesystem that resides within the LV. See the “resize2fs” section in this chapter to learn how to resize the filesystem
fdisk
The fdisk utility is an interactive tool that allows you to display and modify traditional (non-GUID) partition tables. To display a partition table, use the -l option (as the root user), like so:
fdisk -l /dev/sda