Task 7.1(B)✍️: Increase or Decrease the size of static partition of Linux .
Let’s see what static and dynamic means….

- 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

Then click on create button

Then tap next

Again tap next

Now give a name to your new H.D & specify it a size you wish for it.
Here our H.D is created but still it is not attached to our VM or RHEL8 O.S.

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 picture
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/sdd
here
- to create a new partition press n then as we are first time creating partition i.e
2. for primary partition press p hit enter size let’s say of 10GB and
3. to save it press w that’s it our partition of 10GB /dev/sdd1 is created.

Partition done
- Now load a driver so that user can interact with this H.D storage by using : #udevadm settle
- Format this partition using : #mkfs.ext4 /dev/sdd1

Format done
- 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 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 , my data is not lost.

- Now we will unmount the partition created earlier, to increase it’s storage i.e static storage using command #umount /gc_LVM
- Then we will delete the partition by pressing d using command
: #fdisk /hard-disk-name

- For creating a partition of 15GB ,I am increasing storage by 5GB more here n is for new partition and to save it press w.

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.
📍Moving a partition size/recreating a partition is usually a non-destructive operation up to the point before formatting it.
📍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 require 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.

Clean & Scan
As we had earlier formatted 10GB 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 size of partition.

Partition re-formated
Some times we have big commands we need to again & again manually run them but here i have some small trick or way💡 without manually typing within a go we can run that big command so go to history=>check command line-number=>!command-number run it ! that’s it we again ran same big command without more typing…here i did re-mount using #mount /partition-name /folder-name.

Static Partition successfully increased!!
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 for reading my article🤗😌😌