EX200 Exam QuestionsBrowse all questions from this exam

EX200 Exam - Question 80


SIMULATION -

There is a local logical volumes in your system, named with shrink and belong to VGSRV volume group, mount to the /shrink directory. The definition of size is 320

MB.

Requirement:

Reduce the logical volume to 220 MB without any loss of data. The size is allowed between 200-260 MB after reducing.

Show Answer
Correct Answer:

To safely reduce the size of a logical volume without data loss, follow these steps: First, unmount the logical volume using 'umount /shrink'. Next, check the filesystem for any errors with 'e2fsck -f /dev/mapper/vgsrv-shrink'. Then, resize the filesystem to a size smaller than the target logical volume size to ensure no data is lost with 'resize2fs /dev/mapper/vgsrv-shrink 220M'. After that, reduce the logical volume to the desired size with 'lvreduce -L 220M /dev/mapper/vgsrv-shrink'. Finally, run 'resize2fs /dev/mapper/vgsrv-shrink' again to ensure the filesystem fits the reduced logical volume, and then remount it using 'mount -a'. This ensures that the reduction is done safely and without data loss.

Discussion

1 comment
Sign in to comment
sovafal192
Sep 18, 2022

alternate solution, because of the possbile data loss if the data exchange is a little bit different between lvexreduce and resize2fs. umount /shrink e2fsck -f /dev/mapper/vgsrv-shrink ####* Shrink the file system as small as possible resize2fs -M /dev/mapper/vgsrv-shrink lvreduce -L 220M /dev/mapper/vgsrv-shrink ####* extend the file system to the max device size resize2fs /dev/mapper/vgsrv-shrink mount -a