Challenge, Hard,  on  Linux

This challenge builds upon the basic GPT partitioning challenge by introducing multiple partitions with different filesystems.

Real-world servers often need their storage divided for different purposes: fast, journaled filesystems like ext4 for logs and system data, and advanced filesystems like btrfs for application data that benefits from features like snapshots, compression, and copy-on-write semantics.

Linux system with an additional drive split into two partitions: one ext4 for logs, one btrfs for data.

Device names on the diagram are deliberately generic.

Your mission is to:

  1. Create a GUID partition table (GPT) on the blank 40 GiB drive.
  2. Add a first partition of exactly 10 GiB for log storage.
  3. Add a second partition using the remaining ~30 GiB for data storage.
  4. Format the first partition as ext4 and mount it at /var/log/acme.
  5. Format the second partition as btrfs and mount it at /var/lib/acme.
  6. Write test files: service.log in the logs partition and dataset.txt in the data partition.
Hint 1: Finding the blank drive 💡

Use lsblk or fdisk -l to identify the unpartitioned drive. Look for a device with no existing partitions or filesystems.

Hint 2: Partition sizing in parted 💡

When creating partitions with parted, you can specify exact sizes like 0% 10GiB for the first partition, then 10GiB 100% for the second. The tool handles the math automatically.

Hint 3: Kernel partition updates 💡

After creating partitions, you need to make the kernel aware of the new partition table before formatting. The best tool for this job is partx -u.

Hint 4: Installing btrfs tools 💡

You'll need btrfs-progs to format and manage btrfs filesystems:

sudo apt-get update
sudo apt-get install btrfs-progs
Hint 5: Creating mount directories 💡

Don't forget to create the mount point directories before trying to mount the partitions.

Level up your Server Side game — Join 10,500 engineers who receive insightful learning materials straight to their inbox