Complete the code to list all disk partitions on a Linux system.
lsblk [1]The lsblk -l command lists all block devices in a list format, showing partitions clearly.
Complete the command to check disk usage of the root directory.
df [1] /-a which shows all filesystems, not just root.-T which shows filesystem type instead of size.The df -h / command shows disk usage of the root directory in a human-readable format.
Fix the error in the command to create a new partition on /dev/sdb using fdisk.
echo -e 'n\np\n[1]\n\n\nw' | fdisk /dev/sdb
The n command creates a new partition, and 1 selects partition number 1.
Fill both blanks to create a mount point and mount the partition /dev/sdb1 to it.
mkdir [1] mount [2] /mnt/data
You create the directory /mnt/data and mount the device /dev/sdb1 there.
Fill all three blanks to add a new entry to /etc/fstab for automatic mounting of /dev/sdb1 to /mnt/data with ext4 filesystem and default options.
echo '[1] [2] [3] defaults 0 2' | sudo tee -a /etc/fstab
The fstab entry format is: device, mount point, filesystem type, options, dump, pass.
Here, device is /dev/sdb1, mount point is /mnt/data, and filesystem type is ext4.