Increase OR Decrease the size of static partition in linux

Let’s move towards practical part👇🏻

Firstly we will add a new external hard disk of let’s say 20GB

To add an external H.D go to

Settings=>Storage=>Add hard disk

To attach just click on choose that’s it our H.D name & size you specified will pop-up there tap ok! as you can see in above snapshot.

Now it’s time to go inside o.s & do this task🙌

Step 1 : Check & verify new H.D attached or not

We will check & verify by using : #fdisk -l

Step 2 : To create a partition,format & mount.

For partition we will go inside this H.D so we will use : #fdisk /dev/sdb here to create a new partition press n then as we are first time creating partition i.e primary partition press p hit enter size let’s say of 10GB and to save it press w that’s it our partition of 10GB /dev/sdb1 is created.

Now as we are using RHEL8 O.S we need to load a driver so that user can interact with this H.D storage by using : #udevadm settle

Then we need to format this partition using : #mkfs.ext4 /dev/sdb1

After this, we will mount this partition

Firstly we will create a directory or folder using: #mkdir /folder-name

So to mount we will use: #mount /partition-name /folder-name

Then using: #df -h or #lsblk command we can verify it is successfully mounted.

Step 3: Increase OR Decrease the size of the static partition in Linux

Here before I do partition I will make text files to prove that after I increase or decrease my partition storage it won’t lose my data.

Now we will do unmount of the folder we created earlier to increase its storage i.e static storage using command #umount /as_LVM

Then we will delete the partition by pressing d using a command

: #fdisk /hard-disk-name

Have you noticed??👀 Before increasing static partition it asked me Yes Or No? & it is telling partition #1 contains a ext4 signature what does it mean??🧐

📍So,the signature of partition is basically a mark/beacon there is something there, and it is not empty. It may also identify a partition.

📍It is useful on the context of several utilities/OS to tell the partition has already data there.

📍So a signature warning is signalling you “There is already data here!…are you sure you want to go ahead?”

As for removing it or not, it depends on whether you are for instance resizing a partition or creating a new partition . If you are creating a new partition, obviously you may want to remove the signature, if you are resizing a partition you surely want to keep it so i pressed here w to keep this signature as it contains my data i.e text files we created earlier.

But here a challenge comes in scenario🤔 i know i have somewhere my data files but how to retreive them back?🤨

So for that i repaired my partition table or inode table i.e Clean & Scan if any bad corrupted files, data…etc it will remove using command :#e2fsck -f /dev/sdd1 here full form of this command is extend to(2) file system clean check & -f means forcefully clean it.

As we had earlier formatted 10GB now let’s re-format this 5GB more data by using command #resize2fs /dev/sdb1 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 size of partition.

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

As we can see in above snapshot our static partition is successfully increased from 10GB to nearly 15GB 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

Finally,our task 7.1.B Increase OR Decrease the size of static partition in linux is successfully accomplised !

Thank 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