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.
What are the two most common partition types you can find in Linux?
The old style type called MBR or Master Boot Recored and the newer GPT or GUID Partition Table.
How many partitions can a MBR have?
MBR is limited to 4 partitions:
- Primary partition
- Extended partition
- Logical partitions (2)
How many partitions can a GPT have?
GPT which can have up to 128 partitions
What is the lsblk command?
List Block Devices command, will list any devices that have storage blocks (USB key, removable media, disk, etc.)
syntax -> lsblk [options] [device name]
What command prints each block device in a flat format and includes additional information (device/partition UUID and file system type)?
The blkid command OR preferable lsblk -f
syntax -> blkid [options] [device name]
How do you create a partition on a MBR?
Use fdisk to create a partition
- fdisk [options] {device name}
- enter p to list the existing partitions
- enter n to start creating a partition
- enter desired partition type
- enter desired partition number
- enter desired first sector.
- enter desired size of the partition
- enter w to write your changes and exit utility
What command is used to check the integrity of a file system?
fsck
syntax -> fsck [options] {device/file system name}
note. most systems automatically run the fsck command at boot
What does fsck -r do?
Repairs file system
syntax -> fsck -r {device/file system name}
How do you remove a partition on a MBR?
To remove a partition use fdisk {device name}
- enter p to list the existing partitions.
- enter d to start removing a partition.
- enter partition number of partition you want to remove
- enter w to write your changes and exit the utility
What command do you use to partition a GPT?
gdisk
What is the GNU Parted utility used for?
used to manage partitions and you would use the parted command
syntax -> parted [options] {device name}
How do you create a partition using GNU Parted?
Enter parted {device name}
- enter print to list the existing partitions
- enter mkpart to start creating a partition
- enter desired partition name
- enter desired file system type
- enter desired start of the partition in the format #{unit} where # is any integer and unit is MB, GB, TB, etc.
- enter desired end of the partition in the format #{unit} where # is anyinteger and unit is MB, GB, TB, etc.
- Enter quit to exit GNU Parted.
How do you remove a partition using GNU Parted?
Enter parted {device name}
- enter print to list the existing partitions
- rm to start creating a partition.
- enter partition number of the partition you want to remove.
- Enter quit to exit GNU Parted.
What is PartEd?
Partition Editor, allows you to configure both MBR and GPT
What command updates the kernel with changes in the partition table?
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 do you create a file system on a partition?
- enter mkfs.{file system type} {device or partition name}
- verify results indicate the file system was created.
note. another syntax option -> mkfs [options] {device name}
How do you view supported file systems?
ls /usr/sbin/mkfs*
What command is used to enlarge or shrink an ext2/3/4 file system on a device?
- unmount the file system.
- resize the file system using resize2fs [options] {device/file system name} [desired size]
note. that resize2fs does not resize partitions
What does the tune2fs command do?
helps you configure various “tunable” parameters associated with an ext2/3/4 file system.
syntax -> tune2fs [options] {device/file system name}
What is the dumpe2fs used for?
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.
What is a swap system ?
a partition on the storage device that is used when the system runs out of physical memory.
How do you format a swap partition ?
utility called mkswap
How do tell system to use swap partition?
swapon
What can be found in the fstab file?
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
.
What is the purpose of the crypttab file?
/etc/crypttab file purpose is to store information about encrypted devices and partitions that must be unlocked and mounted on system boot.
How do you label a ext disk?
e2label
How do you label a xfs disk?
xfs_admin -L
How do you mount a disk ?
mount
syntax -> mount [options] {device name} {mount point}
How do you see your HDD and how full they are?
df -h
How do you unmount a disk?
umount
syntax -> umount [options] {mount point}
How do you make a mounting changes persistent?
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
What is the most common file system in Linux?
ext3
This file system is stable and well supported. Note is uses bitmapping which can be inefficient.
What are the benefits of using ext4?
ext4 is an update to ext3 and increases file and volume sizes, uses extents instead of bitmapping and incorporates journaling
What is XFS?
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
What is the following XFS tool used for: xfs_info?
Display details about the XFS file system, including its block information.
syntax -> xfs_info [-V] [-t mtab] [mount point | device | file]
What is the following XFS tool used for: xfs_admin ?
Changes the parameters of an XFS file system, including its label and UUID.
What is the following XFS tool used for: xfs_metadump ?
Copy the superblock metadata of the XFS file system to a file.
What is the following XFS tool used for: xfs_growfs ?
Expand the XFS file system to fill the drive size.
What is the following XFS tool used for: xfs_copy ?
Copy the contents of the XFS file system to another location.
What is the following XFS tool used for: xfs_repair ?
Repair and recover a corrupt XFS file system.
What is BTRFS?
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 do you resize a filesystem?
Possible using utilities like resize4fs or LVM
What is device mapping?
device mapper creates the virtual device and passes data from that virtual device to one or more physical devices.
What is DM-Multipath?
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.
Define mdadm?
A command tool used to manage software-based RAID arrays.
How do we pick where to mount a file system?
Mount Points
Common Partitions and File System layouts:
- Swap
- /home
- /boot
- /usr
- /usr/local
- /opt
- /var
- /tmp
- /mnt
- /media