Welcome to ExamTopics
ExamTopics Logo
- Expert Verified, Online, Free.

Unlimited Access

Get Unlimited Contributor Access to the all ExamTopics Exams!
Take advantage of PDF Files for 1000+ Exams along with community discussions and pass IT Certification Exams Easily.

Exam EX200 topic 1 question 51 discussion

Actual exam question from RedHat's EX200
Question #: 51
Topic #: 1
[All EX200 Questions]

SIMULATION -
One Logical Volume is created named as myvol under vo volume group and is mounted. The Initial Size of that Logical Volume is 400MB. Make successfully that the size of Logical Volume 200MB without losing any data. The size of logical volume 200MB to 210MB will be acceptable.

Show Suggested Answer Hide Answer
Suggested Answer: See explanation below.
First check the size of Logical Volume: lvdisplay /dev/vo/myvol
Make sure that the filesystem is in a consistent state before reducing:
# fsck -f /dev/vo/myvol
Now reduce the filesystem by 200MB.
# resize2fs /dev/vo/myvol 200M
It is now possible to reduce the logical volume. #lvreduce /dev/vo/myvol -L 200M
Verify the Size of Logical Volume: lvdisplay /dev/vo/myvol
Verify that the size comes in online or not: df -h

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
Darion81
Highly Voted 3 years, 5 months ago
Why not just lvreduce /dev/vo/myvol -r -L 200M? -r - resize filesystem
upvoted 13 times
ntcct
3 years, 2 months ago
Resizing the LV is just step1. It resize the "holder". To make it be regconized at the "upper" ilesystem lelvel, we need to resize2fs. Im short, there are 5 key components related to LVM disk/volume mgmt: physical storage -> physical partition --> vol group -> logical vol --> file system.
upvoted 1 times
Hmenu0s
1 year, 8 months ago
"-r / --resizefs" option of lvreduce is the recommended approach. Excerpt from RHEL 8 docs - If the logical volume you are reducing contains a file system, to prevent data loss you must ensure that the file system is not using the space in the logical volume that is being reduced. For this reason, it is recommended that you use the --resizefs option of the lvreduce command when the logical volume contains a file system. When you use this option, the lvreduce command attempts to reduce the file system before shrinking the logical volume. If shrinking the file system fails, as can occur if the file system is full or the file system does not support shrinking, then the lvreduce command will fail and not attempt to shrink the logical volume.
upvoted 5 times
...
...
...
ms200
Highly Voted 2 years, 12 months ago
lvresize -r -L 200M /dev/vo/myvol
upvoted 11 times
...
VforVodoo
Most Recent 7 months, 2 weeks ago
# umount /mnt/myvol #e2fsck -f /dev/mapper/vo-myvol #resize2fs /dev/mapper/vo-myvol 200M #lvreduce -l -50 vo/myvol (if PE size was 4.00 MiB) #lvdisplay vo/myvol --LV Path /dev/vo/myvol --LV Size 200.00 MiB --Current LE 50 ---- #mount -a
upvoted 1 times
...
cloudsinair
10 months, 2 weeks ago
[root@dtop5 ~]# lvreduce -r -L 100M /dev/datastore1/fs1 fsadm: Xfs filesystem shrinking is unsupported. /usr/sbin/fsadm failed: 1 Filesystem resize failed. [root@dtop5 ~]# [root@dtop5 ~]# lvremove /dev/datastore1/fs1 [root@dtop5 ~]# [root@dtop5 ~]# lvcreate -L 150M -n fs1 datastore1 Rounding up size to full physical extent 152.00 MiB WARNING: xfs signature detected on /dev/datastore1/fs1 at offset 0. Wipe it? [y/n]: y Wiping xfs signature on /dev/datastore1/fs1. Logical volume "fs1" created. [root@dtop5 ~]# [root@dtop5 ~]# [root@dtop5 ~]# [root@dtop5 ~]# mkfs.xfs /dev/datastore1/fs1 [root@dtop5 ~]# xfsrestore -f newdump.img /mnt/ [root@dtop5 ~]#
upvoted 1 times
...
hanienarimani
1 year, 4 months ago
-r option is important when using lvreduce , it will resize firesystem too lvresize -r /dev/vgdata/lvbetoche -L 200M
upvoted 1 times
...
kitkat
1 year, 9 months ago
Anywhere in the question somehow it is not mentioned if file system is ext based or xfs. In both cases steps will be different. I think it would be important to check first that what type of file system is in use before we write answer.
upvoted 1 times
...
kenkct
2 years ago
umount /dev/vo/myvol e2fsck -f /dev/vo/myvol resize2fs /dev/vo/myvol 200M mount -a df -hT
upvoted 4 times
kitkat
1 year, 9 months ago
This should work in case of ext2,3,4 file system.
upvoted 1 times
...
...
eid
2 years, 3 months ago
in RH8 #df -Th #xfsdump -l 0 -f /myvol.image /dev/vo/myvol #umount /dev/vo/myvol #lvremove /dev/vo/myvol #lvcreate -L 200M -n myvol vo #blkid /dev/vo/myvol #vim /etc/fstab #edit UUID for /dev/vo/myvol #mount -a #xfsrestore -f /myvol.image /myvol #df -Th
upvoted 7 times
cloudyhr
2 years, 2 months ago
To srink the XFS, never use lvreduce command. the above steps by @eid are the correct process. https://logic.edchen.org/how-to-shrink-xfs-file-system-on-enterprise-linux-7-2/
upvoted 2 times
...
...
kim_ke
2 years, 10 months ago
This works as well lvreduce --resizefs -L 200M /dev/vo/myvol
upvoted 8 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...