Increase or Decrease the Size of Static Partition in Linux.
To increase the size of static partition:
Step1: Create a partition (say of 2Gb)
Step2: Format(ext4) it and mount a folder (say lw) to it
Step3: Create file and store in that partition.
Step4: Unmount folder
Step5: Delete the created partition and save the settings
Step6: Create new partition of size bigger than that of previous one(say 4Gb)
Step7: Now use “e2fsck -f /dev/sdb1”
This command checks the filesystem(ext2,ext,3,ext4), if error is there like OS shutdown abruptly then, our inode table might have some garbage/bad block. hence this command will remove all of them.
Step8: Now use “resize2fs /dev/sdb1”
This command format(create filesystem like ext4) the remaining volume added to the partition i.e. 4-2=2.
Step9: Now mount the previously mounted folder i.e. lw.
We will see that our previously created file and its data is present in it!!!
To decrease the size of static partition:
Step1: Create a partition (say of 4Gb)
Step2: Format(ext4) it and mount a folder (say aaa) to it
Step3: Create file and store in that partition.
Step4: Unmount folder
Step5: use "e2fsck -f " on partition(eg. e2fsck -f /dev/sdb1)
this command will basically clear all the garbage/bad blocks from inode table
Step6: use "resize2fs" command to reformat the partition with new size(say 2Gb) and not loosing the data. Basically we are just updating the inode table (eg. resize2fs /dev/sdb1 2G)
Step7: again mount the partition
We will see our data is not lost!!!
Feeling blessed to have Such hardworking Team..!!! 💯💯