Results 1 to 19 of 19

Thread: DRBD on two servers with only one disk in it.

  1. #1
    Join Date
    Nov 2010
    Posts
    34

    Default DRBD on two servers with only one disk in it.

    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. #2
    Join Date
    Aug 2006
    Posts
    9,560

    Default Re: DRBD on two servers with only one disk in it.

    start here, make yourself familar with LVM and DRBD:

    http://tldp.org/HOWTO/LVM-HOWTO/
    http://www.drbd.org/docs/about/
    Best regards,
    Tom

    Do you have already a Commercial Support Subscription? - If not, Buy now

  3. #3
    Join Date
    Nov 2010
    Posts
    34

    Default Re: DRBD on two servers with only one disk in it.

    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. #4
    Join Date
    Aug 2006
    Posts
    9,560

    Default Re: DRBD on two servers with only one disk in it.

    yes.
    Best regards,
    Tom

    Do you have already a Commercial Support Subscription? - If not, Buy now

  5. #5
    Join Date
    Nov 2010
    Posts
    34

    Default Re: DRBD on two servers with only one disk in it.

    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/346...-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.
    Last edited by valferon; 12-02-2010 at 10:07 AM.

  6. #6
    Join Date
    Nov 2010
    Posts
    34

    Default Re: DRBD on two servers with only one disk in it.

    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. #7
    Join Date
    Apr 2009
    Location
    Ahrensburg; Germany
    Posts
    3,376

    Default Re: DRBD on two servers with only one disk in it.

    Quote Originally Posted by valferon View Post
    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.
    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. #8
    Join Date
    Nov 2010
    Posts
    34

    Default Re: DRBD on two servers with only one disk in it.

    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.
    Last edited by valferon; 12-06-2010 at 10:04 AM.

  9. #9
    Join Date
    Dec 2010
    Posts
    24

    Default Re: DRBD on two servers with only one disk in it.

    Please valferon, go ahead

  10. #10
    Join Date
    Nov 2010
    Posts
    34

    Default Re: DRBD on two servers with only one disk in it.

    I wrote it in french, I will translate it and post it down before next weekend!

  11. #11
    Join Date
    Dec 2010
    Posts
    24

    Default Re: DRBD on two servers with only one disk in it.

    Great ... thanks !

  12. #12
    Join Date
    Dec 2010
    Posts
    4

    Default Re: DRBD on two servers with only one disk in it.

    that would be great, thanks.

  13. #13
    Join Date
    Nov 2010
    Posts
    34

    Default Re: DRBD on two servers with only one disk in it.

    Coming next monday, sorry!

  14. #14
    Join Date
    Nov 2010
    Posts
    34

    Default Re: DRBD on two servers with only one disk in it.

    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. #15
    Join Date
    Mar 2012
    Posts
    509

    Default Re: DRBD on two servers with only one disk in it.

    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. #16
    Join Date
    Nov 2010
    Posts
    34

    Default Re: DRBD on two servers with only one disk in it.

    Hi;

    glad it helps!

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

    Regards,

    Val Feron

  17. #17
    Join Date
    Mar 2012
    Posts
    509

    Default Re: DRBD on two servers with only one disk in it.

    Quote Originally Posted by valferon View Post
    Hi;

    glad it helps!

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

    Regards,

    Val Feron
    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. #18
    Join Date
    Nov 2010
    Posts
    34

    Default Re: DRBD on two servers with only one disk in it.

    Personally I use a hardware raid on proxmox servers but maybe someone else is interested!

  19. #19
    Join Date
    Mar 2012
    Posts
    509

    Post Re: DRBD on two servers with only one disk in it.

    Quote Originally Posted by valferon View Post
    Personally I use a hardware raid on proxmox servers but maybe someone else is interested!
    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/943...3399#post53399

    Best regards
    Cesar

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •