Red_Hat
EX200 · Question #26
26. Create Logical Volume According to the given requirements, create a new logical volume: - Logical volume named "mylv" belonging to the volume group "myvg" with a size of 50 extents. - Extent…
This task involves creating a physical volume, adding it to a volume group with a specific extent size, then creating a logical volume of a specified extent count, formatting it with VFAT, and configuring it for automatic mount at system startup.
Submitted by krish.m· Apr 18, 2026Configure Local Storage
Question
- Create Logical Volume According to the given requirements, create a new logical volume: - Logical volume named "mylv" belonging to the volume group "myvg" with a size of 50 extents. - Extent size of logical volumes in volume group "myvg" should be 16 MiB. - Format the new logical volume with the VFAT filesystem. - The logical volume should be automatically mounted at /mnt/mydata during system startup. Solution: # Check the disk layout [root@node2 ~]# lsblk # Partition the disk [root@node2 ~]# fdisk /dev/vdb Welcome to fdisk (util-linux 2.37.4). Changes will remain in memory only, until you decide to write them. Be careful before using the write command. Command (m for help): n # Add a new partition Partition type p primary (1 primary, 0 extended, 3 free) # Primary partition e extended (container for logical partitions) # Extended partition Select (default p): p Partition number (2-4, default 2): # Press Enter First sector (1026048-20971519, default 1026048): # Press Enter ***Note: The partition size must be larger than the total size, it should not be exactly equal to. It is recommended to add an extra 200M. Last sector, +/-sectors or +/-size{K,M,G,T,P} (1026048-20971519, default 20971519): +1200M # Partition size Created a new partition 2 of type 'Linux' and of size 512 MiB. Command (m for help): w # Save and exit The partition table has been altered. # Create volume group and logical volume [root@node2 ~]# vgcreate -s 16M myvg /dev/vdb4 [root@node2 ~]# lvcreate -l 50 -n mylv myvg # Install vfat support [root@node2 ~]# yum provides */mkfs.vfat [root@node2 ~]# yum -y install dosfstools # Format the logical volume with vfat filesystem [root@node2 ~]# mkfs.vfat /dev/myvg/mylv # Create mount point [root@node2 ~]# mkdir /mnt/mydata # Update /etc/fstab for automatic mounting [root@node2 ~]# vim /etc/fstab /dev/myvg/mylv /mnt/mydata vfat defaults 0 0 # Mount the logical volume [root@node2 ~]# mount -a
Explanation
This task involves creating a physical volume, adding it to a volume group with a specific extent size, then creating a logical volume of a specified extent count, formatting it with VFAT, and configuring it for automatic mount at system startup.
Concept tested. LVM logical volume creation, VFAT formatting, persistent mounting
Reference. https://man7.org/linux/man-pages/man8/lvcreate.8.html
Topics
#LVM#Filesystem Creation#Filesystem Mounting#fstab
Community Discussion
No community discussion yet for this question.