Increase or Decrease the Size of Static Partition in Linux

Initially we need to attached the hard disk of any size to virtual Machine…..

  • For Example :- i took the size of 10 GB as shown bolow…

To see :- fdisk -l

Device name in my case is : /dev/sdb

As we can see already 5 GB partition is attach to the folder /bag as shown below :-

Data present inside the folder shown below :

A. Increase the Size of the partition

  1. Unmount the folder from the partition :

Command : umount /folder_name

2. Delete the older partition :

command : fdisk device_name

then press d -> to delete

then press w -> to save

3. create new partition with increasing the size :

In my case i increased the size from 5 GB to 7 GB …

Command : fdisk device_name

then press n -> to crate new partition

then press enter

again press enter

again press enter

then give size of 7 GB

Here they ask you do you want to remove the signature ? if you press Yes then the data you store in the folder bag will lost and if you press No then the data will be their.

then press w -> to save

To check the the partition of 7 GB is created or not as shown bolow :

command : fdisk -l

Now in case of increasing the data no need to format the partition or else you will lose the data.

4. Mount the folder /bag to newly created partition :

command : mount /dev/sdb1 /bag

5. Check the newly created partition is attached or not….

command : lsblk

6. Check inside the folder /bag the data is present same…

Hence we successfully increased the size……

B. Decrease the Size of the Partition :-

Follow the same step as shown above from stem 1 to 6…

note: just do small change while creating the new partition in step 3 their you need to give the size small to decrease…

Thank You for Reading !!!!