NAVEEN

Tuesday, December 29, 2009

Disk Partition LVM (RHEL4)

------------------------------------------------------------------------

DISK PARTITIONING

-----------------------------------------------------------------------

df -h

For Groups:
------------

vgdisplay (dispalay the current volume group details)
vgs (direct size,free)


For individual volumes:
----------------------

lvdisplay (separate view ,not group)
lvs (direct size,free)


physical volume:
---------------

pvdisplay (physical volume)
pvs

--------------------------------------------------------------


cat /etc/mtab (mount point details)
cat /etc/fstab (filesystem details)


------------------------------------------------------------

extending a logical Volume
--------------------------

lvextend -L +15G path

note:
-----

+15G --> it will add 15 gb in a existing volume.
15g it will resize to 15 gb
path --> took from /etc/fstab

-------------------------------------------------------------

resizing a Logical volume
-------------------------

first umount the volume

cat /etc/fstab

umount /ora10gdata

verify with "df -h" command

lventend -L +2G /dev/volgroup/logicalvolume01

Note :
-------

volgroup --> took from /etc/fstab


check through lvs command

e2fsck -f /dev/mapper/volgroup-localvolume01

resize2fs /dev/mapper/volgroup-localvolume01

note:
----
volgroup-localvolume01 --> took from /etc/matb


mount /ora10gdata


--------------------------------------------------------------------


renaming the mount point
------------------------

take a backup of mtab & fstab

EX:-
----

umount the volume "umount /ora10gdata"

create a new directory "mkdir /newfolder01"

mount "mount /newfolder01"

-----------------------------------------------------------------

renaming the Volume Group
--------------------------

umount the volume directory

deactivate the volume group

vgchange -a n volgroupname

Note:-
-------

n --> deactivating

y --> activating


vgrename volgroupoldname newname

vgchange -a y newgroupname

mount the volume

Note:-
--------
vgscan for finding volumes

then change /etc/fstab also

----------------------------------------------------------------------

renaming the logical volume
---------------------------

umount /disk03

lvrename volgroupname oldlogicalvolumename newname

vi /etc/fstab --> change there also

mount /disk03

lvs --> check it


----------------------------------------------------------------------

creating a logical volume
--------------------------

lvcreate -L 10G -n logicalvolumename volumegroupname

check through lvs (or) lvdisplay command

mkfs -t ext3 /dev/volumegroupname/logicalvolumename

mkdir disk03

mount /dev/loggroup/logvolume /disk03


-----------------------------------------------------------------------


reducing the logical volume
----------------------------

umount /disk03

e2fsck -f /dev/mapper/volgroup-localvolume01

resize2fs /dev/volumegroupname/logvolume 5G

lvreduce /dev/volgroup/logvolume -L 5G

mount /disk03

Note:-
------

5G --> reduced to this (5G) size

-----------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------

Tested --> Newly installed system

-------------------------------------------------------------------------------------------
2.5. Removing Physical Volumes

# pvremove /dev/ram15


3.1. Creating Volume Groups

# vgcreate vg1 /dev/sdd1 /dev/sde1


3.2. Adding Physical Volumes to a Volume Group

# vgextend vg1 /dev/sdf1


3.5. Removing Physical Volumes from a Volume Group

# vgreduce my_volume_group /dev/hda1


3.8. Removing Volume Groups

# vgremove officevg

--------------------------------------------------------------------------------

3.9. Splitting a Volume Group

# vgsplit bigvg smallvg /dev/ram15
Volume group "smallvg" successfully split from "bigvg"


3.10. Combining Volume Groups

vgmerge -v databases my_vg


------------------------------------------------------------------------------

3.12. Renaming a Volume Group

1.umount the volumes
2.Dismount the volgroup by following command

vgchange -a n mygroup01

3.change the name

vgrename /dev/vg02 /dev/my_volume_group (or)
vgrename vg02 my_volume_group

4.activate the volume

vgchange -a y mynewgroup01

5.change in /etc/fstab

6.mount the disks individualy



4.6. Removing Logical Volumes

[root@tng3-1 lvm]# lvremove /dev/testvg/testlv
Do you really want to remove active logical volume "testlv"? [y/n]: y
Logical volume "testlv" successfully removed


#--------------------------------------------------------------------------------------------------------------------------


-------------------------
New installed system:
------------------------


Creating physical volume first
---------------------------------


[root@delhidata ~]# lvmdiskscan (check the highest GB freespace)
/dev/ramdisk [ 16.00 MB]
/dev/hda [ 74.51 GB]
/dev/dm-0 [ 10.00 GB]
/dev/ram [ 16.00 MB]
/dev/hda1 [ 58.01 GB] LVM physical volume
/dev/dm-1 [ 10.00 GB]
/dev/ram2 [ 16.00 MB]
/dev/hda2 [ 15.00 GB]
/dev/ram3 [ 16.00 MB]
/dev/hda3 [ 1.00 GB]
/dev/ram4 [ 16.00 MB]
/dev/ram5 [ 16.00 MB]
/dev/hda5 [ 502.00 MB]
/dev/ram6 [ 16.00 MB]
/dev/ram7 [ 16.00 MB]
/dev/ram8 [ 16.00 MB]
/dev/ram9 [ 16.00 MB]
/dev/ram10 [ 16.00 MB]
/dev/ram11 [ 16.00 MB]
/dev/ram12 [ 16.00 MB]
/dev/ram13 [ 16.00 MB]
/dev/ram14 [ 16.00 MB]
/dev/ram15 [ 16.00 MB]
3 disks
19 partitions
0 LVM physical volume whole disks
1 LVM physical volume


[root@tng3-1 ]#pvcreate /dev/hda1

dd if=/dev/zero of=/dev/sdi bs=512 count=1


Creating new Volume Group :
-----------------------------

[root@tng3-1 ]#vgcreate vg1(any name) /dev/hda

No comments:

Post a Comment