Understanding Partitions and Filesystems
- Partition: A logical division of a physical disk.
- Filesystem: A structure used to organize and store data on a partition.
Common Filesystems:
- EXT4: The default filesystem for most modern Linux distributions.
- NTFS: Commonly used on Windows systems.
- FAT32: Older filesystem, often used for USB drives.
Tools:
- GParted: A graphical disk partitioning tool.
- fdisk: A command-line disk partitioning tool.
- mkfs: A command-line tool to create filesystems.
Lab Exercises:
1. Creating a New Partition
- Open GParted: Launch GParted from your applications menu.
- Select the disk: Choose the disk you want to partition.
- Create a new partition: Right-click on unallocated space and select "New".
- Set parameters: Choose the size, file system, and mount point for the partition.
- Apply changes: Click "Apply" to save the changes.
2. Formatting a Partition
-
Use the
mkfs
command:Bashsudo mkfs.ext4 /dev/sda1
Replace
/dev/sda1
with the device path of your partition.[Image of the
mkfs
command output]
3. Mounting a Filesystem
- Create a mount point:
Bash
sudo mkdir /mnt/newpartition
- Mount the filesystem:
Bash
sudo mount /dev/sda1 /mnt/newpartition
4. Checking Filesystem Information
- Use the
df
command:Bashdf -h
5. Unmounting a Filesystem
- Unmount the filesystem:
Bash
sudo umount /mnt/newpartition
6. Resizing a Partition
-
Use GParted:
- Select the partition you want to resize.
- Drag the resize handle to adjust the size.
- Apply changes.
-
Use the
resize2fs
command:Bashsudo resize2fs /dev/sda1