Lesson 4: Managing Storage Flashcards

1.4 Given a scenario, manage storage in a Linux environment. 2.3 Given a scenario, create, modify, and redirect files. 4.1 Given a scenario, analyze system properties and remediate accordingly.

1
Q

What are the two most common partition types you can find in Linux?

A

The old style type called MBR or Master Boot Recored and the newer GPT or GUID Partition Table.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How many partitions can a MBR have?

A

MBR is limited to 4 partitions:

  • Primary partition
  • Extended partition
  • Logical partitions (2)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How many partitions can a GPT have?

A

GPT which can have up to 128 partitions

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is the lsblk command?

A

List Block Devices command, will list any devices that have storage blocks (USB key, removable media, disk, etc.)

syntax -> lsblk [options] [device name]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What command prints each block device in a flat format and includes additional information (device/partition UUID and file system type)?

A

The blkid command OR preferable lsblk -f

syntax -> blkid [options] [device name]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How do you create a partition on a MBR?

A

Use fdisk to create a partition

  1. fdisk [options] {device name}
  2. enter p to list the existing partitions
  3. enter n to start creating a partition
  4. enter desired partition type
  5. enter desired partition number
  6. enter desired first sector.
  7. enter desired size of the partition
  8. enter w to write your changes and exit utility
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What command is used to check the integrity of a file system?

A

fsck

syntax -> fsck [options] {device/file system name}

note. most systems automatically run the fsck command at boot

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What does fsck -r do?

A

Repairs file system

syntax -> fsck -r {device/file system name}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How do you remove a partition on a MBR?

A

To remove a partition use fdisk {device name}

  1. enter p to list the existing partitions.
  2. enter d to start removing a partition.
  3. enter partition number of partition you want to remove
  4. enter w to write your changes and exit the utility
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What command do you use to partition a GPT?

A

gdisk

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is the GNU Parted utility used for?

A

used to manage partitions and you would use the parted command

syntax -> parted [options] {device name}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

How do you create a partition using GNU Parted?

A

Enter parted {device name}

  1. enter print to list the existing partitions
  2. enter mkpart to start creating a partition
  3. enter desired partition name
  4. enter desired file system type
  5. enter desired start of the partition in the format #{unit} where # is any integer and unit is MB, GB, TB, etc.
  6. enter desired end of the partition in the format #{unit} where # is anyinteger and unit is MB, GB, TB, etc.
  7. Enter quit to exit GNU Parted.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

How do you remove a partition using GNU Parted?

A

Enter parted {device name}

  1. enter print to list the existing partitions
  2. rm to start creating a partition.
  3. enter partition number of the partition you want to remove.
  4. Enter quit to exit GNU Parted.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is PartEd?

A

Partition Editor, allows you to configure both MBR and GPT

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What command updates the kernel with changes in the partition table?

A

partprobe

syntax -> partprobe [options] [device name]

note. command first checks partition table, and if there are any changes, it automatically updates the kernel with the changes.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

How do you create a file system on a partition?

A
  1. enter mkfs.{file system type} {device or partition name}
  2. verify results indicate the file system was created.

note. another syntax option -> mkfs [options] {device name}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

How do you view supported file systems?

A

ls /usr/sbin/mkfs*

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

What command is used to enlarge or shrink an ext2/3/4 file system on a device?

A
  1. unmount the file system.
  2. resize the file system using resize2fs [options] {device/file system name} [desired size]

note. that resize2fs does not resize partitions

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

What does the tune2fs command do?

A

helps you configure various “tunable” parameters associated with an ext2/3/4 file system.

syntax -> tune2fs [options] {device/file system name}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

What is the dumpe2fs used for?

A

Used to dump ext2, ext3, and ext4 file system information. It prints the superblock and block group information for the selected device.

syntax -> dumpe2fs [options] {device/file system name}

note. this can be useful when troubleshooting a faulty file system.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

What is a swap system ?

A

a partition on the storage device that is used when the system runs out of physical memory.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

How do you format a swap partition ?

A

utility called mkswap

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

How do tell system to use swap partition?

A

swapon

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

What can be found in the fstab file?

A

is a configuration file located in the /etc directory and stores information about storage devices and partitions and where and how the partitions should be mounted

.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Q

What is the purpose of the crypttab file?

A

/etc/crypttab file purpose is to store information about encrypted devices and partitions that must be unlocked and mounted on system boot.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
26
Q

How do you label a ext disk?

A

e2label

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
27
Q

How do you label a xfs disk?

A

xfs_admin -L

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
28
Q

How do you mount a disk ?

A

mount

syntax -> mount [options] {device name} {mount point}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
29
Q

How do you see your HDD and how full they are?

A

df -h

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
30
Q

How do you unmount a disk?

A

umount

syntax -> umount [options] {mount point}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
31
Q

How do you make a mounting changes persistent?

A

Must be added in the File System Table - /etc/fstab file

note. the best way to identify a disk is to use its UUID - to view blkid or lsblk -v

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
32
Q

What is the most common file system in Linux?

A

ext3

This file system is stable and well supported. Note is uses bitmapping which can be inefficient.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
33
Q

What are the benefits of using ext4?

A

ext4 is an update to ext3 and increases file and volume sizes, uses extents instead of bitmapping and incorporates journaling

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
34
Q

What is XFS?

A

XFS (Extents File System) is a high-performance 64-bit journaling file system:

  • Extents Filesystem
  • Successor to EXT
  • Default file system as of RHEL7
  • Increases supported file system sizes Incorporates journaling
  • File system can grow, but cannot shrink
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
35
Q

What is the following XFS tool used for: xfs_info?

A

Display details about the XFS file system, including its block information.

syntax -> xfs_info [-V] [-t mtab] [mount point | device | file]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
36
Q

What is the following XFS tool used for: xfs_admin ?

A

Changes the parameters of an XFS file system, including its label and UUID.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
37
Q

What is the following XFS tool used for: xfs_metadump ?

A

Copy the superblock metadata of the XFS file system to a file.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
38
Q

What is the following XFS tool used for: xfs_growfs ?

A

Expand the XFS file system to fill the drive size.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
39
Q

What is the following XFS tool used for: xfs_copy ?

A

Copy the contents of the XFS file system to another location.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
40
Q

What is the following XFS tool used for: xfs_repair ?

A

Repair and recover a corrupt XFS file system.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
41
Q

What is BTRFS?

A

Is a B-Tree Filesystem

  • Currently in preview
  • Massive file system sizes
  • Incorporates journaling and a number of other features
  • Integrated LVM
  • Not supported in RHEL
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
42
Q

How do you resize a filesystem?

A

Possible using utilities like resize4fs or LVM

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
43
Q

What is device mapping?

A

device mapper creates the virtual device and passes data from that virtual device to one or more physical devices.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
44
Q

What is DM-Multipath?

A

feature of the Linux kernel that provides redundancy and improved performance for block storage devices. It leverages the device mapper to support multiple I/O paths (connection interfaces) between the CPU and the storage devices.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
45
Q

Define mdadm?

A

A command tool used to manage software-based RAID arrays.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
46
Q

How do we pick where to mount a file system?

A

Mount Points

Common Partitions and File System layouts:

  • Swap
  • /home
  • /boot
  • /usr
  • /usr/local
  • /opt
  • /var
  • /tmp
  • /mnt
  • /media
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
47
Q

How do you confirm if LVM is installed?

A

Use package manager, command is -> yum list lvm*

note: you are looking for lvm2

48
Q

How do you install LVM?

A

yum install lvm2 or yum install lvm (if Ubuntu)

49
Q

Which 3 volumes are necessary when working with LVM?

A

Logical, Volume Group & and Physical

50
Q

What tool allow you to create a physical volume?

A

pvcreate

note: all tools can be listed -> ls /usr/sbin/pv*

51
Q

How do you view the physical volumes in LVM?

A

pvdisplay

52
Q

How do you create a volume group?

A

vgcreate {name} {physical volumes}

note: Volume groups need to have a logical name/ device ID
note: all tools can be listed -> ls /usr/sbin/vg*

53
Q

How do you view volume groups?

A

vgdisplay or vgs

54
Q

How do you create logical volumes?

A

lvcreate -L {size} {vg_name} {-n lv_name}

use lvdisplay or lvs to verify

note: all tools can be listed -> ls /usr/sbin/lv*

55
Q

What are the steps to add storage to a LVM?

A
  1. fdisk /dev/sdd
  2. enter n to create new partition
  3. enter w - write changes
  4. partprobe
  5. pvcreate /dev/sdd1
  6. vgextend vg1 /dev/sdd1 -> vgextend {vg_name} {newDisk_name}
  7. Extend out the logical volume to additional storage space - lvresize -L {size of additional storage} {lv_name to extend} -> lvresize -L +1G /dev/vg1/lv1
  8. df -h
  9. extend file system - resize2fs {lv_name}
    or use xfs_resize (for xfs) -> resize2fs /dev/vg1/lv1
  10. df -h
  11. lvdisplay
56
Q

What are the steps to remove a LVM?

A
  1. unmount
  2. remove logical volume lvremove {lv_path/s}
  3. remove volume group vgremove {vg_path}
  4. remove physical volumes pvremove {pv_path/s}
57
Q

How do you verify the creating of a LVM?

A

pvdisplay or pvs

58
Q

How do you verify the creating of a volume group?

A

vgdisplay or vgs

59
Q

How do you verify the creating of a logical volumes?

A

lvdisplay or lvs

60
Q

What is the process to setup storage devices?

A
  1. Partition the storage device using a tool like fdisk or parted
  2. Format the partition with a file system using the mkfs tool.
  3. Add the formatted partition to the fstab file so that it is configured by thesystem on boot.
61
Q

Where would you find applications?

A

Can be found in several places:

  • /sbin
  • /usr/sbin
  • /bin
  • /usr/bin
  • /opt (optional applications)
62
Q

What FHS is /sbin known for?

A

System binaries, which are required for system boot up

63
Q

What FHS is /usr/sbin known for?

A

Non-essential system binaries, ones that the the kernel would use

64
Q

What FHS is /bin known for?

A

Essential cmd line utilities that are available to all user

65
Q

What FHS is /usr/bin known for?

A

Most user commands

66
Q

What FHS is /opt known for?

A

Optional applications

67
Q

What is /boot/ known for?

A

Contains boot files and the Linux kernel

68
Q

What is /dev/ known for?

A

Contains device nodes representing hardware

69
Q

What is /etc/ known for?

A

Contains configuration files

70
Q

What is /mnt/ known for?

A

Contains temporary mount points for media such as HDD or CD/ROM

71
Q

What is /home/ known for?

A

Users home folder, where all the personally file go. Will oft be a separate partition

72
Q

What is /proc/ known for?

A

Virtual file system containing data files for processes on the system

73
Q

What is the proc/partitions file?

A

contains information about each partition that is currently attached to the system.

major — represents class of device so it can be mapped to an appropriate driver

minor — separates partitions into physical devices

74
Q

What is the /proc/mounts file?

A

lists the status of all currently mounted file systems in a format

75
Q

What is /sys/ known for?

A

Virtual file system containing data for hot plug devices

76
Q

What is /usr/ known for?

A

Contains binaries and data sharable between users

- mounted read-only per FHS

77
Q

What is /var/ known for?

A

Contains variable data for programs in /usr/ such as print spooler

78
Q

What is /lib/ known for?

A

For libraries or linkable libraries - note when applications run they rely on libraries to provide basic functions

79
Q

What is the /root known for?

A

The home directory of the root user.

80
Q

What is /tmp used for?

A

Stores temporary files that may be lost on system shutdown.

81
Q

What is the mapper directory?

A

The /dev/mapper/ directory contains all of the logical volumes on the system that are managed by LVM. Devices in this directory are typically formatted as:/dev/mapper/-

82
Q

What command can you use if don’t have folders memorized?

A

which

This will going to figure out which actual binary would be run if you type the command

Can also use whereis

83
Q

What is a file system ?

A

A file system is a data structure that is used by an operating system to store, retrieve,organize, and manage files and directories on storage devices.

84
Q

What are some common types of network file systems?

A

Server Message Block (SMB),
Common Internet File System(CIFS)
Network File System (NFS)

85
Q

Define Server Message Block (SMB).

A
  • SMB protocol provides users shared access to files and other resources across a local area network (LAN).
  • primarily used with Windows computers. However, SMB-compatible software called Samba helps interface Linux and Windows hosts running network shares.
86
Q

Define Common Internet File System(CIFS).

A
  • CIFS is a specific implementation of SMB that is rarely use.
  • Microsoft designed as a successor to SMB version 1, but SMB versions 2 and 3 superseded it
  • Linux still uses CIFS name in some tools, though these tools support newer versions of SMB.
87
Q

Define Network File System (NFS).

A
  • NFS offers similar functionality to SMB, but protocols are not compatible.
  • NFS is preferred in situations where Linux clients access Linux servers.
  • In environments that are a mix of Windows and Linux, the SMB protocol is the better choice.
88
Q

What is an index node (inode)?

A

A object that stores metadata about a file or directory on a file system.

89
Q

What dose inode metedata include?

A
  • time-based values (like when file was created and last modified)
  • permission and ownership information
  • the block locations of a file’s data on a storage device
90
Q

How can you list the inode numbers for files and directories?

A

ls -i

91
Q

What is Journaling?

A

Journaling is a method by which a file system records changes that have not yet been made to the file system itself in an object called a journal.

92
Q

What is a benefit of journaling?

A
  • enables file system to quickly recover after an unexpected interruption - because system can reference pending changes in the journal to resume where it had left off.
93
Q

What does the journaling process involve?

A
  1. The journal describes all the changes that must be made to the drive.
  2. A background process makes each change as and when it is entered in the journal.
  3. If the system shuts down, pending changes are performed when it is rebooted.
  4. Incomplete entries in the journal are discarded.
94
Q

What is a virtual file system (VFS)?

A

a interface that sits between the kernel and real file systems. In effect, the VFS translates a real file system’s details to the kernel so that the file system appears identical to any other file system.

95
Q

What is File system labels?

A

File system labels are assigned to file systems for easy identification. The labels may be up to 16 characters long and can be displayed or changed using the e2label command for ext# file systems and the xfs_admin command for XFS file systems.

96
Q

What are the three types of partitions?

A

primary, extended, and logical.

97
Q

What are the features of primary partition?

A
  • Can contain one file system or logical drive and is sometimes referred to as a volume
  • The swap file system and the boot partition are normally created in a primary partition
98
Q

What are the features of a extended partition?

A
  • Can contain several file systems, which are referred to as logical drives
  • There can be only one extended partition, which can be further subdivided.
  • This partition type does not contain any data and has a separate partition table.
99
Q

What are the features of a logical partition?

A

A part of a physical drive that has been partitioned and allocatedas an independent unit and functions as a separate drive.

A logical partition is created within an extended partition, and is therefore a subset of an extended partition. There is no restriction on the number of logical partitions, but it is advisable to limit it to 12 logical partitions per drive.

100
Q

What can you find in the fstab file?

A

configuration file that stores information about storage devices and partitions and where and how the partitions should be mounted.

can be found fstab fileis located in the /etc

101
Q

What is the following XFS tool used for: xfs_db ?

A

Debug the XFS file system.

102
Q

How do you retrieve storage device information?

A
  1. enter cat /proc/mounts to list all active mount points on the system
  2. Enter cat /proc/partitions to list all active partitions on the system
  3. Enter lsblk to list all block storage devices on the system
  4. Enter lsblk -f to list all block storage devices on the system
103
Q

How do you retrieve file system information?

A
  • Enter dumpe2fs {file system name} to display file system information for ext file systems
  • Enter xfs_info {file system name} to display file system information for XFS file systems.
104
Q

How do you check the integrity of an ext file system and repair errors?

A
  1. enter umount {mount point}
  2. enter fsck {file system name}
  3. fsck -r {file system name} to repair
105
Q

How do you check the integrity of an XFS file system and repair errors?

A
  1. enter umount {mount point}

2. enter xfs_repair {file system name} to check the file system for errors and repair any that are discovered.

106
Q

How do you resize an XFS file system?

A

If necessary, extend the size of the partition or logical volume that holds the filesystem.

  1. unmount the file system
  2. Resize the file system: Enter xfs_growfs {file system name} to extend the file system to the end of the partition or logical volume
  3. Enter xfs_growfs {file system name} -D #{blocks} to extend the file system to the specified size where # is any integer and blocks refers to file system blocks.
107
Q

How do you change parameters of a file system?

A
  1. unmount the file system
  2. change the file system’s parameters: Enter tune2fs [options] {file system name} to change the parameters of an ext file system OR Enter xfs_admin [options] {file system name} to change the parameters of an XFS file system.
108
Q

What is a domain socket file type?

A

Provides inter-process networking that is protected by the filesystem’s access control.

109
Q

What is the “Named pipes” file type?

A

Enables processes to communicate with each other without using network sockets.

110
Q

What is the file command used for?

A

used to determine the type of file.

syntax -> file [options] {file names}

111
Q

What file can you check to verify if Linux has detected a storage device.

A

/dev

112
Q

What is the ulimit command used for?

A

used to adjust the available number of file descriptors

syntax -> ulimit [options] [limit]

113
Q

What command allows you to view device’s free space?

A

The df command (“diskfree”) enables you to view the device’s free space, file system, total size, space used,percentage value of space used, and mount point.

114
Q

What command displays how a device is used, including the size of directory trees and files within it?

A

The du command (“disk usage”)

syntax -> of the du and df commands is du/df [options] [object names]

115
Q

How can you generate reports on CPU and device usage?

A

Use the iostat utility

syntax -> iostat [options] [device names]

Using the -doption to specify device information only, the iostat command lists the following statistics for each storage device:

  • Transfers (I/O requests) per second (tps)
  • Number of blocks read per second (kB_read/s)
  • Number of blocks written per second (kB_wrtn/s)
  • The total number of blocks read (kB_read)
  • The total number of blocks written (kB_wrtn).
116
Q

How can you generate a report of device I/O latency in real-time?

A

Use the ioping command.

The syntax of the ioping command is ioping [options] {file/directory/device name}

It willcontinuously “ping” the specified device with requests and print information abouteach request at the command-line.

Consider using ioping to troubleshoot latency issues with a storage devices