Fs-drbd

From Bashlinux
Revision as of 05:22, 12 June 2012 by (talk)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

DRBD

How to setup DRBD with resource and meta info on different mount point

  • On both servers*
  • Create 2 separate partitions on each server, one for meta and one for data. Some meta-disk size approximations:
||Block device size||DRBD meta data||
|| 1 GB || 2 MB ||
|| 100 GB || 4+1 MB ||
|| 500 GB || 16+2 MB ||
|| 1 TB || 32+2 MB ||
|| 2 TB || 64+1 MB ||
|| 4 TB || 128 MB  ||
  1. If the meta-disk and resource partition are listed on fstab, then remove them from there
  2. Install drbd
 # apt-get -y install drbd8-utils
 


  1. Edit `drbd.conf` to something similar to:
 global { usage-count no; }
 common { syncer { rate 100M; } }
 resource srv {
        protocol C;
        startup {
                wfc-timeout  15;
                degr-wfc-timeout 60;
        }
        net {
                cram-hmac-alg sha1;
                shared-secret "B1ng0!";
        }
        on SERVER-01p {
                device /dev/drbd0;
                disk /dev/md4;
                address IP_SERVER-01p:7788;
                meta-disk /dev/md3[0];
        }
        on SERVER-01s {
                device /dev/drbd0;
                disk /dev/md4;
                address IP_SERVER-01s:7788;
                meta-disk /dev/md3[0];
        }
 }
 


  1. Create resource and meta-disk
 # drbdadm create-md srv
 


  1. Start DRBD
 # service drbd start
 


  • On primary*

When finish the previous setup on both servers

  1. Tell DRBD which one is the primary
 # drbdadm -- --overwrite-data-of-peer primary all
 
This going to take a long, depending of the size of the drive. The sync can be watched at `/proc/drbd` file.
  1. When drbd sync is done, then, create the filesystem on drbd device
 # mkfs.ext4 /dev/drbd0
 
  1. Finally, mount drbd device on the primary server
 # mount /dev/drbd0 /srv