Logical Volume Manager [LVM]

Logical Volume Manager [LVM]

  

There is two type of installation of LVM
  • Pre Installation 
  we can configure  os at the time of install
  • Post Installation
 we can install lvm at the time of Linux Installation that is know as pre installation.

ans post installation can be implemented after the os instllation.

I am explaning post instllation here.

>>> example <<<<<

creating 1 GB partation
fdisk -l
fdisk /dev/sda

type : n
fisrt cylinder : leave blank
last cylinder : +1GB

:w # for write


this changes will made on hard drive, and not updated in RAM
you can view it here :


# cat /proc/partitions

to sysnc the partiton RAM to HDD

# partprobe /dev/sda

# mkfs -t ext3 /dev/sda7

or

# mkfs -t vfat

# mkdir /data
# mount /dev/sda7 /data

# df -Th

  1.  Create 2 GB Partition " fdisk /dev/sda
  2. t togle with 8e = n
  3. save the partition = 2 GB
  4. partprobe /dev/sda = p, t, 8e
  5.  pvcreate /dev/sda = to create phisical volume
  6. pvdisplay = to display phisical volume
  7. vgcreate vg0 /dev/sda6 = to create volume group
  8. vgdisplay = to view volume group
# lvcreate -L 1GB -n lv0 vg0 
lvcreate : to create logical volume 
-L  : limit
1G : Size
 -n : name
lv0: logical volume name
vg0 : Volume group Name

# lvdisplay : to display logical volume
# fdisk -l

# mkfs -t ext3 /dev/vg0/lv0

#mkdir /mylvm

# mount /dev/vg0/lv0 /mylvm
# vim /etc/fstab
/dev/vg0/lv0    /mylvm  ext3   default 0,0

:wq

# df -Th
# Reboot



LVM Extend

VG Size = 1.87 GB
LV "     = 1 GB


increase volume by 500 MB

# lvextend -L +500M /dev/vg0/lv0

# resize2fs /dev/vg0/lv0

Comments