How to Increase or Decrease the Size of Static Partition in Linux?

What is a static partition?

Static(Fixed) Partitioning:
->According to geek for geeks

This is the oldest and simplest technique used to put more than one process in the main memory. In this partitioning, a number of partitions (non-overlapping) in RAM is fixed but the size of each partition may or may not be the same. As it is a contiguous allocation, hence no spanning is allowed. Here partition is made before execution or during system configure.

As illustrated in the above figure, the first process is only consuming 1MB out of 4MB in the main memory.
Hence, Internal Fragmentation in first block is (4–1) = 3MB.
Sum of Internal Fragmentation in every block = (4–1)+(8–7)+(8–7)+(16–14)= 3+1+1+2 = 7MB.

Suppose process P5 of size 7MB comes. But this process cannot be accommodated in spite of available free space because of contiguous allocation (as spanning is not allowed). Hence, 7MB becomes part of External Fragmentation.

First of all, we focus on the agenda:

  1. Attach a disk with OS
  2. Create partition
  3. Increased that partition

Let’s implement this concept without waste your time…

To perform the whole particle we need to follow the steps given below:

Step -1)

First, We check if we have a disk attached to the OS or not if not attached then we’ll attach. To list all available disk we need to run the following command

“fdisk -l”

The output will be


After run fdisk -l command we got a list of all available disks in my case I select /dev/sdb to create a partition with a size of 10 GB.


After that, we have to do a partition of the attached disk. To create a partition we need to go inside the harddisk.

Here we can able to see fdisk /dev/sdb fdisk is the command to go inside this harddisk /dev/sdb is the hard disk name.

Now we’ll do a partition of selected disks with the size according to your choice.

you reach inside the disk then follow the steps given below

  1. Type ’n’ to create a new partition.
  2. Specify where you would like the partition to end and start. You can set the number of MB of the partition instead of the end cylinder. For example +1000M(in my case it is +4G)
  3. After here you think why one extra option ‘Y” comes up so don’t worry if you do partition the first time then this option will not have come.
  4. Type ‘p’ to view the partition, and type ‘w’ to save the partition

Now we can verify with the following command “lsblk”

Step -3)

Format created partition to format we use mkfs.ex4 command

Step -4)

Make a directory and mount the drive with that directory. For make directory, we use “mkdir” and for the mount, we use the” mount” command

We can verify with lsblk command drive successfully mounted or not.

Now we have created two files in /l1 directory because after increased the size of static partition we will check again our data lost or not.

To create an empty file we use the touch command

Now the challenge is How to increase/ decrease the size of the static partition.

To increase the size of the static partition we need to perform the following steps:

Target — Till now our partition size 4GB and we want to increase it to 9 GB.

Step -1)

We have to delete the partition that we created earlier. We can follow the steps shown in the below image.

Step -2)

After deleting that partition we’ll create a new partition with increased size in our we’ll create a partition with size 9 GB. To create a partition follow the steps shown in the below image

In the above image, there is an extra option name is “Do you want to remove signature”

So there I select “Y” why I am not select “N”?

As we had earlier formatted 4GB now let’s re-format this 5GB more data by using command #resize2fs /dev/sdd1 here we didn’t use mkfs.ext4 to re-format it will loose my data and so i used resize2fs as it is part of ext4 format-type also it won’t loose my data. In ext4 format type, we can extend & reduce the size of the partition.

So here i did re-mount using #mount /partition-name /folder-name.

We can verify with command df -hT

As we can see in the above snapshot our static partition is successfully increased from 4GB to nearly 9GB using command #df -h

Now let’s check do i got or have my data still or not?

Oh! Yes it’s still there hence proved though we resized my partition our data won’t be lost by using command: #ls

thanks for reading…..



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