Difference between revisions of "Fs-drbd"

From Bashlinux
Jump to: navigation, search
(Redirected page to DRBD)
 
Line 1: Line 1:
  +
#REDIRECT [[DRBD]]
__NOTOC__
 
= DRBD =
 
 
== How to setup DRBD with separated resource and meta-disk ==
 
'''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 ||
 
 
# If the meta-disk and resource partition are listed on fstab, then remove them from there
 
# Install drbd
 
 
<pre><nowiki>
 
# apt-get -y install drbd8-utils
 
</nowiki></pre>
 
 
 
# Edit `drbd.conf` to something similar to:
 
 
<pre><nowiki>
 
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];
 
}
 
}
 
</nowiki></pre>
 
 
 
# Create resource and meta-disk
 
 
<pre><nowiki>
 
# drbdadm create-md srv
 
</nowiki></pre>
 
 
 
# Start DRBD
 
 
<pre><nowiki>
 
# service drbd start
 
</nowiki></pre>
 
 
 
'''On primary server'''
 
 
When finish the previous setup on both servers
 
# Tell DRBD which one is the primary
 
 
<pre><nowiki>
 
# drbdadm -- --overwrite-data-of-peer primary all
 
</nowiki></pre>
 
 
This going to take a long, depending of the size of the drive. The sync can be watched at `/proc/drbd` file.
 
# When drbd sync is done, then, create the filesystem on drbd device
 
 
<pre><nowiki>
 
# mkfs.ext4 /dev/drbd0
 
</nowiki></pre>
 
 
# Finally, mount drbd device on the primary server
 
 
<pre><nowiki>
 
# mount /dev/drbd0 /srv
 
</nowiki></pre>
 

Latest revision as of 05:30, 12 June 2015

Redirect to: