dokan-dev / dokany

User mode file system library for windows with FUSE Wrapper
http://dokan-dev.github.io
5.21k stars 661 forks source link

The Dokany disk has too small space only 1gb #686

Closed DaniGTA closed 6 years ago

DaniGTA commented 6 years ago

Feature request can skip this form. Bug report must complete it. Check List must be 100% match or it will be automatically closed without further discussion. Please remove this line.

Environment

Check List

I think this issue dont need logs.

And think a simple command too raise the space would kill this problem. btw in v2.0.0-BETA1 this problem dosnt exist but it is too unstable for me too use.

Liryna commented 6 years ago

Hi @DaniGTA,

This is not an issue. Please look at the mirror code and specially à function this is comment. https://github.com/dokan-dev/dokany/blob/master/samples/dokan_mirror/mirror.c#L1370

graphixillusion commented 5 years ago

Sorry if i ask it again but i can't understand how to map a drive with mirror.exe which is bigger than 1GB in size, thank you.

Liryna commented 5 years ago

@graphixillusion You will need to uncomment MirrorDokanGetDiskFreeSpace function and also set it to dokanoperations

graphixillusion commented 5 years ago

@Liryna thank you for answering. could you provide a quick guide? i'm kinda new to this stuff.

Liryna commented 5 years ago

https://github.com/dokan-dev/dokany/blob/master/samples/dokan_mirror/mirror.c#L1695 https://github.com/dokan-dev/dokany/blob/master/samples/dokan_mirror/mirror.c#L1368-L1381 only this to change 👍

graphixillusion commented 5 years ago

@Liryna ok so i remove the comment in that line and what i need to change in this line? dokanOperations->GetDiskFreeSpace = NULL; i need to change NULL with what?

Liryna commented 5 years ago

yes 😃

graphixillusion commented 5 years ago

@Liryna Could you make a pratical example please? Like: if i need to have a 10GB disk, how i need to modify?

Liryna commented 5 years ago

What I linked is already the partical example

graphixillusion commented 5 years ago

@Liryna Ok i did it, thank you for the support.

auxilix commented 5 years ago

Hello, sorry if this appears to be a poor question but I have been attempting to edit my mirror.c file and perform this very same action, however it does not appear to make any difference no matter which mirror.c file i edit.

I've attempted editing C:\Program Files\Dokan\Dokan Library-1.2.2\sample\mirror\mirror.c and have also attempted editing the same file which exists within the x86 directory.

Is there a different way I should be going about editing this / un-commenting out the sections to have mirror.exe recognize these changes?

Liryna commented 5 years ago

@auxilix Have you build the projet after editing the mirror file?

graphixillusion commented 5 years ago

@auxilix Probably you are doing the same mistake i did. To make it works you need to change this in line 1695

dokanOperations->GetDiskFreeSpace = NULL; // MirrorDokanGetDiskFreeSpace; into this

dokanOperations->GetDiskFreeSpace = MirrorDokanGetDiskFreeSpace;

and then just remove the

/* <--- Line 1369
*/ <--- Line 1381

After this changes you need to recompile the project with visual studio following this guide:

https://github.com/dokan-dev/dokany/wiki/Build

Done. The new compiled mirror.exe will not have the 1GB limitation when you map the drive. The only thing i still don't understand is why it's still says that you have 512MB occupied even if there isn't anything inside.

Liryna commented 5 years ago

Please see the documentation about GetDiskFreeSpace https://dokan-dev.github.io/dokany-doc/html/struct_d_o_k_a_n___o_p_e_r_a_t_i_o_n_s.html#a640f8ea90833fcd8885f59e63a58f3a7

auxilix commented 5 years ago

ah yes, my apologies it was a matter of needing to compile afterwards which I was missing, thank you for the clarification!

aquariuz23 commented 5 years ago

Hello all,

I am running into the very same issue here, and I've read through everything here and understand what needs to be done to resolve the issue. Unfortunately, I have zero knowledge on how to edit mirror.c the proper way, let alone recompile the project afterwards. I tried following the Build instructions and installed whatever I think may be needed to recompile, but there are things that are just way over my head.

Not trying to ask for an easy way out of my predicament, but would it be possible to have the project recompiled with the necessary changes and shared somewhere so that I may download and reinstall Dokan with the correct files? Again, I truly would try to do this myself, but I seriously have no clue to what I'm doing and will probably spend hours and hours trying to do something that is probably very simple and would've taken only minutes.

Any assistance or guidance will be greatly appreciated. Thank you.

graphixillusion commented 5 years ago

@aquariuz23 mirror_recompiled.zip

aquariuz23 commented 5 years ago

@graphixillusion Thank you so very much for helping me with the recompiling! That is very kind of you.

I've replaced the files in the sample folders and tried running the command again, and although it now shows a different disk size, it's still not the correct size. It's now showing 7.99 EB (not sure why it's showing EB instead of GB or TB) and it's still showing that only 512MB is free. The bigger problem here is the free space that is reported. Since Windows sees only 512MB as free, a software I'm using that automatically moves files I added to another server won't move files over to the drive because it's saying there's insufficient space. I've attached a screenshot of the Dokan mirrored drive (G:) compared to the actual size of the network drive that I've mapped (Z:)

dokan

Oh, and my apologies, I probably should've mentioned from the beginning that I'm trying to mirror a network drive from another server to this one. The reason I'm doing this, besides for the transfer of files, is also because I have Backblaze backing up this computer and I would like to have backblaze backup the network drive as well, and since backblaze does not support backing up network drives, I'm forced to try this method.

The command I run in CMD is "mirror.exe /r \192.168.1.51\anime /l g" Please let me know if I'm doing something wrong here. All I need is to have the free space to be reported as much higher, maybe 100GB or something.

graphixillusion commented 5 years ago

@aquariuz23 you are right. we need to wait for a proper fix then. @Liryna can you help us with this please? Thank you!

Liryna commented 5 years ago

@graphixillusion We can look to add this as mirror params. If no param are given we let the current behavior.

graphixillusion commented 5 years ago

@Liryna yes please, a param switch would be great thank you!

Liryna commented 5 years ago

https://github.com/dokan-dev/dokany/issues/791 👍

aquariuz23 commented 5 years ago

@Liryna thank you for your assistance :) @graphixillusion, if you could be so kind as to recompile a new one for me please :D whenever you have a chance, I'll greatly appreciate it.

graphixillusion commented 5 years ago

@aquariuz23 when the new version will come out with the new option the mirror.exe will be update too. If not i will recompile it for you don't worry.

aquariuz23 commented 5 years ago

@graphixillusion oh sorry, I didn't understand that it was going to be a new option added to mirror.exe :) thank you for the clarification. No worries, and I really appreciate all your help with my situation.

met-pub commented 5 years ago

@graphixillusion before new version, would you kindly please recompile mirror for us with more free disk space? why not change to 500G https://github.com/dokan-dev/dokany/blob/master/samples/dokan_mirror/mirror.c#L1375 FreeBytesAvailable = (ULONGLONG)(512 1024 1024); -> FreeBytesAvailable = (ULONGLONG)(512000 1024 1024);

graphixillusion commented 5 years ago

@bianbian-org

if i launch a compile with your change i get this error:

c:\build\dokany-master\samples\dokan_mirror\mirror.c(1375): warning C4307: '*': integral constant overflow

Karandra commented 5 years ago

Cast each number, not only the result, integer literal without any additional specifications are int and this multiplication simply overflows it. If that's C++ (or at least C99), you could use this:

*FreeBytesAvailable = 512000ull * 1024ull * 1024ull;

Otherwise use casting:

*FreeBytesAvailable = (ULONGLONG)512000 * (ULONGLONG)1024 * (ULONGLONG)1024;
graphixillusion commented 5 years ago

@KerberX works greate thank you! here the new recompiled mirror with 500GB free space

mirror_500GBfreesize.zip

aquariuz23 commented 5 years ago

@bianbian-org @KerberX @graphixillusion now I can use this as it intended! It's wonderful! Thank you very much for making all this work! Ideally, it'll be perfect if it can actually mirror the actual free space/used space, but but for now, this is very much usable :)

Karandra commented 5 years ago

That's quite simple actually. With this function mirror sample will use 'RootDirectory' (the folder it mirrors) disk space as mirror drive space.

static NTSTATUS MirrorDokanGetDiskFreeSpace(PULONGLONG FreeBytesAvailable, PULONGLONG TotalNumberOfBytes, PULONGLONG TotalNumberOfFreeBytes, PDOKAN_FILE_INFO DokanFileInfo)
{
    UNREFERENCED_PARAMETER(DokanFileInfo);

    if (!::GetDiskFreeSpaceExW(RootDirectory, (ULARGE_INTEGER*)FreeBytesAvailable, (ULARGE_INTEGER*)TotalNumberOfBytes, (ULARGE_INTEGER*)TotalNumberOfFreeBytes))
    {
        return DokanNtStatusFromWin32(::GetLastError());
    }
    return STATUS_SUCCESS;
}
graphixillusion commented 5 years ago

@KerberX so if i replace from line 1370 to line 1380 with your code we can have the mirror drive with occupied space/free space of the source directory?

Karandra commented 5 years ago

Yes, that's the idea. Don't forget to also remove comments at lines 1369 and 1381. I can't test that code because I don't have Dokany 1.x at hand (I use 2.x beta for my purposes) but it should work.

jason1365 commented 4 years ago

@aquariuz23 - I've attempted to map a Ubuntu Samba share using mirror.exe as a local disk. I get it to map and all seems to work properly for a while; however, after a bit of use mirror.exe simply exits after <30 minutes without any useful messages in the debug logs. Are you able to keep the drive mounted without exiting? If so, would you mind sharing the exact version of Dokany and mirror.exe you are using? And possibly any smb.conf settings you are using that may interfere?

I'm running the latest patched Windows 10 as a VM.

You can reach me directly at pzoettj@trashmail.com. Thanks!

DanielClayton commented 4 years ago

@jason1365 did you ever get anywhere with that issue? I seem to be encountering the same one now where mirror.exe is stopping after a few minutes with no error messages.

jason1365 commented 4 years ago

@DanielClayton Basically, I dropped trying to use mirror and went with the approach defined here: https://www.reddit.com/r/DataHoarder/comments/bmmhlj/windows_rclone_rclone_browser_rclone_mount_plex/. I also added in bindfs to mount the parts of my filesystem of interest as read-only for the SSH login in use. It gets to the same end-goal for me.