Experience LINUX LVM (Logical Volume Manager) with real time examples

Yogesh Raheja

Yogesh working as a Consultant in Unix Engineering by profession. And he has multiple years experience in Solaris, Linux , AIX and Veritas Administration. He has been certified for SCSA9, SCSA10, SCNA10, VXVM, VCS, ITILv3. He is very much passionate about sharing his knowledge with others. Specialties: Expertize in Unix/Solaris Server, Linux (RHEL), AIX, Veritas Volume Manager, ZFS, Liveupgrades, Storage Migrations, Cluster deployment (VCS and HACMP) and administration and upgrade on Banking, Telecom, IT Infrastructure, and Hosting Services.

Loading Facebook Comments ...

37 Responses

  1. Soon we will come up with Software RAID, so that complete FS Management with LVM will be completed for Linux at our Gurkul-India database. Though their is already a doc for RAID at our Gurkul. But we will try to present a more simpler version with complete examples.

  2. Thanks you Avijit Patra dada..

  3. Bhopinder says:

    Awsome article for linux beginners who are migrating from Solaris. Will be more helpful if you could add procedure how to mirror etc.

  4. Hi Bhopinder, we will bring the post where we will take up the software Raid in Linux and we present how to mirror the disk in Linux with LVM.

  5. Arunabha says:

    Hi Yogesh, Please keep in mind that we can extend online file system RHEL 5 onwards. Prior to RHEL 5 you need to unmount the file system before resizing. So you need a downtime for that.

  6. Yogesh Raheja says:

    yes, you are right Arunabha.

  7. seema says:

    Hello Yogesh i am newbie to linux and this is my first work ….. host i am working is Red Hat Enterprise Linux ES release 4 (Nahant) so for this release i need to unmount the file system then extend it correct !!! which needs the downtime from the apps team !!

  8. @Seema, extension can be done online. Downtime only required when you are doing Shrinking. You can go through the above post and will get maximum information regarding LVM.

  9. seema says:

    I have read the posts by you on LVM they are too good for newbie but from the comments from arunabha for RHEL 4 need to unmount the FS which means APPLICATION FS will be unavailable during extending !!!

  10. seema says:

    @yogesh # man rezise2fs
    No manual entry for rezise2fs

    and when i was trying to do it
    i got an error -bash: resize2fs: command not found ….Though i have checked my PATH
    …. Is there a way to get out of it ….

  11. seema says:

    I checked the man for ext2online and it worked ……. i.e ext2online will increase the file system which is mounted . ext2online can be used only after extending LV by lvextend command …. once done can be verifed by df -g /FS name ………….. Thanks Yogesh ….

  12. Ramdev says:

    @seema — # man rezise2fs you have a typo in resize2fs .. please try again.

  13. Yogesh Raheja says:

    @Seema, you dont required sowntime while Extension. Its true for RHEL 4 as well. FS should be unmounted only in case of shrinking. You should be able to find resize2fs in RHEL 4 also. Try find / -name resize2fs -print to search the command path. Hope this helps.

  14. Michael says:

    @ Seema  you can extend the ext2/ext3 online but that is not providing a good means of shrniking the FS online .resize2fs command can be used to extend the FS online provided if the kernel supports  on-line resizing. As per from , the Linux 2.6 kernel supports on-line resize for filesystems mounted using ext3 only.If your kernel is not supporting then you cannot extend the FS even online you require a downtime 

  15. seema says:

    @ramdev # man resize2fs
    No manual entry for resize2fs …. I did used find thats my first option …However i was able to do it using ext2online …. Thanks all for the replies

  16. seema says:

    Ramdev i just want to clarify myself —-> I can use resize2fs on Red Hat Enterprise Linux ES release 3 (Taroon Update 7) but i cannot do it on Red Hat Enterprise Linux ES release 4 (Nahant) … i did used which and find command and also checked PATH … IS this because of the release .. I know this is not a really really issue but to get a clarification ….

  17. Yogesh Raheja says:

    @Seema, as far as I remembered resize2fs work in RHEL 4. I dont know why you are unable to get in your system. just provide me with the output of uname -a & redhat-release version.

  18. aim target says:

    Hello Yogesh,

    after i proceed with extend the lvm as below on my zimbra mail-server :

    ==================================================================

    [root@mail VolGroup00]# lvm lvextend -l+8937 /dev/VolGroup00/LogVol00    Extending logical volume LogVol00 to 482.00 GB  Logical volume LogVol00 successfully resized
    [root@mail VolGroup00]#
    [root@mail VolGroup00]# resize2fs /dev/VolGroup00/LogVol00
    resize2fs 1.39 (29-May-2006)
    Filesystem at /dev/VolGroup00/LogVol00 is mounted on /; on-line resizing re                                                                                  quiredPerforming an on-line resize of /dev/VolGroup00/LogVol00 to 126353408 (4k)                                                                                   blocks.The filesystem on /dev/VolGroup00/LogVol00 is now 126353408 blocks long.

    [root@mail VolGroup00]# dateSun Nov 27 00:15:31 MYT 2011

    [root@mail ~]# cat /proc/partitionsmajor minor  #blocks  name
       8     0  214719488 sda   8     1     104391 sda1   8     2  214612335 sda2   8    16  292852736 sdb   8    17  292848853 sdb1   8    32  241172480 sdc   8    33     120456 sdc1   8    34  241047292 sdc2   8    48 1073741824 sdd   8    64  113582080 sde   8    65     939771 sde1   8    80  241172480 sdf 253     0  505413632 dm-0 253     1    2031616 dm-1   8    96 1073741824 sdg   8    97    8040501 sdg1   8   112  113582080 sdh   8   144  976762584 sdj   8   145  976758784 sdj1[root@mail ~]#
    ==================================================================

    Now I getting dis error… actually i need to extend my current vg00 only :

    [root@mail ~]# vgdisplay  WARNING: Duplicate VG name VolGroup00: Existing 813rD3-NwqG-Mwxc-Mc1N-79lQ-Lym0-IG3WPz (created here) takes precedence over nKVmhd-EsYe-aj9L-dQ7z-YYaw-kEh1-bcvnmr  /dev/sdd: read failed after 0 of 4096 at 0: Input/output error  /dev/sdf: read failed after 0 of 4096 at 0: Input/output error  /dev/sdh: read failed after 0 of 4096 at 0: Input/output error  — Volume group —  VG Name               VolGroup00  System ID  Format                lvm2  Metadata Areas        1  Metadata Sequence No  3  VG Access             read/write  VG Status             resizable  MAX LV                0  Cur LV                2  Open LV               2  Max PV                0  Cur PV                1  Act PV                1  VG Size               229.88 GB  PE Size               32.00 MB  Total PE              7356  Alloc PE / Size       7355 / 229.84 GB  Free  PE / Size       1 / 32.00 MB  VG UUID               nKVmhd-EsYe-aj9L-dQ7z-YYaw-kEh1-bcvnmr
      — Volume group —  VG Name               VolGroup00  System ID  Format                lvm2  Metadata Areas        2  Metadata Sequence No  5  VG Access             read/write  VG Status             resizable  MAX LV                0  Cur LV                2  Open LV               2  Max PV                0  Cur PV                2  Act PV                2  VG Size               483.94 GB  PE Size               32.00 MB  Total PE              15486  Alloc PE / Size       15486 / 483.94 GB  Free  PE / Size       0 / 0  VG UUID               813rD3-NwqG-Mwxc-Mc1N-79lQ-Lym0-IG3WPz
    [root@mail ~]#

    Kindly advise and revert.

    regards,
    -AimTarget-
    aimyatim07@gmail.com
    FB: Aim Target’s
    YM: aim_yatim
    Skype: ibrahim281181

  19. Arunabha says:

    @aim targe, Please show us the output of ( cat /etc/redhat-release / fdisk -l | grep -i disk / pvscan / vgscan / pvs / vgs / cat /etc/lvm/backup/VolGroup00)

  20. Ramdev says:

    @Arunabha – Thanks for responding for this request. Appreciate it.
    @aim Target – Please provide the information requested, so that other geeks can help you on this.

  21. Bava says:

    Nice article..

  22. Yogesh Raheja says:

    @Bava, thanks..

  23. Raghuram says:

    Nice post…

  24. Yogesh Raheja says:

    @Raghuram, thanks.

  25. SDN says:

    Nice artcle

  26. shekar says:

    Hi Yogesh

    Why i can’t use resize2fs to incease the FS on Red Hat Enterprise Linux AS release 4 (Nahant Update 8) pl advise ? ( exactly same problem faced by Seem )

    Thanks

  27. Ramdev says:

    Hi Shekar, I could guess only two reasons in your case 

    If the resize2fs command missing from your machine  then the kernel might be older than 2.6.  And alternatively you can use ext2online.
    If the command is there and it is not working then there is a redhat bug report about that, which was fixed little later - https://bugzilla.redhat.com/show_bug.cgi?id=454872

    Sorry, we dont have RHEL4 machines to give you the exact answer.

  28. shekar says:

    Thanks Ram ,i too extended using ext2online .

    I want to check the psuedo Disk speed of read and write assigned to Linux server ,is there any tool available for liunx ?

    I can check the speed using hdparam -t /dev/sda ( if is is SATA ,ATA etc( , how will i check in the case of /dev/emcpowerx ?

  29. Mahesh Vijapure says:

    Hi Ram,

    Pls check out below two places where you need corrections –

    You missed to use “8e” while creating partition system type for the first disk(/dev/sdb).

    Also
    You are pointing to wrong line, pls see below-
    VG Size 3.99 GB
    PE Size 4.00 MB ——————————-> The size has been increasedto 4Gb as our disk are 2GB each.

    I believe you will not mind that I had pointed out this.

    Thanks,
    Mahesh Vijapure.

  30. Ganesha says:

    Nice article

  31. Ganesha says:

    Gettin following error in suse linux

    # pvcreate /dev/sdb1
    Warning: lvmetad is running but disabled. Restart lvmetad before enabling it!
    lvmetad: unknown service

  32. Ajay says:

    Hi Do you have any steps on how to rename a VG without umounting the Filesystem

  1. May 20, 2014

    […] Reference 1 –   Linux Admin Reference for  LVM2 Administration […]

  2. September 15, 2015

    […] Experience LINUX LVM (Logical Volume Manager) with real time examples […]

  3. September 17, 2015

    […] Experience LINUX LVM (Logical Volume Manager) with real time examples […]

Leave a Reply

Your email address will not be published. Required fields are marked *

[contact-form to='ramkumar.ramadevu@gmail.com' subject='New Learning Request Submitted'][contact-field label='Name' type='name' required='1'/][contact-field label='Email' type='email' required='1'/][contact-field label='Learning Request' type='textarea' required='1'/][contact-field label='Are you Looking for ' type='radio' required='1' options='Paid Training,Free Training'/][/contact-form]

What is your Learning Goal for Next Six Months ? Talk to us