Challenge
DifficultyHard
Learner activity254 solved of 401 attempts

Split a Drive into Multiple Partitions And Format Them as Ext4 and Btrfs

Ivan Velichko
by  Ivan Velichko · on
Linux
Create two partitions on a blank disk: one smaller ext4 for service logs and the rest btrfs for service data. Mount both and prove they work.

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: Finding the blank drive

Use lsblk -f or sudo blkid to identify the unpartitioned drive. Look for a device with no existing partitions or filesystems.

Hint: 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: Kernel partition updates

After creating partitions, the kernel needs to be aware of the new partition table before you can format them. Partitioning tools like parted and gdisk usually tell the kernel about the new partitions themselves. If lsblk still doesn't show the partitions, make the kernel re-read the partition table. The best tool for this job is partx -u.

Hint: 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: Creating mount directories

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

Problem
Solution
Start