Increase And Decrease Size Of Static Partition In Linux Over AWS Cloud
🌀 7.1.a: Elasticity Task
🔅Increase or Decrease the Size of Static
Partition in Linux.
Increase the static partition in Linux
Let’s get started
To perform this practical you need basic knowledge of Linux partitions so in this part, we will increase our static storage.
Here In this practical Virtual Machine is used. For Increasing or Decrease the size of the static partition in Linux first we have to attach that hard disk to that particular Operating System.
To check how many hard disk attached to my OS:
Here we use fdisk -l command to chech all the connected hard disk.
So we have two hard disk connected:
Create Physical Volume(pv):
A physical volume is any physical storage device, such as a Hard Disk Drive (HDD ), Solid State Drive ( SSD ), or partition, that has been initialized as a physical volume with LVM. Without properly initialized physical volumes, you cannot create Volume Groups or logical volumes.
In the above image we use two commands:
- pvcreate: To create the physical volume
- pvdisplay: To view the reated physical volume.
Volume Group (vg):
A volume group ( VG ) is the central unit of the Logical Volume Manager (LVM) architecture. It is what we create when we combine multiple physical volumes to create a single storage structure, equal to the storage capacity of the combined physical devices
Here in the above image we use two command:
- vgcreate : To create the Volume Group.
- vgdisplay :To view the created Volume Group.
Now from here we have to follow 2 STEPS :
STEP 1 : Format the logical volume with mkfs.ext4 command. 👇
Step 2: Create a new directory “mkdir /l1” and mount it “mount /dev/myvg/mylv1 /l1”. 👇
Here we see we successfully joined two external hard disk into one single Hard Disk.
Extend The Physical Volume:
Suppose in an emergenvy you need some new hard disk to store your data but at that time it is possible to go market and buy new one..
So in that case we take the space from a hard disk which is already attach to my OS and having some free space.
It take 2 simple steps let’s see 👇
Step 1: 👇
To extend simple use an command “lvextend — size +5G /dev/myvg/lv1”
Its take 5GB free space from Physical volume l1 and xtent it to the Logical Volume.
To attach the part to my OS we have to do format only the part we take, we don’t have require to format entire storage “resize2fs /dev/myvg/lv1”