1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

DRBD on two servers with only one disk in it.

Discussion in 'Proxmox VE 1.x: Installation and configuration' started by valferon, Nov 30, 2010.

  1. valferon

    valferon Member

    Joined:
    Nov 30, 2010
    Messages:
    34
    Likes Received:
    0
    Hello,
    I'm looking for some help to configure my two Proxmox servers with DRBD for live migration.

    Master and slave nodes are syncing of course.

    The problem I have is that my servers only have 1 hard disk each, and I'm not familiar with LVM.

    I would like to know how to set it up because the wiki 'howto' about this doesn't help me in this case.

    One more thing, if you could give me a simple explanation about each step to make me understand better (DRBD, LVM, iSCSI) , it would be great for me and probably for an other user ! ;)

    I'm currently studying IT and I'm french so sorry for my english and my IT knowledge !

    Thanks in advance.

    Valentin.
     
  2. tom

    tom Proxmox Staff Member
    Staff Member

    Joined:
    Aug 29, 2006
    Messages:
    10,754
    Likes Received:
    28
  3. valferon

    valferon Member

    Joined:
    Nov 30, 2010
    Messages:
    34
    Likes Received:
    0
    Hello,
    If I understood well, I have to modify the original LVM partition ("pve"), reducing the partition and creating an other one. Then I can use it for DRBD because I see it needs an unused partition.

    Thanks for the help!
     
  4. tom

    tom Proxmox Staff Member
    Staff Member

    Joined:
    Aug 29, 2006
    Messages:
    10,754
    Likes Received:
    28
  5. valferon

    valferon Member

    Joined:
    Nov 30, 2010
    Messages:
    34
    Likes Received:
    0
    Hello !

    I think I solved my first problem
    Here is the 'lvdisplay' of my logical volume :

    --- Logical volume ---
    LV Name /dev/pve/lv_drbd
    VG Name pve
    LV UUID n543bZ-iSVB-zXtF-GBim-r5Yb-Pdbj-ocnyJ2
    LV Write Access read/write
    LV Status available
    # open 0
    LV Size 80,00 GB
    Current LE 20480
    Segments 1
    Allocation inherit
    Read ahead sectors auto
    - currently set to 256
    Block device 254:3


    And here is my drbd.conf file :

    global { usage-count no; }
    common { syncer { rate 30M; } }
    resource r0 {
    protocol C;
    startup {
    wfc-timeout 15; # wfc-timeout can be dangerous (http://forum.proxmox.com/threads/3465-Is-it-safe-to-use-wfc-timeout-in-DRBD-configuration)
    degr-wfc-timeout 60;
    become-primary-on both;
    }
    net {
    cram-hmac-alg sha1;
    shared-secret "my-secret";
    allow-two-primaries;
    after-sb-0pri discard-zero-changes;
    after-sb-1pri discard-secondary;
    after-sb-2pri disconnect;
    }
    on srv01 {
    device /dev/drbd0;
    disk /dev/pve/lv_drbd;
    address 192.168.134.186:7788;
    meta-disk internal;
    }
    on srv02 {
    device /dev/drbd0;
    disk /dev/pve/lv_drbd;
    address 192.168.134.187:7788;
    meta-disk internal;
    }
    }


    I would like to know if it possible to set it up using my logical volume (of course same config on both nodes).

    Thanks a lot for your help!!

    /**************************************************/
    UPDATE :

    srv02:~# /etc/init.d/drbd start
    Starting DRBD resources:[ d(r0) ]0: State change failed: (-2) Refusing to be Primary without at least one UpToDate disk


    Any idea?

    Valentin.


    EDIT : DRBD can work with a Logical Volume so my storage config is ok.
     
    #5 valferon, Dec 1, 2010
    Last edited: Dec 2, 2010
  6. valferon

    valferon Member

    Joined:
    Nov 30, 2010
    Messages:
    34
    Likes Received:
    0
    Hello, here I am again !

    Tell me if I'm wrong :

    In the proxmox wiki howto, it's using LVM on top of DRBD.
    DRBD => LVM

    In my situation, it's harder to configure it because, to follow your 'howto' , I have to do something like this :
    LVM => DRBD => LVM

    So I made DRBD sync on top of LVM, but then I have no space left to create a LVM on top of DRBD. Should I keep space in the same volume group as pve (first defined VG) to be able to create more?

    Could you help me on this point if you understand?

    Thanks a lot.

    Valentin.
     
  7. udo

    udo Active Member

    Joined:
    Apr 22, 2009
    Messages:
    4,452
    Likes Received:
    19
    Hi,
    i think it's not the best idea to use drbd ontop lvm.
    I prefer the "clean" way: partition the harddisk.

    To do this (in short):
    connect external (big) harddisk to server, boot live cd (like grml), mount external harddisk, pve-root and pve-data.
    Save (with tar) the content of pve-root and pve-data on the external disk.
    Unmount, remove volumegroup pve, pvremove sda2.
    New partition-layout with sda3 for drbd (don't change sda1 (boot)).
    pvcreate /dev/sda2
    vgcreate -s 4M pve /dev/sda2
    use lvcreate for swap (-C y), root and data. mkfs.ext3 on root+data. mkswap -f on pve-swap.
    mount external disk and pve-root and data. restore tarfiles. reboot - and all should work.

    now you can use sda3 for drbd!

    Udo
     
  8. valferon

    valferon Member

    Joined:
    Nov 30, 2010
    Messages:
    34
    Likes Received:
    0
    Thank you Udo, I didn't think about doing it this way.

    EDIT 06/12/2010

    I finally succeeded, shrinking the original LVM physical volume to create a new partition. DRBD works, live migration too.
    I will write a howto for my own need, if anyone interested, i can post it down here.
     
    #8 valferon, Dec 2, 2010
    Last edited: Dec 6, 2010
  9. keyjey

    keyjey New Member

    Joined:
    Dec 19, 2010
    Messages:
    24
    Likes Received:
    0
    Please valferon, go ahead :)
     
  10. valferon

    valferon Member

    Joined:
    Nov 30, 2010
    Messages:
    34
    Likes Received:
    0
    I wrote it in french, I will translate it and post it down before next weekend!
     
  11. keyjey

    keyjey New Member

    Joined:
    Dec 19, 2010
    Messages:
    24
    Likes Received:
    0
    Great ... thanks ! ;)
     
  12. camel

    camel New Member

    Joined:
    Dec 21, 2010
    Messages:
    4
    Likes Received:
    0
    that would be great, thanks.
     
  13. valferon

    valferon Member

    Joined:
    Nov 30, 2010
    Messages:
    34
    Likes Received:
    0
    Coming next monday, sorry!
     
  14. valferon

    valferon Member

    Joined:
    Nov 30, 2010
    Messages:
    34
    Likes Received:
    0
    Howto shrink LVM partitions (Proxmox)




    While installing Proxmox, in command line "boot", specify root partition size with 'linux maxroot=02 (for a 2go root).


    When installation if finished, partitions look like this :


    pve1.jpg


    Let's start to shrink it :

    First,

    • Boot in rescue mode with a debian livecd for exemple.
    Code:
    vgchange -a y                           #activate existing lvm 
    e2fsk -f /dev/pve/data                  #verify the filesystem on the LV 'data'
    • We can now shrink the data LV.
    Code:
    resize2fs  -p /dev/pve/data 2G         
    lvresize -L 2G /dev/pve/data          
    pvs                                    


    • And now shrink the physical volume. We have to find it's new size :
    Code:
    pvs                                     #We have PSize and free space PFree.

    • Calculate PSIZE - PFREE to have the future pve size required. In my case it is around 11G so I set it a bit more.
    Code:
    pvresize /dev/sda2 --setphysicalvolumesize 11.5G
    We have now a volume like this :

    pve2.jpg


    Now we can reboot on the proxmox server (and why not finish this using SSH).

    On Proxmox console :

    Code:
    dpkg-reconfigure locales              
    aptitude update
    aptitude install parted

    • We will now make available that free space and use it

    • First, we reduce sda2 to match the new PV size.
    Code:
    pvs --units s                         #write 'PSize': (for me 24 109 056 s)
    parted /dev/sda unit s print          #write the 'start' sector of the lvm partition : 1 048 640 s

    • We will sda2 delete from the partition table and recreate it withthe same 'Start' sector but smaller.
    To calculate the new 'End' sector, add the 'Start' sector with 'PSize' in sector and add a safety margin of 131072 sectors (64MB).
    24 109 056 s + 1 048 640 s + 131 072 s = 25 288 768 s

    !Do not forget the 's' for sector unit in the mkpart command!
    Code:
    parted /dev/sda rm 2                                                   
    parted /dev/sda mkpart primary [startSecteur]s [newEndSecteur]s        # [startSecteur]s [newEndSecteur]s : 1048640s 25288768 s
    parted /dev/sda set 2 lvm on                                           # set lvm on partition
    parted /dev/sda print                                                  # to verify
    
    We have now an available free space :

    pve3.jpg

    • Now we can easily create a new partition from the free space (with cfdisk for exemple)

     
  15. cesarpk

    cesarpk Member

    Joined:
    Mar 31, 2012
    Messages:
    752
    Likes Received:
    1
    WWWWooooWWWW valferon
    You are a genius !!!!
    Thanks to you, all learn

    I did as your guide explains with Proxmox VE 2.1 and it worked fine!

    If you let me one question:
    When i executed the commands:

    parted /dev/sda rm 2
    parted /dev/sda mkpart primary [startSecteur]s [newEndSecteur]s
    parted /dev/sda set 2 lvm on

    I got a screen message about the kernel and reboot for each command
    I responded "ignore" to each question, and finally restart the computer.

    Did I do well? or Did I miss of something?

    Best regards
    Cesar
     
  16. valferon

    valferon Member

    Joined:
    Nov 30, 2010
    Messages:
    34
    Likes Received:
    0
    Hi;

    glad it helps!

    The message should be nothing to worry about, if you have it, write it here.

    Regards,

    Val Feron
     
  17. cesarpk

    cesarpk Member

    Joined:
    Mar 31, 2012
    Messages:
    752
    Likes Received:
    1
    i wiil write here when i do it again soon.

    Appendix:
    Only if you're interested, make RAID 1 with software raid (mdadm) in "Proxmox" installed, I can give you a link to a website (language is in spanish, but is easy). Not yet tested by me

    see you soon
    Cesar
     
  18. valferon

    valferon Member

    Joined:
    Nov 30, 2010
    Messages:
    34
    Likes Received:
    0
    Personally I use a hardware raid on proxmox servers but maybe someone else is interested!
     
  19. cesarpk

    cesarpk Member

    Joined:
    Mar 31, 2012
    Messages:
    752
    Likes Received:
    1
    ok, no problem.

    if you allow me, I ask you another question:
    I apologize for walking out of the thread, but so far nobody has responded,
    and if you could answer me .... more WWWoooWW

    Please see this link, and then, if you know the answer and not too much trouble, please answer me.
    (IS URGENT FOR ME) :
    http://forum.proxmox.com/threads/94...pve-when-human-errors-occur?p=53399#post53399

    Best regards
    Cesar
     

Share This Page