1.4 Given a scenario, manage storage in a Linux environment Flashcards Preview

Linux+ > 1.4 Given a scenario, manage storage in a Linux environment > Flashcards

Flashcards in 1.4 Given a scenario, manage storage in a Linux environment Deck (46)
Loading flashcards...
1
Q

Where were traditional partition tables stored?

A

Traditional partition tables were stored on the Master Boot Record (MBR)

2
Q

What are raw devices?

A

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

3
Q

What command can you use to create a copy of an entire hard disk?

A

The dd command is often used to create copy of an entire hard disk

4
Q

Describe GPT

A

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

5
Q

What is MBR?

A

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

6
Q

Describe real file systems

A

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

7
Q

Virtual Filesystems

A

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

8
Q

What is a relative path?

A

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)

9
Q

Absolute Paths

A

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

10
Q

Describe regular partitions

A

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

11
Q

LVM

A

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

12
Q

What issues does LVM solve?

A

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

13
Q

What command would you use to create an LVM?

A

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

14
Q

mdadm

A

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
15
Q

What is the purpose of multipath?

A

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

16
Q

XFS Tools

A

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

17
Q

LVM Tools

A

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

18
Q

fdisk

A

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

19
Q

parted

A

The parted utility is an interactive tool that allows you to display and modify both traditional and GUID partition tables. It can also create a filesystem on a partition

To display a partition table, use the -l option

parted -l /dev/sda

20
Q

mkfs

A

The mkfs command will create a filesystem on a partition. The basic syntax of the command is mkfs -t fstype partition

21
Q

iostat

A

The iostat command provides input/output statistics on devices, including partitions. When executed with the -d option, it provides a variety of information

22
Q

df

A

The df command displays usage of partitions and logical devices

23
Q

du

A

The du command provides an estimated amount of disk space usage in a directory structure. For example, the following command displays the amount of space used in the /usr/lib directory

24
Q

mount

A

The mount command can display the currently mounted filesystems

The mount command can also be used to manually mount a filesystem. Provide the device to mount as the first argument and the mount point (mount directory) as the second argument (execute the following commands as the root user):

# mkdir /data
# mount /dev/sdb1 /data
25
Q

umount

A

Use the umount command to manually unmount a filesystem

26
Q

lsblk

A

If you have just created the filesystem, it will likely be easy to remember which device file was used to access the filesystem. However, if you forget which device files are available, you can execute the lsblk command

27
Q

blkid

A

You can see your label and UUIDs with the blkid command

28
Q

dumpe2fs

A

The dumpe2fs command will display filesystem metadata, as described in the following command:

dumpe2fs /dev/sdb1 | head

29
Q

resize2fs

A

The resize2fs command is commonly used in conjunction with resizing a logical volume. Once the LV has been resized, the underlying ext3 or ext4 filesystem also must be resized.

If the plan is to make the LV larger, the lvextend command should be executed first, followed by the resize2fs command. No size value is needed for the resize2fs command, as it will increase to the size of the LV. Here is an example:

lvextend -L+1G /dev/vol0/lv0
resize2fs /dev/vol0/lv0

30
Q

fsck

A

The fsck utility is designed to find filesystem problems on unmounted filesystems (run this command as the root user)

This utility is fairly straightforward. It calls the correct filesystem check utility based on a probe of the filesystem and then prompts the user when errors are found. To fix an error, answer “y” or “yes” to the prompts.

Since “yes” is almost always the appropriate answer, the fsck utility supports a -y option, which automatically answers “yes” to each prompt.

The fsck command executes filesystem-specific utilities. In the case of ext2/ext3/ext4 filesystems, the fsck command executes the e2fsck utility. See the “fsck” section earlier in this chapter for details regarding the fsck command

31
Q

tune2fs

A

The tune2fs command is used to display or modify specific metadata for an ext2/ext3/ext4 filesystem. For example, by default, 5% of an ext2/ext3/ext4 filesystem is reserved for the system administrator (run the following command as the root user)

32
Q

e2label

A

To change the label of a filesystem, use the e2label command:

e2label /dev/sda3 pluto
# blkid
33
Q

/etc/fstab

A

The /etc/fstab file is used to specify which filesystems to mount, where to mount the filesystems, and what options to use during the mount process. This file is used during the boot process to configure filesystems to mount on bootup.

Each line describes one mount process. The following is an example of one of these lines:

/dev/sda1 / ext4 defaults 1 1
Each line is broken into six fields of data, separated by whitespace:

The device to mount (/dev/sda1).

The mount point (/).

The filesystem type (ext4).

The mount options (defaults).

Dump level (1). This field is related to the dump command and is rarely used.

The fsck pass field (1). A value of 0 means “do not run fsck on this filesystem during system boot,” whereas a value of 1 or higher means “run fsck on this filesystem during system boot.”

34
Q

/dev/

A

The /dev filesystem contains device files. Device files are used to access physical devices (such as hard drives, keyboards, and CPUs) and virtual devices (such as LVM devices, pseudo-terminals, and software RAID devices). The /dev filesystem is memory based, not stored on the hard drive

35
Q

/dev/disk/by-

A

Common subdirectories under the /dev/disk directory include the following:

id: Symbolic links to device files using filenames that are based on the serial number of the hardware
uuid: Symbolic links to device files using filenames that are based on the UUID of the device
path: Symbolic links to device files using filenames that are based on the hardware path to the device (the hardware path from the CPU to the device)
multipath: Symbolic links to device files using filenames that are based on the multipath assigned to the device
uuid: Symbolic links to device files using filenames that are based on the UUID of the device

36
Q

/etc/mtab

A

A list of all mounted filesystems is stored in /etc/mtab automatically by the system

The contents of this file are similar to the contents of the /proc/mounts file

37
Q

/sys/block

A

The /sys filesystem is designed to provide important information regarding devices and buses that the kernel is aware of. The /sys filesystem is memory based, not stored on the hard drive

38
Q

/proc/partitions

A

The /proc filesystem provides information regarding processes, kernel features, and system hardware. The /proc filesystem is memory based, not stored on the hard drive

39
Q

/proc/mounts

A

A list of all mounted filesystems is stored in /proc/mounts automatically by the system

The major difference between the contents of the /etc/mtab file and the /proc/mounts file is that the /proc/mounts file contains more information, including mount options

40
Q

ext3

A

This filesystem is an extension of the ext2 filesystem and designed to be placed on disk-based devices (partitions). While there are several differences, the big change in ext3 was the introduction of journaling. Journaling helps to prevent filesystem corruption by creating a log (journal) of changes made to files. In the event of a system crash, the recovery time of an ext3 filesystem should be relatively quick, as the journal can be used to quickly fix corrupted file metadata

41
Q

ext4

A

The ext4 filesystem is a replacement for the ext3 filesystem. It has support for larger filesystem and individual file sizes. Performance was improved in this version as well

42
Q

xfs

A

Another disk-based filesystem that is known for high performance and handling larger file sizes

43
Q

nfs

A

This is a network-based filesystem that originated on Unix systems. While it is an older filesystem, it has been a standard way of sharing directory structures between Unix and Linux systems. Newer versions of this filesystem include modern securing features and performance improvements

44
Q

smb

A

This filesystem is also known as the Samba filesystem. It is based on cifs and designed to provide network-based sharing

45
Q

cifs

A

This filesystem is used on Microsoft Windows systems to share folders across the network. Samba utilities on Linux are used to connect to cifs shares

46
Q

ntfs

A

This filesystem is found on disk-based systems on the Microsoft Windows platform. It is important to remember that Linux distributions cannot recognize ntfs filesystems