Home » , , » RHCE LVM Explanations of basic definitions and Exam question

RHCE LVM Explanations of basic definitions and Exam question

Written By 1 on Saturday, February 5, 2011 | 12:07 PM

Form the beginning of RHCE exam RedHat always includes a question about LVM partitions. So you must be able to create the LVM partition and mount them properly in
/etc/fstab

Example of questions

  • One Logical Volume named lv00 is created under vg00. The Initial Size of that Logical Volume is 100MB. Now you required the size 500MB. Make successfully the size of that Logical Volume 500M without losing any data. As well as size should be increased online.
  • One Logical Volume is created named as lv00 under vg00 volume group and is mounted. The Initial Size of that Logical Volume is 124MB. Make successfully that the size of Logical Volume 245MB without losing any data. The size of logical volume 240MB to 255MB will be acceptable.

Explanations of basic definitions

The LVM system organizes hard disks into Logical Volume (LV) groups. Essentially, physical hard disk partitions (or possibly RAID arrays) are set up in a bunch of equal sized chunks known as Physical Extents (PE). As there are several other concepts associated with the LVM system, here we will discuss only some basic definitions those require in rhce:
  • Physical Volume (PV) is the standard partition that you add to the LVM mix. Normally, a physical volume is a standard primary or logical partition. It can also be a RAID array.
  • Physical Extent (PE) is a chunk of disk space. Every PV is divided into a number of equal sized PEs. Every PE in a LV group is the same size. Different LV groups can have different sized PEs.
  • Logical Extent (LE) is also a chunk of disk space. Every LE is mapped to a specific PE.
  • Logical Volume (LV) is composed of a group of LEs. You can mount a filesystem such as /home and /var on an LV.
  • Volume Group (VG) is composed of a group of LVs. It is the organizational group for LVM.

Create lvm partition and resize them

Run fdisk   /dev/sda to invoke fdisk. Make sure your hard disk status via fdisk -l command before it. If you see /dev/hda in the output of fdisk -l command run fdisk  /dev/hda instead of fdisk /dev/sda linux command  fdisk -l
Now run these command in given sequence
n
press enter
+100M

n
press enter
+100M

n
press enter
+100M
linux fdisk command lvm partitons
after creating partition define their file type and save via w command. lvm partitions are denoted as 8e. run these command exactly ( caution:- change only the partition you create )
t
7
8e

t
8
8e

t
9
8e

w
linux lvm file type 8e
Now tell kernel about this change run partprobe command
fdisk -l show partitions
Create physical volume from newly created partition and then we will create a volume group to use these physical volumes.
lvm pvcreate command
Create 2 lvm partition from this volume group
lvm lvcreate
For format you can use either mke2fs with -j switch or just single command mkfs.ext3
I used both command for illustration
mke2fs and mkfs.ext3 command
mke2fs mkfs.ext3 command
now we will define mount point to use this partitions
lvm mount
We can use these partitions until system reboot if you are asked to mount these partition permanently use these steps.
Run vi /etc/fstab
vi /etc/fstab
( fstab :- file contain information about linux partition )
( vi :- editing command if have problem using vi follow this link)
Make entry of newly created lvm partition

/dev/vg00/lv00 /data/lv00 ext3 defaults 0 0
/dev/vg00/lv01 /data/lv01 ext3 defaults 0 0

in the end of files as shown in figure and save the file.
vi /etc/fstab
In this tutorial we learn how to create lvm partition and mount them permanently
In next article we will learn how to resize the lvm partitions.

0 Comment:

Post a Comment