BCE-C712 Linux System Administration

0 of 74 lessons complete (0%)

Managing Unix File Systems

Lab: Partitioning a Disk and Using it

You don’t have access to this lesson

Please register or sign in to access the course content.

Lab: Partitioning and Using a Disk

Objective: To practice partitioning a disk and utilizing the created partitions for data storage.


  • A Unix-like system (Linux distribution) with a disk available for partitioning.
  • Administrative privileges (sudo or root access) may be required.


Note: Before proceeding, ensure you have a backup of any important data on the disk, as partitioning may lead to data loss.

  1. Identify the Disk:Use the lsblk or fdisk -l command to list available disks and identify the target disk for partitioning. For example, let’s assume the target disk is /dev/sdb.
  2. Launch Disk Partitioning Tool:Use a partitioning tool like fdisk or parted to partition the disk.For example, using fdisk:bashCopy codesudo fdisk /dev/sdb
  3. Create Partitions:In the partitioning tool (fdisk in this example):a. Type n for creating a new partition. b. Select the partition type (primary, extended, or logical). c. Specify the partition size (in cylinders, +size{K,M,G}). d. Repeat steps a-c to create additional partitions if needed.
  4. Set Partition Type:If creating a partition for a specific file system (e.g., ext4), set the partition type:a. Type t to change the partition type. b. Select the partition number. c. Specify the partition type code (e.g., 83 for Linux filesystem).
  5. Write Changes:Once partitions are created, save the changes:a. Type w to write the changes to disk and exit.
  6. Format Partitions:Use a suitable file system format command (e.g., mkfs.ext4, mkfs.ntfs) to format the partitions. For example:bashCopy codesudo mkfs.ext4 /dev/sdb1 Repeat for each partition (e.g., /dev/sdb2, /dev/sdb3).
  7. Create Mount Points:Create directories for mounting the partitions:bashCopy codesudo mkdir /mnt/partition1 sudo mkdir /mnt/partition2
  8. Mount Partitions:Mount the partitions to the created directories:bashCopy codesudo mount /dev/sdb1 /mnt/partition1 sudo mount /dev/sdb2 /mnt/partition2 Adjust the mount points and partition names as per your setup.
  9. Verify Mounts:Use the df -h command to verify that the partitions are mounted correctly and check their available space.
  10. Automount Partitions at Boot (Optional):Add entries to the /etc/fstab file to ensure partitions are mounted automatically at system startup.
  11. Test Data Storage:Create, modify, and delete files within the mounted partitions to ensure they function as expected.
  12. Unmount Partitions (Optional):If you need to unmount the partitions temporarily, use the umount command:bashCopy codesudo umount /mnt/partition1 sudo umount /mnt/partition2


You have successfully partitioned a disk, formatted the partitions, and utilized them for data storage. This exercise provides hands-on experience with disk management in a Unix-like system. Remember to exercise caution when performing disk operations to avoid unintended data loss.