HardDrive Partition Commands In Linux | Redhat7

Below are some commands which can be use to check,create,modify system hard-drive partitions in Linux. We will see detail uses of these commands in our future posts soon.


1) cfdisk /dev/sda

Creating a partitions in graphical way

2) fdisk /dev/sda

Same as 1 but without graphical way

3) swapon -s

Check the swap partition

4) dd if=/dev/zero of=/path_to_file/ bs=1M count=100

Creating dump in a file up-to 100MB

5) lsblk

List block of devices partitions

6) mkfs + press tab button

To format partition with any given file system

7) partprobe

After creating a new partition you have to Update the partition table for kernel.This commands helps you to update the partition table without rebooting system.

8) mkswap /dev/sdb2

Format as swap partition

9) swapon -a

To make it active

10) add swap partition entry in /etc/fstab 

To make swap partition permanent

Sharing is Caring😀

Post a Comment