Logical Volume Management:
Extending a Volume Group:
1. Extending a volume group is actually adding a new PV to the volume group.
2. To extend a volume group we need to create a new partition using fdisk. Don’t forget to
change its hex code to 8e and update the partition table using partx –a command
1. Create a partition using fdisk, and change the hex code of it to 8e.
2 Save and exit the fdisk and update the partition table using partx –a command
#fdisk /dev/sda
#p
#t
#8e
#w
Create a PV on the newly created partition using pvcreate command:
1.Add the partition to the VG using vgextend command, the syntax for it is
#vgextend VG name partition name
#vgextend ktvg /dev/sda8
2.Verify it pvs command
Increasing the size of a logical volume:
1.Sometimes the file system size may be full,so we need to increase the size of the LV to continue adding the data in it.
2. The size of LV can be increased online, no downtime is required.
3. Check the current size of the LV by using #df –h command.
4. Increase the size of the LV by using lvextend or lvresize command, the syntax for it is
#lvextend –L +addition size /dev/vg/lv name (syntax for lvresize is also same)
#lvextend –L +200M /dev/ktvg/ktlv
Update the file system by using resize2fs command:
#resize2fs /dev/vg/lv name
#resize2fs /dev/ktvg/ktlv
• Verify the change by using df –h command
• Increasing the size of the LV and updating the file system Verify it by
#df –h
Reducing the size of an LV:
1. Reducing the size of an LV is a bit complicated task, there are few things which you need to keep in mind before reducing the size of an LV.
2. LV size cannot be reduced online, it requires a down time i.e. unmounting the file system.
3. Organized the data before reducing the size of LV.
4. Update the file system about the size. I.e. what its size will be after reduction.
5. Finally reduce the size. Huh….! Lots of things to do!!!!
6. If any of the above things are missed then it will be a mess, you may corrupt the file system and LV.
Let’s start the steps carefully:
1. Check the size of the lv using df –h command
2. Unmount the LV using umount command
#umount /ktdir
3. Organize the data in LV by using e2fsck command
4. #e2fsck -f /dev/ktvg/lvm2.
5. Update the file system by using resize2fs command
6. #resize2fs /dev/ktvg/lvm2 300M (where 300M is the approximate total size of LV after reduction
Now reduce the size by using # lvreduce -L -200M /dev/ktvg/lvm2 command:
• We know the size of LV is around 500MB, from previous picture in case of extending the size of LV.
• Or else you can run df –h and verify it again.
• Umount the LV by using umount command
• Organize the data in the file system.
• Update the file system about the size after reduction
• Finally reduce the size of the LV using lvreduce command. It will prompt you about the change type y to continue with reduction.
• Mount the LV and run the command df-h, to verify the change in the size of LV
#mount –a ( if an entry is passed in /etc/fstab use this command)
#df –h
boost Your Linux System With Logical Volume Management,vgextend tutorial,updating file systems with resize2fs,vgreduce tutorial,extending volume groups,increasing logical volume size,reducing logical volume size,lvm,lvm tutorial,extending logical volume manager,lvm extend logical volume,lvms,shrink lvm,what is lvm in linux,how to delete lvm,lvm extend in linux,lvm resizing,lvm linux,linux lvm,resize lvm in linux,reduce lvm,linux,lvs,resize2fs,rhcsa,extend,logical volume management,logical volume,logical volume manager,Logical Volume Management in Linux Server,LearnLinux, Linux, Tutorial, Review, Howto, Guide, Distribution, Distro, Learn Linux, os, open-source, open source, gnu/linux, logical volume manager, lvm, lvm tutorial, linux lvm, partitioning, volume, filesystem, enlarge, resize, logical volume management, physical volume, volume group, lvm linux, linux logical volume, lvm basics, logical volume manager tutorial, lvm in linux, lvm explained, linux tutorial 2025, linux lvm snapshot, linux lvm tutorial, backup, snapshot, logical volume, format,linux academy, linuxacademy.com, cloud jobs, cloud careers, cloud training, cloud course, cloud education, cloud tutorial, cloud certification, introduction to cloud, cloud beginner, cloud help, Linux training, linux help, linux exam, intro to linux, new to linux, linux certification, linux course, linux careers, linux jobs, linux education, linux system admin, linux 2025, linux exam 2025,Unlocking the Secrets of Linux LVM,Unlocking the Secrets of Linux LVM
#LVM
#Linux
#LinuxAdministration
#LogicalVolumeManagement
#ServerStorage