Correct Answers
Command to write a GPT disk label to the disk /dev/vdb - Answer-parted /dev/vdb
mklabel gpt
Command to create a primary MBR partition on /dev/vdb of type xfs filesystem that
starts at 2048s and ends at 1000MB - Answer-parted /dev/vdb mkpart primary xfs
2048s 1000MB
Command to create a GPT partition on /dev/vdb named userdata of type xfs that starts
at 2048s and ends at 1000MB - Answer-parted /dev/vdb mkpart usersdata xfs 2048s
1000MB
Command that must ALWAYS be run after creating a new partition
(This command waits for the system to detect the new partition and to create the
associated device file under the /dev directory) - Answer-udevadm settle
Command to apply a filesystem to a block device after its been created - Answer-
mkfs.TYPE BLOCKDEVICE
(i.e. for an xfs filesystem on /dev/vdb1, mkfs.xfs /dev/vdb1)
Command to apply an ext4 filesystem to the block device /dev/vdb1 - Answer-mkfs.ext4
/dev/vdb1
File to edit to persistently mount a filesystem after reboots - Answer-/etc/fstab
Entry format for mounting a filesystem persistently in /etc/fstab - Answer-UUID, mount
point, filesystem type, options, dump, fsck
What should the fsck be set to for xfs filesystems in /etc/fstab entries? - Answer-0
What should the fsck be set to for ext4 filesystems in /etc/fstab entries? - Answer-1 or 2
(1 for the root filesystem; 2 for other ext4 filesystems)
Command to scan block devices connected to a machine and retrieve filesystem UUIDs
- Answer-lsblk --fs
Command that must ALWAYS be run after making edits to /etc/fstab - Answer-systemctl
daemon-reload
, Command that should always be used after adding entries to /etc/fstab to ensure the
entry is valid - Answer-mount /MOUNTPOINT
Command to create a swap space on /dev/vdb named swap1 that starts at 1001MB and
ends at 1257MB - Answer-parted /dev/vdb mkpart swap1 linux-swap 1001MB 1257MB
Command that applies a swap signature to format the device /dev/vdb2
(must be run after creating a swap space for swap to be used) - Answer-mkswap
/dev/vdb2
Command that activates a formatted swap space - Answer-swapon
(swapon -a to activate all swap spaces listed)
Example entry in /etc/fstab to activate swap space at every boot, using "UUID" for the
UUID - Answer-UUID swap swap defaults 0 0
(For swap spaces, the swap name can also be used in place of the UUID)
(Swap space entries in /etc/fstab can also specify nice levels in place of default: pri=4)
Two commands to create a primary partition on /dev/vdb to be used for a logical volume
that starts at 1MiB and ends at 769MiB
(Hint: the second command has to do with the partition being used to create a logical
volume. How do you set the partition type to Linux LVM?) - Answer-parted -s /dev/vdb
mkpart primary 1MiB 769MiB
parted -s /dev/vdb set 1 lvm on
Command to label/create the partition /dev/vdb1 as a pysical volume - Answer-pvcreate
/dev/vdb1
Command to create a volume group named vg01 with /dev/vdb1 and /dev/vdb2 physical
volumes - Answer-vgcreate vg01 /dev/vdb1 /dev/vdb2
Command to create a logical volume named lv01 of size 700M from the available
physical extents in the volume group vg01 - Answer-lvcreate -n lv01 -L 700M vg01
(-L sets the LV size in bytes; -l sets the LV size in extents)
Command to create an xfs filesystem on the logical volume lv01 in the volume group
vg01 - Answer-mkfs -t xfs /dev/vg01/lv01