Linux System Administration

0 of 85 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.

Objective:

To learn how to partition a disk in Linux using command-line tools.

Prerequisites:

  • Basic understanding of Linux terminal commands
  • A non-mounted block device (e.g., /dev/sdb) for partitioning
  • Administrator privileges (using sudo)

Lab Exercise: Disk Partitioning

1. List Available Disks: Begin by listing all available storage devices:

Identify the disk that you will partition (e.g., /dev/sdb).

2. Using fdisk to Create Partitions:

  • Open the disk for partitioning:

Interactive steps:

  • Type n to create a new partition.
  • Choose the partition type (Primary or Extended).
  • Set the first and last sectors, or press Enter to accept defaults.
  • Type p to display the current partition table.
  • Type w to write the partition table and exit.

3. Verify the Partition: After creating the partition, verify it using:

4. Formatting the Partition:

Format the newly created partition (e.g., /dev/sdb1) using a filesystem of your choice:

5. Mount the Partition: Create a mount point and mount the partition:

6. Verify the Mounted Partition: Check if the partition is mounted:

7. Unmount and Automate Mounting: Unmount the partition:

To automate mounting, add the partition to the /etc/fstab file.

8. Removing a Partition: If you want to delete a partition, repeat step 2, but use d instead of n to delete the partition.

Lab Report:

  • The commands used for each step
  • Screenshots of their partitioning progress
  • Verification of the partition and formatting
  • Final confirmation with the mounted partition