Recent Changes - Search:

Softwares

.

LVM-Logical-Volume-Manager

Main.LVM-Logical-Volume-Manager History

Hide minor edits - Show changes to markup

March 16, 2013, at 03:17 PM by 115.241.54.173 -
Added lines 199-202:

Video - Detailed instructions on creating and extending a LVM volume on Red Hat Enterprise Linux 6. http://www.youtube.com/watch?v=OhsR1bNd3kE

August 20, 2012, at 05:51 AM by 15.211.153.75 -
Added lines 4-5:

Quick Steps

Changed lines 12-16 from:
  • First create PV -physical volume, then create volume group-VG, and then the logical volume-LV.

How To Create LVM Logical Volume Manager And Work With With LVM

to:

First create PV -physical volume, then create volume group-VG, and then the logical volume-LV.

How To Create LVM Logical Volume Manager And Work With With LVM

Changed lines 21-22 from:
   In LVM, Volume Groups (VGs) are split up into logical volumes (LVs)
to:

In LVM, Volume Groups (VGs) are split up into logical volumes (LVs)

Changed lines 25-26 from:
  • [root@galileo ~]# fdisk -l
to:

(:table border=1 width=50% bgcolor=yellow cellspacing=0 :) (:cellnr:) [@ [root@galileo ~]# fdisk -l

Changed lines 39-45 from:
  • initialize sda3 as a physical volume
  [root@galileo ~]# pvcreate /dev/sda3

pvcreate - initialize a disk or partition for use by LVM

to:

@] (:tableend:)*

Initialize sda3 as a physical volume

(:table border=1 width=50% bgcolor=yellow cellspacing=0 :) (:cellnr:)

[root@galileo ~]# pvcreate /dev/sda3

(:tableend:)

pvcreate - initialize a disk or partition for use by LVM

Changed lines 57-59 from:
  [root@galileo ~]# pvcreate /dev/sdb
  [root@galileo ~]# pvcreate /dev/sdc
to:

(:table border=1 width=50% bgcolor=yellow cellspacing=0 :) (:cellnr:)

[root@galileo ~]# pvcreate /dev/sdb
[root@galileo ~]# pvcreate /dev/sdc

(:tableend:)

Changed lines 68-71 from:
  [root@galileo ~]#vgcreate mydatavg /dev/sda3
  • vgcreate - create a volume group
to:

(:table border=1 width=50% bgcolor=yellow cellspacing=0 :) (:cellnr:)

[root@galileo ~]#vgcreate mydatavg /dev/sda3

(:tableend:)

vgcreate - create a volume group

Changed lines 81-88 from:
  [root@galileo ~]#vgcreate mydatavg /dev/sdb /dev/sdc
  • output of vgscan
  [root@galileo ~]# vgscan
  Reading all physical volumes.  This may take a while...
  Found volume group "mydatavg" using metadata type lvm2
to:

(:table border=1 width=50% bgcolor=yellow cellspacing=0 :) (:cellnr:)

[root@galileo ~]#vgcreate mydatavg /dev/sdb /dev/sdc

(:tableend:)

output of vgscan

(:table border=1 width=50% bgcolor=yellow cellspacing=0 :) (:cellnr:)

[root@galileo ~]# vgscan
Reading all physical volumes.  This may take a while...
Found volume group "mydatavg" using metadata type lvm2

(:tableend:)

Changed lines 103-129 from:
  • Create logical volumes which we can mount and actually use.
  [root@galileo ~]#lvcreate -n myvol --size 1g mydatavg
This command creates a volume of size 1Gb with the name myvol hosted on the LVM volume group mydatavg.

The logical volume will now be accessible via= /dev/mydatavg/myvol

  • Formatted and mounted just like any other partition.
  [root@galileo ~]# mkfs.ext3 /dev/mydatavg/myvol
  [root@galileo ~]# mkdir /home/lvmmount
  [root@galileo ~]# mount /dev/mydatavg/myvolt  /home/lvmmount
  • lvdisplay - display attributes of a logical volume
  [root@galileo ~]# lvdisplay
  • vgscan - scan all disks for volume groups and rebuild caches

How to Resize the volume= /dev/mydatavg/myvolt

  [root@galileo ~]# umount /home/lvmmount

    [root@galileo ~]#  lvextend -L+1g dev/mydatavg/myvolt
to:

Create logical volumes which we can mount and actually use.

(:table border=1 width=50% bgcolor=yellow cellspacing=0 :) (:cellnr:)

[root@galileo ~]#lvcreate -n myvol --size 1g mydatavg

(:tableend:)

This command creates a volume of size 1Gb with the name myvol hosted on the LVM volume group mydatavg.

The logical volume will now be accessible via= /dev/mydatavg/myvol

Formatted and mounted just like any other partition.

(:table border=1 width=50% bgcolor=yellow cellspacing=0 :) (:cellnr:)

[root@galileo ~]# mkfs.ext3 /dev/mydatavg/myvol
[root@galileo ~]# mkdir /home/lvmmount
[root@galileo ~]# mount /dev/mydatavg/myvolt  /home/lvmmount

(:tableend:)

lvdisplay - display attributes of a logical volume

(:table border=1 width=50% bgcolor=yellow cellspacing=0 :) (:cellnr:)

[root@galileo ~]# lvdisplay

(:tableend:)

vgscan - scan all disks for volume groups and rebuild caches

How to Resize the volume= /dev/mydatavg/myvolt

(:table border=1 width=50% bgcolor=yellow cellspacing=0 :) (:cellnr:)

[root@galileo ~]# umount /home/lvmmount

[root@galileo ~]#  lvextend -L+1g dev/mydatavg/myvolt

(:tableend:)

Changed lines 161-162 from:
      [root@galileo ~]# e2fsck -f /dev/mydatavg/myvolt 
to:

(:table border=1 width=50% bgcolor=yellow cellspacing=0 :) (:cellnr:) [@ [root@galileo ~]# e2fsck -f /dev/mydatavg/myvolt

Changed lines 171-178 from:

How to Remove LVM

NAME

       lvremove - remove a logical volume

    [root@galileo ~]# lvremove /dev/mydatavg/myvolt
to:

@] (:tableend:)

How to Remove LVM

(:table border=1 width=50% bgcolor=yellow cellspacing=0 :) (:cellnr:)

lvremove - remove a logical volume

[root@galileo ~]# lvremove /dev/mydatavg/myvolt

(:tableend:)NAME

Changed lines 188-193 from:
   /dev/mydatavg/myvolt    /home/lvmmount       ext3  noatime  0 2
to:

(:table border=1 width=50% bgcolor=yellow cellspacing=0 :) (:cellnr:)

/dev/mydatavg/myvolt    /home/lvmmount       ext3  noatime  0 2

(:tableend:)

April 22, 2009, at 02:53 PM by 118.95.2.60 -
Changed line 6 from:
  • /boot partition cannot be a lvm
to:
  • /boot partition cannot be a lvm because the partition cannot be read by the boot loader
April 22, 2009, at 02:40 PM by 118.95.2.60 -
Changed lines 10-12 from:
to:
  • First create PV -physical volume, then create volume group-VG, and then the logical volume-LV.
April 22, 2009, at 02:31 PM by 118.95.2.60 -
Changed lines 8-10 from:
  • lvm2 uses the device mapper driver un the kernel 2.6
to:
  • lvm2 uses the device mapper driver in the kernel 2.6
April 22, 2009, at 02:29 PM by 118.95.2.60 -
Changed lines 8-9 from:
to:
  • lvm2 uses the device mapper driver un the kernel 2.6
April 22, 2009, at 02:26 PM by 118.95.2.60 -
Changed lines 7-9 from:
  • /boot should be on a separate partitions.
to:
  • /boot should be on a separate partitions. - ext3
April 22, 2009, at 02:23 PM by 118.95.2.60 -
Added lines 4-9:
  • Creating hard drive space into logical volumes.
  • Since physical volumes cannot span over more than one drives.
  • /boot partition cannot be a lvm
  • /boot should be on a separate partitions.
April 22, 2009, at 02:16 PM by 118.95.2.60 -
Changed line 123 from:

(:Googleref:)

to:

(:Googlemm:)

April 22, 2009, at 02:16 PM by 118.95.2.60 -
Changed line 123 from:

(:Google1:)

to:

(:Googleref:)

April 22, 2009, at 02:15 PM by 118.95.2.60 -
Changed line 2 from:

(:Google1:)

to:

(:Googlemm:)

April 22, 2009, at 02:15 PM by 118.95.2.60 -
Added lines 1-123:

(:Google1:) (:Google1:)


How To Create LVM Logical Volume Manager And Work With With LVM

  • physical volumes = /dev/hdb1
  • volume groups= used to create logical volumes (example 'mydatavg')
  • logical volumes= (example /dev/mydatavg/myvol)
   In LVM, Volume Groups (VGs) are split up into logical volumes (LVs)

Check image at http://www.lea-linux.org/cached/printable=yes/index/Leapro-pro_sys-lvm.html

  • [root@galileo ~]# fdisk -l
   Disk /dev/sda: 80.0 GB, 80032038912 bytes
   255 heads, 63 sectors/track, 9730 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
   /dev/sda1   *           1          25      200781   83  Linux
   /dev/sda2              26         156     1052257+  82  Linux swap
   /dev/sda3             157        9730    76903155   83  Linux
  • initialize sda3 as a physical volume
  [root@galileo ~]# pvcreate /dev/sda3

pvcreate - initialize a disk or partition for use by LVM

  • For several disks
  [root@galileo ~]# pvcreate /dev/sdb
  [root@galileo ~]# pvcreate /dev/sdc

Once initialised the partitions, or drives, we will create a volume group.

  [root@galileo ~]#vgcreate mydatavg /dev/sda3
  • vgcreate - create a volume group
   Here "mydatavg" is the name of the volume group.

Single volume spanning two disks.

  [root@galileo ~]#vgcreate mydatavg /dev/sdb /dev/sdc
  • output of vgscan
  [root@galileo ~]# vgscan
  Reading all physical volumes.  This may take a while...
  Found volume group "mydatavg" using metadata type lvm2
  • vgscan scans all SCSI, (E)IDE disks, multiple devices and a bunch of other disk devices in the system looking for LVM physical volumes and volume groups.
  • Create logical volumes which we can mount and actually use.
  [root@galileo ~]#lvcreate -n myvol --size 1g mydatavg
This command creates a volume of size 1Gb with the name myvol hosted on the LVM volume group mydatavg.

The logical volume will now be accessible via= /dev/mydatavg/myvol

  • Formatted and mounted just like any other partition.
  [root@galileo ~]# mkfs.ext3 /dev/mydatavg/myvol
  [root@galileo ~]# mkdir /home/lvmmount
  [root@galileo ~]# mount /dev/mydatavg/myvolt  /home/lvmmount
  • lvdisplay - display attributes of a logical volume
  [root@galileo ~]# lvdisplay
  • vgscan - scan all disks for volume groups and rebuild caches

How to Resize the volume= /dev/mydatavg/myvolt

  [root@galileo ~]# umount /home/lvmmount

    [root@galileo ~]#  lvextend -L+1g dev/mydatavg/myvolt
  • NAME
       lvextend - extend the size of a logical volume

  -L, --size [+]LogicalVolumeSize[kKmMgGtT]
              Extend  or  set  the  logical  volume  size in units in units of
              megabytes. 
  • check lvdisplay again...but ext3 filesystem on it has stayed unchanged.
  • We need to resize the filesystem to actually fill the volume:
      [root@galileo ~]# e2fsck -f /dev/mydatavg/myvolt 

     -f     Force checking even if the file system seems clean.

      root@lappy:~# resize2fs /dev/mydatavg/myvolt

      resize2fs - ext2/ext3 file system resizer

How to Remove LVM

NAME

       lvremove - remove a logical volume

    [root@galileo ~]# lvremove /dev/mydatavg/myvolt
  • If partition is to be mounted at boot-time you should update your /etc/fstab
   /dev/mydatavg/myvolt    /home/lvmmount       ext3  noatime  0 2

Running pvdisplay will allow you to see which physical volume(s) make up your volume group.

Check /etc/lvm/ directory.


(:Google1:) (:Google1:)

Edit - History - Print - Recent Changes - Search
Page last modified on March 16, 2013, at 03:17 PM