Exam EX200 All QuestionsBrowse all questions from this exam
Question 52

SIMULATION -

We are working on /data initially the size is 2GB. The /dev/test0/lvtestvolume is mount on /data. Now you required more space on /data but you already added all disks belong to physical volume. You saw that you have unallocated space around 5 GB on your harddisk. Increase the size of lvtestvolume by 5GB.

    Correct Answer:

    To increase the size of the logical volume 'lvtestvolume' by 5GB in an LVM setup, follow these steps. Firstly, create a new partition with a size of 5GB and change its partition type to '8e' (Linux LVM). This can be done using a partitioning tool like 'fdisk' or 'parted'. Once the partition is created, use the 'partprobe' command to instruct the operating system to re-read the partition table. Next, initialize the new partition as a physical volume using the 'pvcreate' command. Add this physical volume to your existing volume group 'test0' with the 'vgextend' command. Then, extend the logical volume 'lvtestvolume' by an additional 5GB using the 'lvextend' command with the '-r' option to automatically resize the filesystem. Verify the changes using the 'lvdisplay' command. Finally, you can use 'df -h' to check the updated size of the filesystem mounted on '/data'. This procedure ensures that the logical volume is appropriately resized, and the filesystem is adjusted to reflect the new size.

Discussion
ArchBishop

They identify the LVM as mounted; which indicates that there is an associated FS. You'll wanna make sure that unmount first, and then resize the FS as well. This can easily be done by adding the additional -r switch in the command: lvextend -L +5G -r [/dev/vg/lvm] If you forget this step, you can also run resize2fs or xfs_growfs

kitkat

--assume new disk is src pvcreate /dev/sdc vgextend test0 /dev/sdc vgs lvs lvextend -r -l +100%FREE /dev/test0/lvtestvolume --in above command because we are going to use 100% of 5GB disk we specified +100%FREE. Below two commands i am adding however i didn't have to use the because while using -r in above command volume is already resized and automatically fle system type is matched to that of the existing volume. xfs_growfs /dev/test0/lvtestvolume -----in case of xfs file system resize2fs /dev/test0/lvtestvolume -----in case of ext2, 3 or 4 running above command will produce following: The file system is alread ________ blocks long. Nothing to do! --run df -Th command to check size.

kitkat

Reference: https://www.redhat.com/sysadmin/resize-lvm-simple

kysj

Assume the /dev/sda is 5GB #parted -s /dev/sda mklabel gpt mkpart primary 0% 100% #parted -s /dev/sda set 1 lvm on # partprobe # vgextend test0 /dev/sda1 # lvextend -r -l 100%FREE /dev/test0/lvtestvolume For xfs file system: # xfs_growfs /data // the mount point For ext file system: # resize2fs /dev/test0/lvtestvolume // the lv path #df -h /data

larsmattim

https://access.redhat.com/solutions/24770

ANI_04

$ fdisk /dev/sda # create a partition of that free 5G space # change it's type to lvm $ partprobe $ vgextent test0 /dev/sdaX $ lvextend -r -l 100%FREE -n dev/test0/lvtestvolume test0

sugisho

[root@station ~]# lvextend --help lvextend - Add space to a logical volume Extend an LV by a specified size. lvextend -L|--size [+]Size[m|UNIT] LV [ -l|--extents [+]Number[PERCENT] ] [ -r|--resizefs ] [ -i|--stripes Number ] [ -I|--stripesize Size[k|UNIT] ] [ --poolmetadatasize [+]Size[m|UNIT] ] [ COMMON_OPTIONS ] [ PV ... ]