<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>drbd Archives - Linux Windows and android Tutorials</title>
	<atom:link href="https://www.osradar.com/tag/drbd/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.osradar.com</link>
	<description>tutorials and news and Seurity</description>
	<lastBuildDate>Thu, 08 Aug 2019 20:09:55 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.8.13</generator>
	<item>
		<title>Install and configure DRBD on Debian 10</title>
		<link>https://www.osradar.com/install-and-configure-drbd-on-debian-10/</link>
					<comments>https://www.osradar.com/install-and-configure-drbd-on-debian-10/#respond</comments>
		
		<dc:creator><![CDATA[angeloma]]></dc:creator>
		<pubDate>Sun, 11 Aug 2019 23:22:20 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Buster]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[drbd]]></category>
		<category><![CDATA[How to]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[network]]></category>
		<category><![CDATA[replication]]></category>
		<category><![CDATA[Sysadmin]]></category>
		<category><![CDATA[Tutorial]]></category>
		<guid isPermaLink="false">https://www.osradar.com/?p=12948</guid>

					<description><![CDATA[<p>Replicating partitions is a great way to back up data in real-time. This is one of the most useful operations we can do as sysadmin as it can save us a lot of time. Imagine that a server has a lot of information and suddenly stops working. It would be a problem. However, if we [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://www.osradar.com/install-and-configure-drbd-on-debian-10/">Install and configure DRBD on Debian 10</a> appeared first on <a rel="nofollow" href="https://www.osradar.com">Linux  Windows and android  Tutorials</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Replicating partitions is a great way to back up data in real-time. This is one of the most useful operations we can do as sysadmin as it can save us a lot of time. Imagine that a server has a lot of information and suddenly stops working. It would be a problem. However, if we are replicating all its information through the network there would be no need to be alarmed. So, in this post, I will explain how to install and configure DRBD on Debian 10.</p>
<h2>0. What we need</h2>
<p>First of all, we need two Debian 10 teams. Both must have a static IP address and a defined hostname. Also, they have a partition defined for replication of the same size. Then, be connected to the same network and that the Firewall allows connections through the DRBD network port. In short, this will be our environment.</p>
<p>Node 1:</p>
<ul>
<li>IP address: 192.168.250.100</li>
<li>Hostname: osradar1</li>
<li>OS: Debian 10</li>
<li>Disk: /dev/sda</li>
<li>Partition to replicate: /dev/sda2</li>
</ul>
<p>Node 2:</p>
<ul>
<li>IP address: 192.168.250.110</li>
<li>Hostname: osradar2</li>
<li>OS: Debian 10</li>
<li>Disk: /dev/sda</li>
<li>Partition to replicate: /dev/sda2</li>
</ul>
<p>Each node must have a /dev/sda2/ partition of at least several GB in size.</p>
<h2>1) Install DRBD on Debian 10</h2>
<p>DRBD is available in the official repositories of the distribution. So the installation is not complicated.</p>
<p>On both nodes, run the following command:</p>
<pre>:~$ sudo apt install drbd-utils</pre>
<p>Of course, DRBD incorporates a module that has to be loaded into the kernel. In both nodes, it has to be loaded. To do this, run the following command:</p>
<pre>:~$ sudo modprobe drbd</pre>
<p>Then, check the module was added.</p>
<pre>:~$ lsmod | grep drbd</pre>
<figure id="attachment_12950" aria-describedby="caption-attachment-12950" style="width: 328px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-12950" src="https://www.osradar.com/wp-content/uploads/2019/08/1-4.jpeg" alt="1.- check the drbd module" width="328" height="93" srcset="https://www.osradar.com/wp-content/uploads/2019/08/1-4.jpeg 328w, https://www.osradar.com/wp-content/uploads/2019/08/1-4-300x85.jpeg 300w, https://www.osradar.com/wp-content/uploads/2019/08/1-4-324x93.jpeg 324w" sizes="(max-width: 328px) 100vw, 328px" /><figcaption id="caption-attachment-12950" class="wp-caption-text">1.- check the drbd module</figcaption></figure>
<h2>2) Configure DRBD</h2>
<p>The package is already installed and the module loaded to the kernel. Now it remains to make the appropriate settings for the replication to be a success.</p>
<p>DRBD has the particularity of being flexible, that is, the configuration file has many options that we can manipulate and adapt to our needs.</p>
<p>However, it is recommended to make a backup of the configuration file before starting to work on it.</p>
<pre>:~$ sudo cp /etc/drbd.conf /etc/drbd.conf.bak</pre>
<p>Then, erase the entire file.</p>
<pre>:~$ sudo cat /dev/null &gt; /etc/drbd.conf</pre>
<p>Now, you need to edit the configuration file:</p>
<pre>:~$ sudo nano /etc/drbd.conf</pre>
<p>And add the following:</p>
<pre>global { usage-count no; }
common { syncer { rate 100M; } }
resource r0 {
        protocol C;
        startup {
                wfc-timeout  15;
                degr-wfc-timeout 60;
        }
        net {
                cram-hmac-alg sha1;
                shared-secret "secret";
        }
        on osradar1 {
                device /dev/drbd0;
                disk /dev/sda2;
                address 192.168.250.100:7788;
                meta-disk internal;
        }
        on osradar2 {
                device /dev/drbd0;
                disk /dev/sda2;
                address 192.168.0.110:7788;
                meta-disk internal;
        }
}</pre>
<figure id="attachment_12951" aria-describedby="caption-attachment-12951" style="width: 810px" class="wp-caption alignnone"><img loading="lazy" class="wp-image-12951 size-full" src="https://www.osradar.com/wp-content/uploads/2019/08/2-4.jpeg" alt="2.- Install DRBD on Debian 10" width="810" height="495" srcset="https://www.osradar.com/wp-content/uploads/2019/08/2-4.jpeg 810w, https://www.osradar.com/wp-content/uploads/2019/08/2-4-300x183.jpeg 300w, https://www.osradar.com/wp-content/uploads/2019/08/2-4-768x469.jpeg 768w, https://www.osradar.com/wp-content/uploads/2019/08/2-4-696x425.jpeg 696w, https://www.osradar.com/wp-content/uploads/2019/08/2-4-687x420.jpeg 687w" sizes="(max-width: 810px) 100vw, 810px" /><figcaption id="caption-attachment-12951" class="wp-caption-text">2.- Install DRBD on Debian 10</figcaption></figure>
<p>The truth is that I think that many of the options are very explicit but I will briefly explain the most important ones.</p>
<p>In global and common some global configurations are defined to both nodes and resources.</p>
<p>Then, in the resource section, we define the name. In this case <code>r0</code>, of course, you can modify it. Next, in protocol, startup, and net, specific configurations to the resource.</p>
<p>Then, there is the configuration in each node identified by the hostname. In each of them, we define the DRBD device and the partition we are going to replicate (<code>disk</code>). Also, the IP address of the node as well as the communication port.</p>
<p>As you can see it is not very complex or long to understand.</p>
<h2>3) Start DRBD on Debian 10</h2>
<p>Remember this same file must be on both nodes. Then, in both nodes run the following commands to start the DRBD service.</p>
<pre>:~$ sudo systemctl stop drbd
:~$ sudo drbdadm create-md r0
:~$ sudo drbdadm attach r0</pre>
<p>Remember that is<code>r0</code> the name of the resource. You can change it in the configuration file.</p>
<p>After that, you can start the service.</p>
<pre>:~$ sudo systemctl start drbd</pre>
<p>And set which node will be the master. In this case, the node1 will be the master. So, in the node1 run this command:</p>
<pre>:~$ sudo drbdadm -- --overwrite-data-of-peer primary all</pre>
<p>With that, we should have an effective replication. It would be enough to create a new file system and mount it.</p>
<pre>:~$ sudo mkfs.ext4 /dev/drbd0
:~$ sudo mkdir /testdata
:~$ sudo mount /dev/drbd0 /testdata</pre>
<p>There, you can create new files. And that is it.</p>
<p>If you want more post about Debian 10, please click <a href="https://www.osradar.com/tag/buster/">here</a>.</p>
<p>Please share this post with your friends and join <a href="https://t.me/osradar">our Telegram Channel.</a></p>
<p>The post <a rel="nofollow" href="https://www.osradar.com/install-and-configure-drbd-on-debian-10/">Install and configure DRBD on Debian 10</a> appeared first on <a rel="nofollow" href="https://www.osradar.com">Linux  Windows and android  Tutorials</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.osradar.com/install-and-configure-drbd-on-debian-10/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
