Create DRBD Partitions on disk (Both Nodes)
The commands below assume that /dev/sdb will be used for the DRBD partition.
device=/dev/sdb
dd if=/dev/zero of=${device} obs=512 count=100
dd if=/dev/zero of=${device} obs=512 count=100 seek=$(( $(blockdev --getsz ${device}) -100 ))
parted ${device} "mklabel gpt"
parted ${device} "mkpart primary 0% 100%" |
Verify that the partition is created:
fdisk -l /dev/sdb
-->
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.
Disk /dev/sdb: 274.9 GB, 274877906944 bytes, 536870912 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: gpt
Disk identifier: E7FF3D92-84BB-44E1-B0B0-26150DB80639
# Start End Size Type Name
1 2048 536868863 256G Microsoft basic primary |
Install DRBD Repos (Both Nodes)
rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-3.el7.elrepo.noarch.rpm |
Install DRBD Modules (Both Nodes)
yum -y install drbd90-utils kmod-drbd90 |
Configure Firewall (Both Nodes)
firewall-cmd --zone=public --add-port=7788-7799/tcp --permanent
firewall-cmd --reload |
Configure DRBD (Both Nodes)
NOTE: The following commands requires the hostname of both machines and the IP Address. These are obtained as follows:
Create a DRBD config file for jtelshared on /dev/sdb
cat <<EOFF > /etc/drbd.d/jtelshared.res
resource jtelshared {
protocol C;
meta-disk internal;
device /dev/drbd1;
syncer {
verify-alg sha1;
}
net {
allow-two-primaries;
}
on acd-store1 {
disk /dev/sdb1;
address 10.4.8.71:7789;
}
on acd-store2 {
disk /dev/sdb1;
address 10.4.8.171:7789;
}
startup {
become-primary-on both;
}
}
EOFF |
Create Metadata and start (Both Nodes)
drbdadm create-md jtelshared
drbdadm up jtelshared |
Make one node primary (First Node)
drbdadm primary jtelshared --force |
Tune the transfer (Second Node)
drbdadm disk-options --c-plan-ahead=0 --resync-rate=110M jtelshared |
Create filesystem (Primary Node)
mkfs.xfs -L data /dev/drbd1 |
Create fstab entry for file system (both nodes)
Add the following line to /etc/fstab
/dev/drbd/by-res/jtelshared/0 /srv/jtel/shared xfs noauto,noatime,nodiratime 0 0 |
Mount the file system (primary node)
Add the following line to /etc/fstab
mkdir /srv/jtel
mkdir /srv/jtel/shared
chown -R jtel:jtel /srv/jtel
mount /srv/jtel/shared |
Wait for initial sync to complete
cat /proc/drbd
-->
# When not yet done:
version: 8.4.10-1 (api:1/proto:86-101)
GIT-hash: a4d5de01fffd7e4cde48a080e2c686f9e8cebf4c build by mockbuild@, 2017-09-15 14:23:22
1: cs:SyncTarget ro:Secondary/Primary ds:Inconsistent/UpToDate C r-----
ns:0 nr:3955712 dw:3950592 dr:0 al:8 bm:0 lo:5 pe:0 ua:5 ap:0 ep:1 wo:f oos:264474588
[>....................] sync'ed: 1.5% (258272/262132)M
finish: 2:08:08 speed: 34,388 (25,652) want: 112,640 K/sec
-->
# When done:
version: 8.4.10-1 (api:1/proto:86-101)
GIT-hash: a4d5de01fffd7e4cde48a080e2c686f9e8cebf4c build by mockbuild@, 2017-09-15 14:23:22
1: cs:Connected ro:Secondary/Primary ds:UpToDate/UpToDate C r-----
ns:0 nr:15626582 dw:284051762 dr:0 al:8 bm:0 lo:0 pe:0 ua:0 ap:0 ep:1 wo:f oos:0 |
Untune the transfer (Second Node)
drbdadm adjust jtelshared |
Make second node primary and mount the file system (Secondary node)
Add the following line to /etc/fstab
mkdir /srv/jtel
mkdir /srv/jtel/shared
chown -R jtel:jtel /srv/jtel
drbdadm primary jtelshared
mount /srv/jtel/shared |
Start and enable DRBD (Both Nodes)
systemctl start drbd
systemctl enable drbd |