user mailbox DiskSpace calculation | MDaemon Technologies Community Forum

user mailbox DiskSpace calculation


  • Hello, 

    Does someone knows how the user mailbox disk space calculation is done / when it's done in mdaemon ? 

    When I get the data from the XML API, the mailbox <DiskSpace>14692652032</DiskSpace> value is not exaclty the same as the value I get when calculating the folder space usage in windows.

    Thanks in advance



  • MDaemon stores cached quota values in the mailbox's hiwater.mrk file.  Normal mail activity throughout the day will adjust the counts.  There is a setting to recalculate all quota values once per day, during nightly maintenance (Setup | Account Settings | Quotas | Recalculate all quota values once per day). If quota counts are regularly getting out of sync this will help, but it can also put a large load on your server during the nightly maintenance. 

    Things like AccountPrune.exe, powershell scripts, or anythign else that acts on your mailbox outside of MDaemon can cause quota counts to be wrong.  

    Also on the same dialog make sure you have "Include all email folders in quota calculation" and "include Calendar, Contacts, Tasks, Dcoumentation folders as well" both checked.

    Hidden files can also skew the counts.  You shouldn't have any but just to be sure run the following command in the mailbox directory:

    dir /a:h /s 

    When MDaemon calculates the quotas it intentionally ignores the WC and _ActiveSync directories and it ignores *.MRK, *.LCK, *.RTE, and Quota.msg files.  

    You can get the size of the WC directory by running:

    dir "<maildir>\WC" /s /a

    You can get the size of the _ActiveSync directory by running:

    dir "<maildir>\_ActiveSync" /s /a

    To get the size of all MRK, LCK, and RTE files run this powershell script (be sure to update $MailDir first):

    $MailDir = 'C:\MDaemon\Users\domain.com\user\'
      Get-ChildItem -Path $MailDir -Recurse -Force -Include *.mrk,*.lck,*.rte -File |
          Measure-Object -Property Length -Sum |
          Select-Object @{n='Files';e={$_.Count}}, @{n='Bytes';e={$_.Sum}}, @{n='MB';e={[math]::Round($_.Sum/1MB,2)}}

    On my test account the quota shown by MDaemon was 75 MB lower than what was being shown by Windows.  When I removed all of the items MDaemon excluded it was almost spot on. 

    Both MDaemon and Windows are using a 1024 base to convert bytes to MB.

    Let me know if you have any other questions.


  • Thanks Arron, 

    I did the calculation and indeed on a 15GB user folder the difference between the data from XML API + 'exlcuded' files from Mdaemon calculation is 45MB -> insignifiant.

    That's great

    Is there a command that could be run to recalculate user quota but less 'aggressivley'. We could write a script to recalculate all users mailboxes over a month (during night maintenance) ?

    Thanks


  • You can clear the quota cache 1 user at a time by creating a clearquotacounts.sem file in the MDaemon\app directory.  Put the email address of the user that you want to clear the cache for on the first line of the body. If you put an * on the first line, it will clear the cache for all users.  If you want to clear the cache for multiple users put one email address per line.

    MDaemon will detect the file and clear the cache for the user after about 10 seconds and it should very shortly after that repopulate the numbers in the hiwater.mrk file.  How long it takes to repopulate the numbers will depend on how long it takes to recalculate the numbers.

    For more information on semaphore files please see https://help.mdaemon.com/MDaemon/en/semaphore_files.html

    Regarding the clearquotacounts.sem file in the help it mentions quotacounts.dat file, this is no longer used.  The data is now stored in each user's hiwater.mrk file.  I've asked our documentation team to correct the help file.


Please login to reply to this topic!