Friday, August 21, 2015

RHEL7 - Create a filesystem using LVM

Create a filesystem with following specification,

VolumeGroup: oravg
VG extent Size: 32MB
Volume Name: oravol
size of volume: 50 extents
Filesystem type: xfs
Mount point: /opt/oradata

1. Create a partition with desired size
Here, you can use whole disk if you have one available or you can create a partition on existing disk. Add it to LVM and create volume based on the specified size.

# fdisk /dev/sdb
Note: based on the requirement (32*50 = 1600MB + some extra MB = 1700MB)
partition -> 3
Set type as 8e --> LVM

# partx /dev/sdb
Note: If its a active disk partition, please reboot

2. Create physical volume with the partition  you just created
# pvcreate /dev/sdb3
# pvs

3. Create volume group with specified extent size
# vgcreate -s 32M oravg /dev/sdb3
# vgs; vgdisplay
Note: Verify PE extent size

4. Create logical volume
# lvcreate -l 50 -n oravol oravg
Note: compare lower case l, upper case L flag

# lvdisplay
Note:  verify Logical extent
# lvs
# lvscan

5. Create filesystem.
# mkfs.xfs /dev/oravg/oravol

6. Create a mountpoint
# mkdir /opt/oradata
# blkid /dev/oravg/oravol

7. Add entry to fstab
# vi /etc/fstab
UUID=<OutPut_Of_blkid_cmd> /opt/oradata xfs defaults 0 0

8. Mount your volume
# mount -a
# df -h

9. Reboot and verify if its still available
# df -h

No comments:

Post a Comment