# Configure drbd on proxmox

**URL:** <https://forums.linbit.com/t/configure-drbd-on-proxmox/286>\
**Category:** Proxmox VE\
**Created:** [September 7, 2024, 9:00am UTC](https://forums.linbit.com/t/configure-drbd-on-proxmox/286 "2024-09-07T09:00:47Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![youzersef](https://yyz1.discourse-cdn.com/flex003/user_avatar/forums.linbit.com/youzersef/32/95_2.png) [@youzersef](https://forums.linbit.com/u/youzersef)\
**Post date:** [September 7, 2024, 9:00am UTC](https://forums.linbit.com/t/configure-drbd-on-proxmox/286/1 "2024-09-07T09:00:47Z")

</div>

Hello everyone,

i am new here in linstor 🙂 . i have 2 Proxmox Nodes and q-device “Lenove old PC”.

I configured the proxmox over this guide: [How to Setup LINSTOR on Proxmox VE - LINBIT](https://linbit.com/blog/linstor-setup-proxmox-ve-volumes/)

There is a link at the end of this guide about how to make the linstor controller highly available so i configured also.

My 2 nodes are old servers and they are for testing. We will buy new servers when i figure out what for components on the servers we need.

```auto
pve01 172.16.222.1/24
pve02 172.16.222.2/24

```

The servers have a different type of Hard drives `"pve01 -> SSDs, pve02 ->HDDs"`.  
I know that the Performance is variable but for test it is ok. So i have 2 quotations:

Let’s say that my DRBD Storage is configured on node01

```auto
root@pve02:~# cat /etc/pve/storage.cfg 
dir: local
	path /var/lib/vz
	content iso,vztmpl,backup

lvmthin: local-lvm
	thinpool data
	vgname pve
	content rootdir,images

drbd: linstor_storage
	content images,rootdir
	controller 172.16.222.1
	resourcegroup pve-rg

```

1- when the pve01 goes down. the drbd storage is not anymore reachable. Should i configure keepalived on 2 servers with virtual ip? Or is there better way that i can learn it? 🙂

* * *

I tested the Power failure on node01. Let’s say we have the following scenario:

a client tried to write a data on the drbd storage. then Power failure happened. How many Data we lost? To answer on this quotation i wrote the following script on a test-vm.

```auto
#!/bin/bash

duartion=300

for((i0; i<$duartion; i++)) do
  current_time=$(date +"%Y-%m-%d %H:%M:%S")
  echo $current_time >> foo.txt
  echo $current_time
  sleep 1
done

```

with this script i can print the output of the current\_time in seconds and write it in foo.txt

```auto
root@debian-test:~# ./foo.sh 
2024-09-07 10:40:52
2024-09-07 10:40:53
2024-09-07 10:40:54
2024-09-07 10:40:55
2024-09-07 10:40:56
^C
root@debian-test:~# cat foo.txt 
2024-09-07 10:40:52
2024-09-07 10:40:53
2024-09-07 10:40:54
2024-09-07 10:40:55
2024-09-07 10:40:56
root@debian-test:~#

```

so i started the script on the debian-test which is on HA on proxmox. I pulled the power-cabel when the debian-test wrote the following lines

```auto
root@debian-test:~# ./foo.sh 
2024-09-07 10:44:46
2024-09-07 10:44:47
2024-09-07 10:44:48
2024-09-07 10:44:49
2024-09-07 10:44:51
2024-09-07 10:44:52
2024-09-07 10:44:53
2024-09-07 10:44:54
2024-09-07 10:44:55
2024-09-07 10:44:56

```

I waited 2 Minutes then the debian-test was online on pve02 then i checked the foo.txt file

```auto
root@debian-test:~# cat foo.txt 
2024-09-07 10:44:46
2024-09-07 10:44:47
2024-09-07 10:44:48
2024-09-07 10:44:49
2024-09-07 10:44:51
2024-09-07 10:44:52

```

As you see 4 Seconds have been lost. Did i miss something? Is it because of HDDs on pve02?

What can i do to save the data?

Sorry for taking your time 🙂

Best regards  
Yousef

---

<div class="post-metadata">

**Author:** ![kermat](https://yyz1.discourse-cdn.com/flex003/user_avatar/forums.linbit.com/kermat/32/21_2.png) [@kermat](https://forums.linbit.com/u/kermat)\
**Post date:** [September 11, 2024, 2:13pm UTC](https://forums.linbit.com/t/configure-drbd-on-proxmox/286/2 "2024-09-11T14:13:28Z")

</div>

> [@youzersef](#):
>
> 1- when the pve01 goes down. the drbd storage is not anymore reachable. Should i configure keepalived on 2 servers with virtual ip? Or is there better way that i can learn it?

If you followed the [LINSTOR user’s guide section](https://linbit.com/drbd-user-guide/linstor-guide-1_0-en/#s-linstor_ha) that uses DRBD Reactor to make the LINSTOR controller highly available, you need at least three nodes in your cluster. This is because DRBD Reactor uses DRBD’s quorum status to promote resources.

Keepalived or Pacemaker could be used instead when you only have two nodes.

> [@youzersef](#):
>
> a client tried to write a data on the drbd storage. then Power failure happened. How many Data we lost? To answer on this quotation i wrote the following script on a test-vm.
> 
> ```auto
> #!/bin/bash
> 
> duartion=300
> 
> for((i0; i<$duartion; i++)) do
> current_time=$(date +"%Y-%m-%d %H:%M:%S")
> echo $current_time >> foo.txt
> echo $current_time
> sleep 1
> done
> 
> ```

You shouldn’t lose any data. Perhaps the writes are stuck in buffers somewhere. Try adding a `sync` to your script to test this:

```shell
#!/bin/bash

duartion=300

for((i0; i<$duartion; i++)) do
  current_time=$(date +"%Y-%m-%d %H:%M:%S")
  echo $current_time >> foo.txt; sync
  echo $current_time
  sleep 1
done

```

---

<div class="post-metadata">

**Author:** ![youzersef](https://yyz1.discourse-cdn.com/flex003/user_avatar/forums.linbit.com/youzersef/32/95_2.png) [@youzersef](https://forums.linbit.com/u/youzersef)\
**Post date:** [September 11, 2024, 3:23pm UTC](https://forums.linbit.com/t/configure-drbd-on-proxmox/286/3 "2024-09-11T15:23:10Z")

</div>

thank you Kermat.

i already installed the drbd-reactor and i configured it. My mistake was that i should put the 2 linstor controller

```auto
drbd: linstor_storage
	content images,rootdir
	controller 172.16.222.1,172.16.222.2
	resourcegroup pve-rg

```

the replication problem has been solved. One of old servers was problematic. the server could not handle with the data like the other server. so i replaced the server with lenove pc. Now i see the PVE servers replicate in real time 🙂
