Open noctiflorous0997 opened 1 year ago
Hi, thank you for trying to compile WinDRBD. It looks like you do not have the DRBD sources. They are a git submodule, so the WinDRBD project sources alone won't compile. Do a
git clone --recursive https://github.com/LINBIT/windrbd.git
to get a compilable output. Then first create the patched DRBD on the Linux side (with coccinelle installed) and then do a make on the Windows side. Also I am not sure if mingw32make can be used, you might have to install cygwin (with some dev tools: git, make, gcc, ...) on the Windows side.
Happy hacking and please let me know about your progress :)
Thank you for your reply. But I don't quite understand what you mean by DRBD source. Since I'm building on my own Intranet, I can't use git clone or something like that.I had to download the tag package to my Intranet where I couldn't use git clone.
According to the installation steps in INSTALL, steps 1 and 2 in the following figure are executed on linux box, then steps 3 and 4 are executed on powershell of window box or cmd or cygwin? I'm confused about this part of the compilation.
damn,i was stupid.I didn't notice that the drbd directory was empty. Now I know what you mean of DRBD source.
I executed the following command
git clone --recursive https://github.com/LINBIT/windrbd.git
then Put the retrieved files in a directory named windrbd and use
tar czxf windrbd.tar.gz windrbd/
Send the compressed packets to my Intranet,After I unzipped the package into linux box and ran make, I got the following error,
I solved this problem by this method
vim transform
:set ff=unix
Not sure if this is the right solution
Hi someone (git clone? tar? something else?) converted the transform shell script file to DOS linefeeds (0x0a 0x0d, or ^J^M). I checked the repo and the ^M isn't in the repo so it is probably converted somewhere in your copy process (you can use hexdump -C transform | less and search for 0d to check).
I would recommend to use a CygWin shell on the Windows side (once you are at that step).
Good luck :)
I have no idea how to compile this right now. I run make on the linux box and then 'make BUILD_ENV=jt-win10ent-2020' on the windows box. It should compile smoothly to me, but I keep getting stuck in some inexplicable place. Consider the error shown below
Hi, your build environment has to match your Ewdk installation. You need to edit Makefile.win copy one of the if BUILD_ENV .. sections and adapt it to your installation of Ewdk. After modifying the Makefile.win you need to run (on Linux) make copy which will copy the Makefile.win into the converted-sources/drbd directory.
Nowadays Ewdk is distributed as an ISO so you need to mount it on your Windows box (double clicking it usually is sufficient).
Also you need to create a ms-$(BUILD_ENV).cmd script which will be used to call the compiler.
Please let me know about the progress.
And if possible paste text instead of making a screenshot which would make it copy & paste able.
Best regards,
According to your instructions, I modified the corresponding file, and now when I run make on windows box, I encounter the following error.
drbd_buildtag.c drbd_buildtag.c: fatal error C1041: cannot open program database 'Z:\converted-sources\drbd\drbd_buildtag.pdb'; if multiple CL.EXE write to the same .PDB file, please use /FS make[1]: ***[Makefile:337: drbd_buildtag. obj] Error 2 make[1]: Leaving directory '/cygdrive/z/converted-sources/drbd" make: *** [Makefile:53: build] Error 2
Looking forward to your reply:)
Hi you can try a
make clean
It should remove the pdb files.
Congratulations you're almost done :)
Hi, It doesn't work,We still get the same error. What is this .pdb file related to? I want to check if there is something wrong with my Settings.
Hi, After solving the.PDB problem, I encountered a new problem
there are lost of errors,such as:
Z:\windrbd include drbd polymorph_printk.h(154): error C2037: left of devices pecifies undefined struct/union 'drbd_peer_device'
[Makefile:337: drbd_bitmap. obj] Error 2 make[1]: Leaving directory '/cygdrive/z/converted-sources/drbd" make: *** [Makefile:53: build] Error 2
Hi I recall I had the issue with the pdb files and copying the project directory to a local drive (C: for example) helped. It seems to be some samba issue
I did not encounter the other error with the struct / union, could you please post the complete build log?
Especially the first error line would be interesting ... does it say something about cannot include some other file? And did you make any changes to the sources (also changing line feeds)?
You are very brave compiling WinDRBD on your own, do you want to develop for it? You know that currently it is still possible to download an installer from the LINBIT website, do you?
HI, The downloaded installation software is not suitable for my use scenario. I want to make some modifications to windrbd and then adapt it to my other software.
I didn't do anything with the source code, I just did Makefile.win and ms-*.cmd.
The.pdb issue should be the cause of the windows EWDK version mismatch, which I solved by changing the EWDK version.
The struct / union error is a problem with my compilation environment
I fixed the problem by changing the build environment, but a new problem appeared.
windrbd_device.c ../../windrbd/src/windrbd_device.c(2716): error C2220: warning treated as error- no 'object' file generated ../../windrbd/src/windrbd_device.c(2716): warning C4819: The file contains a character that cannot be represented in the current code page (936). Save the file in Unicode format to prevent data loss make[1]: *** [Makefile:337: ../../windrbd/src/windrbd_device.obj] Error 2 make[1]: Leaving directory '/cygdrive/z/converted-sources/drbd' make: *** [Makefile:53: build] Error 2
The above issue is due to my windows Settings, which should change the language of non-Unicode programs to English `resource.rc(16) : error RC2127 : version WORDs separated by commas expected
resource.rc(17) : error RC2127 : version WORDs separated by commas expected make[1]: [Makefile:322: resource.res] Error 2 make[1]: Leaving directory '/cygdrive/z/converted-sources/drbd' make: [Makefile:53: build] Error 2` This is the problem I have now
Hi good to see that you are making progress. Did you install git on your cygwin machine? It looks like versioninfo fails to determine the correct version.
Maybe you also need to pull the tags:
git pull --tags
Could you send the relevant lines in resource.rc?
And what specifically do you want to implement, maybe I can help ...
Please also send the output of
git describe --tags
My compilation log gives the following error about versioninfo.sh ` make make[1]: Entering directory '/cygdrive/z/windrbd/windrbd/converted-sources/drbd' cd ../.. && ./versioninfo.sh converted-sources || true fatal: detected dubious ownership in repository at '/cygdrive/z/windrbd/windrbd' To add an exception for this directory, call:
git config --global --add safe.directory /cygdrive/z/windrbd/windrbd
Patchlevel is WinDRBD version is ., Resource version is , make[1]: Warning: File 'drbd_buildtag.c' has modification time 3.1 s in the future rm -f "drbd_buildtag.pdb"" `
git pull --tags
and
git describe --tags
It turns out that
`$ git pull --tags
fatal: detected dubious ownership in repository at '/cygdrive/z/windrbd/windrbd'
To add an exception for this directory, call:
git config --global --add safe.directory /cygdrive/z/windrbd/windrbd`
When I finished executing this command as he asked, I do make.
and
Catalog generation complete. Z:\windrbd\windrbd\converted-sources\drbd\windrbd.cat "e:\\Program Files\\Windows Kits\\10\\bin\\10.0.18362.0\\x86/signtool.exe" sign /fd SHA256 /f ../../crypto/linbit-2019.pfx /p "" /v "windrbd.sys" SignTool Error: File not found: ../../crypto/linbit-2019.pfx make[1]: *** [Makefile:302: windrbd.sys] Error 1 make[1]: Leaving directory '/cygdrive/z/windrbd/windrbd/converted-sources/drbd' make: *** [Makefile:53: build] Error 2
This should be the last step, it looks like I need to create one .pfx file.
The function I want to implement is that drbd does not do full disk synchronization for the first time (because maybe my disk is not full), I pass the value to drbd in the unit of sector or block, and drbd synchronize according to the value I pass in. I have tried similar on linux drbd, passing the value through ioctl. I don't know if windrbd supports ioctl. By the way, can windrbd support win11, or is there any development plan for win11?
Hi, regarding the crypto: there is a readme.txt which briefly explains how to create the required files. You need to also add your files to your build environment settings in Makefile.win (don't forget make copy after changing Makefile.win).
Regarding Windows 11: It has been reported that WinDRBD (starting from 1.1.0) also runs on Windows 11. However a Microsoft signed driver is required since Windows 11 won't load unsigned (or self signed) drivers any more. To do so you need to:
After all it is very complicated but this is out of scope of our control.
Regarding your function:
You also can create a user mode application that patches the bitmap of your on-disk meta data. This actually would be the preferred way to do this (also for the Linux version). If you wish I can assist you in that process (if you agree to GPL the resulting program). Then there would be no need to patch the kernel driver (which would save you from going through the Microsoft process).
Please let me know what you think about it.
Thank you very much for your help. I successfully compiled and installed the windrbd driver. Have you ever noticed that after running make clean on cygwin on windows, and do make again will bring an error about the bulidtag.c file?
Could you give me a general description of the process of making exe files through inno-setup? I know nothing about inno-setup, but I want to try this process. Do I need to execute make package on cygwin of windows box after successfully installing windrbd driver? Do I need to compile the source code of drbd-utile
About the function i mentioned earlier: I want to know what you mean by user mode application, did it like drbdmeta? According to you, I am curious how this user mode application tells the windrbd driver to modify the meta data value
Have you noticed that when you use make install after making, the windrbd.sys file is not placed in "C:\windows\system32\drivers\windrbd.sys"? And executing "Driverquery" in cmd does not produce windrbd as expected.
One more question is about compiling drbd-utils with cygwin on windows. I do
./autogen.sh
and As it asks
./configure --without-83support --without-84support --without-drbdmon --with-windrbd --without-manual --prefix=/cygdrive/c/windrbd/usr --localstatedir=/cygdrive/c/windrbd/var --sysconfdir=/cygdrive/c/windrbd/etc
and then do
make
at last do
make install
Finally, get the following error
`mkdir -p /usr/lib/ocf/resource.d/linbit
install -m 755 drbd.ocf /usr/lib/ocf/resource.d/linbit/drbd
install -m 755 drbd-attr /usr/lib/ocf/resource.d/linbit/drbd-attr
install -m 644 drbd.shellfuncs.sh /usr/lib/ocf/resource.d/linbit/
mkdir -p /cygdrive/c/windrbd/etc/bash_completion.d
install -m 644 drbdadm.bash_completion /cygdrive/c/windrbd/etc/bash_completion.d/drbdadm
make[1]: Leaving directory '/cygdrive/j/utiles/drbd-utils/scripts'
make[1]: Entering directory '/cygdrive/j/utiles/drbd-utils/user/windrbd'
install -m 755 windrbd.exe /cygdrive/c/windrbd/usr/sbin
cygrunsrv.exe -I windrbdlog -p /cygdrive/c/windrbd/usr/sbin/windrbd.exe -a log-server -1 /cygdrive/c/windrbd/windrbd-kernel.log -2 /cygdrive/c/windrbd/windrbd-kernel.log -t manual || exit 0
cygrunsrv: Error installing a service: OpenService: Win32 error 1073:
?????????
cygrunsrv.exe -I windrbdumhelper -p /cygdrive/c/windrbd/usr/sbin/windrbd.exe -auser-mode-helper-daemon -1 /cygdrive/c/windrbd/windrbd-umhelper.log -2 /cygdrive/c/windrbd/windrbd-umhelper.log -t manual || exit 0 cygrunsrv: Error installing a service: OpenService: Win32 error 1073: ?????????
make[1]: Leaving directory '/cygdrive/j/utiles/drbd-utils/user/windrbd'`
When I try to use make package to generate an exe file after make install, I get the following error:
Compiling [Code] section Error on line 232 in Z:\windrbd\windrbd\inno-setup\windrbd.iss: Column 48: Type mismatch. Compile aborted. make[1]: *** [Makefile:359: package] Error 2 make[1]: Leaving directory '/cygdrive/z/windrbd/windrbd/converted-sources/drbd' make: *** [Makefile:67: package] Error 2
If I want to protect my system disk with windrbd is that possible? Because I tried to use only RAW format disks
Hi I didn't use make install in WinDRBD for some time now, so it is probably broken. Regarding the make package error: I am not sure what it is, did you modify the ISS? Also use version 5 of inno-setup not version 6. I think with version 6 it does not work.
Regarding C: (system disk) it is possible but currently not well supported .. if you loose the network connection the machine will hang which is hard to fix (closed source problem). Also it is very cumbersome to get an instance running. So for now the answer would be no.
Let's forget about the make package, I don't feel like I need to use it that much right now. About the function i mentioned earlier: I want to know what you mean by user mode application, did it like drbdmeta? According to you, I am curious how this user mode application tells the windrbd driver to modify the meta data value
Hi,
As I understand you want to reuse existing data (like an NTFS partition) and at the initial resync sync only blocks that contain valuable data. You can do so by:
drbdadm dump-md
(use drbdadm dump-md -d to find the correct drbdmeta parameters) Also make sure that the resource is down before doing the dump-md (do not even bring it up).
That should be far more easier than patching WinDRBD ...
Does it help?
Best regards,
This sounds like a good idea, so I tested it out. I wanted to see the difference between the written bitmap and the newly created one, so I created a new metadata disk (external). Then do
drbdmeta 1 v09 /dev/sdc flex-external dump-md > md1.txt
I consider the md1.txt obtained this way to be the new bitmap data
I then set this node to primary, so its disk becomes UpToDate. At this point I'm used ‘dd’
I then set this node to primary, so its disk becomes UpToDate. At this point I dd to write to /dev/drbd1, then 'drbdsetup down' and 'drbdmeta 1 v09 /dev/sdc flex-external apply-al' and again
drbdmeta 1 v09 /dev/sdc flex-external dump-md > md2.txt
I am thinking that the difference between md2.txt and md1.txt may be what you said can be used to edit, but I do not understand the drbd bitmap is a format
Hi :) As you can see the bitmap changes as you write data.
After updating the bitmap you want to run:
drbdmeta restore-md ...
# do not connect it yet
drbdadm attach <res>
drbdadm new-current-uuid ... (see manpage)
drbdadm connect <res>
According to @joelcolledge this should work.
Please let me know your findings.
I am a bit unresponsive the next 3 weeks (vacation) so please be patient :)
Best regards,
Have a good holiday.
My question now is that the md.txt file I got here, I don't know how the blocks (I mean drbd divides the data into 4K blocks for each bit in the bitmap) correspond to the md.txt file I got.
My question now is that the md.txt file I got here, I don't know how the blocks (I mean drbd divides the data into 4K blocks for each bit in the bitmap) correspond to the md.txt file I got.
It is a run-length encoding. The hex values like 0xFFFFFFFFFFFFFFFF
represent 64 consecutive bits, in this case 64 set bits. The run-length parts like 800 times
indicate how many times these 64 bits are repeated. So 800 times 0xFFFFFFFFFFFFFFFF
in your example means that the bitmap starts with 51200 set bits.
If there is no run-length part then the hex value just represents the next 64 bits.
The comments like # at 204800kB
are just for the convenience of the human reader.
In your case you could just write the whole bitmap without worrying about the run-length encoding. For instance, the following would represent a 128 bit bitmap, where only bit 6 is set. That is, a 512KiB device with a bitmap for syncing the data set by dd if=/dev/urandom of=/dev/drbd1 bs=4K count=1 seek=6 oflag=direct
.
bitmap[0] {
0x0000000000000040;
0x0000000000000000;
}
I downloaded the tag package and unpacked it on my Intranet (ubuntu). I executed make on Ubuntu and then followed the instructions in the INSTALL document to execute Makefile.win. Since there is no network on the Intranet, I executed versioninfo.sh on ubuntu beforehand. I then commented the relevant content in Makefile.win and now I get the following error when compiling on Windows ent.