*..Increase or Decrease the Size of Static Partition in Linux..*


We do static partition in Linux but we can’t increase or decrease size of partition on fly. So for that we do dynamic partition using LVM partition . But here in this article we see that how to create an static partition and on fly how to increase or decrease it.

What we see in this article….

Parted tool..

Install partition tool..

Creating static partition..

Increase partition size..

Decrease partition size..

**Parted Tool..

So you need to manage a storage device..? Well, if you are a Linux administrator, then you are in luck. As it turns out, there are a ton of different tools and command suites that you can use to accomplish this. Today we are going to look at the parted command suite. GNU parted (Partition Editor )was created by Andrew Clausen and Lennert Buytenhek. It runs at the command line, or with a graphical interface, if that's more your speed. We are going to focus on the command line variant here. Let's look at some of the functionality parted offers.

**Install Partition Tool..

For install parted use command..

yum install parted

In my case it is already installed..Now let’s check the version of parted so we conform that the parted is actually installed using command

parted — version

Here our parted 3.2 tool is installed.

Now let’s see if any partition is there or not using command


Here in my case I am using /dev/sdb hard disk and there no any partition.

**Creating a Partition..

Now let’s do the partition using command..

parted (device name)

Now,let give the label to our partition using command.

(parted) mklabel msdos

Now for creating a partition use command..

(parted) mkpart

Follow the steps above for making partition

Now, the partition is created successfully. Exit the parted menu by pressing q(Enter). Let’s check partition is created or not..

Our partition is created successfully.After that we should format the new partition using command..

mkfs.ext4 (partition name)

After that mount the new partition by creating new directory using command..

mkdir (folder /directory name)

mount (partition name)

Let’s check for mount point.

Now, I’m putting some data inside partition to show you that data will not be lost after increasing or decreasing the partition.

**Increasing partition size..

For increasing the size of the partition we have to go inside parted again. Now let’s increasing the partition size using command..

(parted) resizepart

Now, check the photo below and follow the steps for extending the size of partition.

Now, the size of the partition is successfully increased. To cross-check, we can run lsblk command.

Let’s check if any data loose by opening the folder..

You geeks remember I have created a file named as .txt. Let’s find out it is still there or removed. For this check the below image..

You can see that file is still there and there is absolutely no data loss during the process of extending the size of the partition. Now, let’s see, shrinking the partition would affect our data or not. For use command ..

(parted) resizepart

Everything is the same that I have done above, but the only minor change is now endpoint is at 1024MB. Now the disk will resize to around 1GB.

Now, the size of the partition is successfully decreased. To cross check, we can run lsblk command.

Let’s again check for data loose for opening our data.txt file..

You can see that file is still there and there is absolutely no data loss during the process of shrinking the size of the partition.

So, Our static partition is successfully created , increase and decrease also using parted tool.

…..Yes,we did our static partition task successfully.

****If you like it then Clap and Share….!!!!

  • **If you like it then follow me in LinkedIn ………

.**Thank You for visiting ..Hope this blog help you…!!



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store