How to view partitions in Linux?

Viewing Partitions in Linux: A Comprehensive Guide

Introduction

Linux is a popular operating system that allows users to manage and interact with their system’s hardware components. One of the most critical aspects of Linux is the partitioning system, which divides the hard drive into smaller, independent partitions for storing different types of data. In this article, we will explore how to view partitions in Linux, including how to identify and manage them.

Understanding Partition Types

Before we dive into the process of viewing partitions, it’s essential to understand the different types of partitions:

  • Primary Partition: The primary partition is the main operating system partition, which contains the Linux kernel and other essential system files.
  • Extended Partition: An extended partition is used to create a logical volume group, which can be used to create multiple logical volumes.
  • Logical Volume Group (LVG): A logical volume group is a collection of logical volumes that are stored on a single physical volume.
  • File System: A file system is a way to organize and store files on a partition.

Viewing Partitions in Linux

To view partitions in Linux, you can use the lsblk command, which lists all available block devices, including partitions. Here’s a step-by-step guide:

  • Open a terminal: Open a terminal on your Linux system.
  • Run the lsblk command: Type lsblk and press Enter to list all available block devices.
  • Filter the output: Use the --all option to include all block devices, including partitions.
  • View the partition table: Use the --table option to view the partition table.

Viewing Partition Information

Once you have listed the partitions, you can view their information using the lsblk command with the --info option. Here’s an example:

  • Open a terminal: Open a terminal on your Linux system.
  • Run the lsblk command: Type lsblk and press Enter to list all available block devices.
  • Filter the output: Use the --all option to include all block devices, including partitions.
  • View the partition table: Use the --table option to view the partition table.

Partition Device Mountpoint Filesystem Size Used Free
/ /dev/sda1 / ext4 100G 20G 80G
/ /dev/sda2 / ext4 100G 20G 80G
/ /dev/sda3 / ext4 100G 20G 80G

Identifying Partitions

To identify partitions, you can use the df command, which displays the disk usage information. Here’s an example:

  • Open a terminal: Open a terminal on your Linux system.
  • Run the df command: Type df and press Enter to display the disk usage information.
  • View the partition table: Use the --table option to view the partition table.

Partition Device Mountpoint Filesystem Size Used Free
/ /dev/sda1 / ext4 100G 20G 80G
/ /dev/sda2 / ext4 100G 20G 80G
/ /dev/sda3 / ext4 100G 20G 80G

Managing Partitions

To manage partitions, you can use the parted command, which allows you to create, delete, and resize partitions. Here’s an example:

  • Open a terminal: Open a terminal on your Linux system.
  • Run the parted command: Type parted and press Enter to open the partition manager.
  • Create a new partition: Use the mkpart command to create a new partition.
  • Delete a partition: Use the rm command to delete a partition.
  • Resize a partition: Use the resize command to resize a partition.

Conclusion

In this article, we have explored how to view partitions in Linux, including how to identify and manage them. By understanding the different types of partitions and using the lsblk and df commands, you can effectively manage your Linux system’s hardware components. Remember to always use caution when managing partitions, and consult the official Linux documentation for more information.

Additional Resources

  • Linux Documentation: The official Linux documentation provides detailed information on partitioning and managing partitions.
  • Linux Tutorial: A comprehensive Linux tutorial covers the basics of Linux and partitioning.
  • Linux Forums: Linux forums provide a community-driven platform for discussing Linux-related topics, including partitioning.

Unlock the Future: Watch Our Essential Tech Videos!


Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top