Kmaiti

  • Subscribe to our RSS feed.
  • Twitter
  • StumbleUpon
  • Reddit
  • Facebook
  • Digg

Sunday, 22 August 2010

How to create logical volume or LVM on linux machine?

Posted on 05:25 by Unknown
Guys,

Logical volume management provides a higher-level view of the disk storage on a computer system than the traditional view of disks and partitions. This gives the system administrator much more flexibility in allocating storage to applications and users.

Storage volumes created under the control of the logical volume manager can be resized and moved around almost at will, although this may need some upgrading of file system tools.

I have referred the following steps.

Before proceeding to create the LVM we need to first partition the drive. You may choose whole drive or some portion of the drive. So, check the current partition table.

1.
====
[root@server ~]#fdisk -l /dev/sdb
====

2. Start to partition the disk or drive (ie /dev/sdb):

====
[root@server ~]# fdisk /dev/sdb

Command (m for help): t // change partition type
Selected partition 1 // number, so system will create /dev/sdb1 drive.
Hex code (type L to list codes): L // show list of type
Hex code (type L to list codes): 8e // 8e for Linux LVM, 83 for Linux, 85 for Linux extended.

Just carefully proceed here. If you do you any mistake you can start again until you press "w' command.
====

Now please make it sure that you have used "w" command to write the partition table. It'll take a few minutes to complete and it's depending upon the size of the disk.

3. Create Physical Volume :

====
[root@server ~]fdisk -l /dev/sdb //check whether sdb1 has created or not.
[root@server ~]#pvcreate /dev/sdb1 // create Physical Volume

Physical volume "/dev/sdb1" successfully created

Note : If you would like to specify partition size
[root@server ~]# pvcreate --setphysicalvolumesize 100G /dev/sdb1
Physical volume "/dev/sdb1" successfully created

Else it'll take whole size as per the partition size. You can use pvresize which allows you to change the size of a physical vol­ume and this belongs to a volume group in case the underlying device changes size. Here is the CMD.

[root@server ~]# pvresize --setphysicalvolumesize 100G /dev/sdb1
====

4. Create volume group :

====
[root@server ~]# vgcreate VZ /dev/sdb1 // create Volume group 'VZ'
Volume group "VZ" successfully created

Note : If you want to add another disk or drive(partitioned with same type) you can use following command :

[root@server ~]# vgcreate VZ /dev/sdb1 /dev/sdd2
Volume group "VZ" successfully created

[root@server ~]# vgrename VZ MyVZ // change current name 'VZ' to new name MyVZ' //to rename
[root@server ~]# vgs //display the volume
[root@server ~]# vgextend VZ /dev/sdd2 // add sdd1 in VZ
[root@server ~]# vgreduce VZ /dev/sdd2 // remove sdd1 from VZ
====

5. Create logical vulome :-

=====
[root@server ~]# lvcreate -L 10G -n mydata VZ
=====

6. Create backup or snapshot of the above LVM :

====
[root@server ~]# lvcreate -s -L 5G -n SNAP /dev/VZ/mydata
Logical volume "SNAP" created
====

7. Extend and Reduce the LVM :

===
[root@server ~]# lvextend -L 20G /dev/VZ/mydata //will exyend 20GB

Then exucte folloiwng comamnd :

[root@server ~]# resize2fs /dev/VZ/mydata //to make it effective
===

====
[root@server ~]# lvreduce -L 10G /dev/VZ/mydata //reduce 20 GB
[root@server ~]# lvremove /dev/VZ/mydata //to remove the LVM
====

Ref : http://www.centos.org/docs/5/html/Cluster_Logical_Volume_Manager/LV_create.html

That's it. Try :)
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest
Posted in | No comments
Newer Post Older Post Home

0 comments:

Post a Comment

Subscribe to: Post Comments (Atom)

Popular Posts

  • How to verify UDP packet communication between two linux system?
    Guys, Today, I had to check UDP packet communication between linux and a windows system. Main purpose of the windows system was to capturing...
  • [a fatal error or timeout occurred while processing this directive] + cpanel
    Guys, Just check the cpanel log file and you'll get the clue from there. I got following messages : execute : tail -f /usr/local/cpanel/...
  • NDMP communication failure error
    Guys, Issue : Netbackup server sends alert NDMP communication failure once everyday. But there is no issue to run scheduled backup jobs. Env...
  • Steps to develop patch and apply it to original source file
    1. Create test.c  Above file contains : -------- [kamalma@test-1 C_Programming]$ cat test.c #include #include int main()  {  printf("\n...
  • How to remotely access the linux desktop from any linux or windows machine?
    Guys, I referred the following steps : ======================= 1. On server-linux(Which will be accessed) : yum install vnc* 2. On client-li...
  • "cluster is not quorate. refusing connection"
    Guys, Environment : Red Hat Enterprise Linux 5.6, RHCS Error : subject line Issue : I am not sure while I got this error in the system log s...
  • How do I determine if my x86-compatible Intel system is multi-processor, multi-core or supports hyperthreading?
    Guys, We need to know about multi-processor, multi-core or supports hyperthreading. Here are the details : Physical ID (Physical processor o...
  • Details about NFS timeout on Red Hat Enterprise Linux 5
    There are two mount options for timeouts of an NFS request. # timeo: a timeout value. the unit is 1/10 seconds. # retran...
  • How to store sftp log messages in custom file on RHEL 6?
    How to setup chrooted sftp account on RHEL 6? $groupadd sftponly $$useradd user123 $usermod -d /myhome -g sftponly -s /bin/false user123 $mk...
  • configure: error: This c-client library is built with Kerberos support
    Guys, I got the error message during executing easyapache. I have manually recompiled the php on cpanel server. Here is the script that I ha...

Categories

  • ACL
  • ESX
  • Linux
  • Storage
  • UCS

Blog Archive

  • ►  2013 (5)
    • ►  May (1)
    • ►  April (3)
    • ►  February (1)
  • ►  2012 (10)
    • ►  July (1)
    • ►  June (1)
    • ►  April (1)
    • ►  March (3)
    • ►  February (3)
    • ►  January (1)
  • ►  2011 (86)
    • ►  December (3)
    • ►  November (2)
    • ►  September (19)
    • ►  August (9)
    • ►  July (5)
    • ►  June (9)
    • ►  May (12)
    • ►  April (3)
    • ►  March (4)
    • ►  February (5)
    • ►  January (15)
  • ▼  2010 (152)
    • ►  December (9)
    • ►  November (34)
    • ►  October (20)
    • ►  September (14)
    • ▼  August (24)
      • How to enable iptables modules on linux?
      • iptables: Unknown error + Resolved
      • How to migrate VPS container to another virtuozoo ...
      • umount: /tmp: device is busy + Resolved
      • Cannot find config.m4 + phpize +Resolved
      • How to install mssql php extension on linux or cpa...
      • configure: error: C preprocessor "/lib/cpp" fails ...
      • How to add or load shared library on linux ?
      • How to install uploadprogress php extension on lin...
      • How to change php handler from backend on cpanel s...
      • How to recursively copy files from one server to a...
      • How to install svn (Subversion) on linux machine?
      • How to create logical volume or LVM on linux mach...
      • Lite speed webserver + Connection was reset ?
      • How does Red5 work + How red5 works ?
      • How to install apache ant on linux server?
      • How to install php eaccelerator on 64 bit linux se...
      • Install ffmpeg mplayer flvtool2 yamdi x264 theora ...
      • How to convert mp4 file to flv file on linux machi...
      • How to install pdo_mysql module with php on 64 bit...
      • Why clipbucket or ffmpeg is unable convert video f...
      • How to limit CPU ususage for a process?
      • How to install Mp4Box on 64 bit linux machine ?
      • How to partition a linux drive or raw disk?
    • ►  July (19)
    • ►  June (3)
    • ►  May (25)
    • ►  April (3)
    • ►  January (1)
Powered by Blogger.