Recent Changes - Search:

Softwares

.

HowToCreateLVMLogicalVolumeManagerAndWorkWithWithLVM

Main.HowToCreateLVMLogicalVolumeManagerAndWorkWithWithLVM History

Hide minor edits - Show changes to output

May 22, 2007, at 01:31 PM by 210.18.59.46 -
Added lines 9-10:
%blue%Check image at http://www.lea-linux.org/cached/printable=yes/index/Leapro-pro_sys-lvm.html
Changed lines 74-77 from:
%blue%Resize the volume= /dev/mydatavg/myvolt


[root@galileo ~]# /home/lvmmount
to:
%red%How to Resize the volume= /dev/mydatavg/myvolt


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

[root@galileo ~]# lvextend -L+1g dev/mydatavg/myvolt
Changed lines 88-89 from:
[root@galileo ~]# lvextend -L+1g dev/mydatavg/myvolt
to:
Changed lines 101-102 from:
%blue%Remove LVM
to:
%red%How to Remove LVM
Changed lines 34-35 from:
[root@galileo ~]#vgcreate mydatavg /dev/hda3
to:
[root@galileo ~]#vgcreate mydatavg /dev/sda3
Changed lines 5-6 from:
*logical volumes= (example /dev/mydatavg/test)
to:
*logical volumes= (example /dev/mydatavg/myvol)
Changed lines 74-75 from:
to:
%blue%Resize the volume= /dev/mydatavg/myvolt


[root@galileo ~]# /home/lvmmount
*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.

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

*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

%blue%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


%blue%Running pvdisplay will allow you to see which physical volume(s) make up your volume group.
Changed line 113 from:
to:
%blue%Check /etc/lvm/ directory.
Added lines 1-79:
%blue% 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/test)

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

*[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

%blue%pvcreate - initialize a disk or partition for use by LVM

*For several disks

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

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

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

*vgcreate - create a volume group

Here "mydatavg" is the name of the volume group.

%blue%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.

%blue%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





Edit - History - Print - Recent Changes - Search
Page last modified on May 22, 2007, at 01:31 PM