0% found this document useful (0 votes)
16 views17 pages

Creating Partitions and Filesystems

This document provides a comprehensive guide on creating partitions and filesystems, covering the concepts of partitions, partition tables (MBR and GPT), and various filesystems. It includes tools for managing partitions such as fdisk, gdisk, and parted, along with commands for creating and formatting filesystems. Practical exercises are provided to reinforce the concepts, including creating MBR and GPT partitions, setting up swap space, and exploring Btrfs features.

Uploaded by

Stephen Efange
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views17 pages

Creating Partitions and Filesystems

This document provides a comprehensive guide on creating partitions and filesystems, covering the concepts of partitions, partition tables (MBR and GPT), and various filesystems. It includes tools for managing partitions such as fdisk, gdisk, and parted, along with commands for creating and formatting filesystems. Practical exercises are provided to reinforce the concepts, including creating MBR and GPT partitions, setting up swap space, and exploring Btrfs features.

Uploaded by

Stephen Efange
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 17

Creating Partitions and

Filesystems
A Comprehensive Guide
Introduction to Partitions and
Filesystems

• 1. Understanding Partitions
• 2. Understanding Partition Tables (MBR vs.
GPT)
• 3. Understanding Filesystems and Their
Purposes
Understanding Partitions

• - A partition is a logical division of a storage


device that acts as a separate unit.
• - Partitions allow for better data management,
organization, and isolation.
Understanding Partition Tables

• - MBR (Master Boot Record): Supports up to 4


primary partitions, disks up to 2TB.
• - GPT (GUID Partition Table): Supports a large
number of partitions, disks larger than 2TB.
Understanding Filesystems

• - A filesystem controls how data is stored and


retrieved.
• - Common filesystems: ext4, XFS, NTFS, FAT32,
Btrfs.
• - Purpose: Organization, storage management,
access control, data integrity.
Tools for Managing Partitions

• 1. fdisk (Managing MBR)


• 2. gdisk (Managing GPT)
• 3. parted (Managing Both MBR and GPT)
fdisk (Managing MBR)

• - Description: A tool for creating and managing


MBR partitions.
• - Basic Commands:
• - fdisk /dev/sda: Open fdisk for the disk.
• - n: Create a new partition.
• - d: Delete a partition.
• - p: Print the partition table.
• - w: Write changes and exit.
gdisk (Managing GPT)

• - Description: A tool for creating and managing


GPT partitions.
• - Basic Commands:
• - gdisk /dev/sda: Open gdisk for the disk.
• - n: Create a new partition.
• - d: Delete a partition.
• - p: Print the partition table.
• - w: Write changes and exit.
parted (Managing Both MBR and
GPT)

• - Description: A versatile tool for managing


partitions, supporting both MBR and GPT.
• - Basic Commands:
• - parted /dev/sda: Open parted for the disk.
• - mklabel gpt: Create a GPT partition table.
• - mklabel msdos: Create an MBR partition
table.
• - mkpart primary ext4 0% 50%: Create a
Creating Filesystems

• - Using mkfs for Various Filesystems


• - ext2/ext3/ext4: mkfs.ext4 /dev/sda1
• - XFS: mkfs.xfs /dev/sda1
• - VFAT: mkfs.vfat /dev/sda1
• - exFAT: mkfs.exfat /dev/sda1
• - Creating Swap Space with mkswap
• - mkswap /dev/sda2
• - swapon /dev/sda2
Basic Features of Btrfs

• - Multi-device Filesystems: mkfs.btrfs


/dev/sda1 /dev/sdb1
• - Compression: mount -o compress=zlib
/dev/sda1 /mnt
• - Subvolumes: btrfs subvolume create
/mnt/my_subvolume
Practical Exercises

• 1. Create an MBR Partition Using fdisk


• 2. Create a GPT Partition Using gdisk
• 3. Manage Partitions Using parted
• 4. Set Up Swap Space
• 5. Explore Btrfs Features
Exercise 1: Create an MBR Partition
Using fdisk

• - Create a 1GB partition on /dev/sda using


fdisk.
• - Format the partition with ext4.
• - Mount the partition and create a file.
Exercise 2: Create a GPT Partition
Using gdisk

• - Create a 2GB partition on /dev/sda using


gdisk.
• - Format the partition with XFS.
• - Mount the partition and create a directory.
Exercise 3: Manage Partitions
Using parted

• - Create a new partition table (GPT) on


/dev/sda.
• - Create two partitions: one 1GB ext4 and one
1GB VFAT.
• - Print the partition table and mount the
partitions.
Exercise 4: Set Up Swap Space

• - Create a 1GB swap partition on /dev/sda.


• - Use mkswap to set up the swap area and
enable it with swapon.
Exercise 5: Explore Btrfs Features

• - Create a Btrfs filesystem on /dev/sda1.


• - Enable compression and create a subvolume.
• - Explore the created subvolume and observe
the compression effect.

You might also like