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
.