Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


How to create LVM in CentOS?
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

How to create LVM in CentOS?

AsimAsim Member
edited January 2012 in Help

I am not sure how to create LVM for CentOS as specified in the instructions

/ 80GB+ (KVM templates & iso's will be stored in /home/solusvm/kvm)
SWAP 4GB+ (Virtual servers may use host swap if there is a real memory shortage)
Logical Volume Group (LVM) remaining space (Logical Volume Group Only, SolusVM will create the logical volumes for
the virtual servers inside this group)
Please Note: The PE Size should be set to 32M not the Default of 4M.

My disk partition is

[root@localhost ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 890G 1.9G 842G 1% /
/dev/sda1 99M 18M 76M 20% /boot
tmpfs 5.8G 0 5.8G 0% /dev/shm

How do I create the LVM described in the instructions above, anyone?

Comments

  • KuJoeKuJoe Member, Host Rep

    You'll need to create the LVM when the OS is installed or from an empty partition. Resizing your current partition will be harder to do unless you boot to GParted or a similar disk editor.

  • FranciscoFrancisco Top Host, Host Rep, Veteran

    You can't.

    The LVM has to be setup from the get go when the box is provisioned. Do you have a KVM to reinstall?

  • Awww, shucks. I need to get that going from the start again (OS reload).

  • I thought there may be a shortcut to do that from within the OS

  • KuJoeKuJoe Member, Host Rep

    You can but it requires an empty partition. Redhat's wiki has a nice section on LVMs including creating one in the OS.

  • prometeusprometeus Member, Host Rep

    The whole partition layout is a bit different if you like to use LVM.

    You can try to shrink the sda3 partition and add a new partition marked with type lvm, but this would require a boot with something like systemrescuecd and a bit of knowledge. If this is not the case, then a new fresh install with LVM should be the best path :-)

  • I dont have access to KVM over IP with this dedi provider and it costs
    OS reloads are free so im opting for an OS-reload with the specific partition instructions

    By the way, how to increase PE size to 32M and not the default 4M?

    I got one note that says use this, hope its correct

    Use 32MB extent size

    vgcreate VolData00 -s 32 /dev/sdb1
    from http://www.datadisk.co.uk/html_docs/redhat/rh_lvm.htm

  • KuJoeKuJoe Member, Host Rep

    When you put in the request for the OS reload ask them to create an LVM and set the extent size to 32MB. It's much easier to do when installing the OS.

  • fdisk /dev/sdb -> select 8e (LVM) and create sdb1
    pvcreate sdb1
    pvdisplay
    vgcreate vg1 /dev/sdb1
    vgdisplay
    lvcreate -n lvm -L100G vg1
    lvdisplay
    mkfs.ext3 /dev/vg1/lvm
    mount /dev/vg1/lvm /mnt

  • also you can use webmin to create, it's more simple with interface ;)

  • prometeusprometeus Member, Host Rep

    @asim do you have other disk(s) or free space on the /dev/sda disk? if not you need definitively to have to shrink the sda3 partition.

  • Mon5t3rMon5t3r Member
    edited January 2012

    @Asim said: OS reloads are free so im opting for an OS-reload with the specific partition instructions

    By the way, how to increase PE size to 32M and not the default 4M?

    i prefer for / = 80-100GB
    swap = max 4GB
    /forvg = rest of the free space.

    and after that you can remove/unmount the forvg and create with pvcreate and vgcreate.

    it's hard increasing the 4M PE Size to 32M. in normal way you only can get 8M.

  • @Mon5t3r my dedi provider has been kind enough to give me the free KVMoverIP and i have easily done that via CentOS GUI installer (even the PE size)

    Thanks everyone for your comments

  • prometeusprometeus Member, Host Rep

    You're welcome :)

Sign In or Register to comment.