- unmount the storage before decreasing or increasing the storage.
- ‘ fdisk -l ‘ -This command will give the storage names of the devices connected.
- fdisk ‘device name’ -This command can be used to create/delete an partition .
- p -to get the partitions
- d -Delete the Partitions
- n -To create a new partition
- w -To write the changes in partition tables
4. e2fsck -f ‘device name’ -To check the filesystem is it ok or some errors
5. resize2fs ‘device name’ -To resize our file system so new blocks will sync with the older one
6. Mount the storage after increasing or decreasing the storage.
Lets consider a folder is mounted with a harddisk which is of 4GB in size but we need storage of 8GB So we increase the storage of same Harddisk to 8GB without loosing the data.
Now we will be increasing the storage without loosing the data.
First we need to unmount the storage .
Next we need to delete the partition using the fdisk command
Now we can create the desired storage of 8GB
Now we need to run e2fsck -f “name” for any errors in the filesystem.
now we have to resize our file system so new blocks will sync with the older one .
To do this we have the following command resize2fs “device name”
after mounting we see that the data is still available in the storage.