The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How to remove old maildir files after upgrade?

Discussion in 'E-mail Discussions' started by WebHostPro, Jul 7, 2017.

Tags:
  1. WebHostPro

    WebHostPro Well-Known Member
    PartnerNOC

    Joined:
    Jul 28, 2002
    Messages:
    1,612
    Likes Received:
    11
    Trophy Points:
    318
    Location:
    LA, Costa RIca
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hi,

    I've changed my server email to MDBOX. And chose the option to leave the old email in case of an error during the transition. Now that I have MDBOX working. How can I remove the old emails that used MAILDIR?

    Thank you for your help.
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    37,171
    Likes Received:
    1,295
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello @WebHostPro,

    You can delete the old email by running the conversion script again, but with the "--delete-old-format" flag. EX:

    Code:
    /usr/local/cpanel/scripts/convert_maildir_to_mdbox --user=$username --delete-old-format
    Thank you.
     
  3. WebHostPro

    WebHostPro Well-Known Member
    PartnerNOC

    Joined:
    Jul 28, 2002
    Messages:
    1,612
    Likes Received:
    11
    Trophy Points:
    318
    Location:
    LA, Costa RIca
    cPanel Access Level:
    Root Administrator
    Twitter:
    Well, that's easy. Thanks!
     
    cPanelMichael likes this.
  4. WebHostPro

    WebHostPro Well-Known Member
    PartnerNOC

    Joined:
    Jul 28, 2002
    Messages:
    1,612
    Likes Received:
    11
    Trophy Points:
    318
    Location:
    LA, Costa RIca
    cPanel Access Level:
    Root Administrator
    Twitter:
    Sorry just ran the code:

    /usr/local/cpanel/scripts/convert_maildir_to_mdbox --user=$username --delete-old-format

    And it just pulls up the help files for the convert_maildir_to_mdbox script. Like something is missing.

    I am trying to do this for the whole server not jut one account or email. I assume the error is because it wants a username.
     
  5. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    37,171
    Likes Received:
    1,295
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    This script is only usable on a per-account or per-email-account basis. I suggest running the command with a single cPanel account to verify it works as expected. You could then run a custom bash command that loops all cPanel users to the script if you'd like to run it on all accounts. Let me know if you need any help with this.

    Thank you.
     
  6. WebHostPro

    WebHostPro Well-Known Member
    PartnerNOC

    Joined:
    Jul 28, 2002
    Messages:
    1,612
    Likes Received:
    11
    Trophy Points:
    318
    Location:
    LA, Costa RIca
    cPanel Access Level:
    Root Administrator
    Twitter:
    Yeah, that's tricky.

    Can I convert it back to maildir and then back to mdbox without choosing to save the old email files. Is it risky to convert it back to mail dir?

    Odd they would have the option to save old files but not a way to remove them via batch.
     
  7. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    37,171
    Likes Received:
    1,295
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello,

    Yes, you can convert the mailboxes back to the Maildir format, and then convert to the Mdbox format again with "Keep old mailbox files." unchecked. I confirmed this works as expected on a test system, but account backups are always recommended in-case something goes wrong during the conversion process (e.g. drive failures, network/connection issues).

    Thank you.
     
  8. did-vmonroig

    did-vmonroig Active Member

    Joined:
    Feb 6, 2012
    Messages:
    34
    Likes Received:
    0
    Trophy Points:
    56
    cPanel Access Level:
    Root Administrator
    Hello.

    If I understand correctly, if the user mailboxes are already in mdbox format, this just deletes old maildir backup, isn't it?
     
  9. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    37,171
    Likes Received:
    1,295
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Yes, that is correct.

    Thank you.
     
    did-vmonroig likes this.
Loading...

Share This Page