How to remove old maildir files after upgrade?
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.
-
Hello @WebHostPro, You can delete the old email by running the /usr/local/cpanel/scripts/convert_maildir_to_mdbox --user=$username --delete-old-format
Thank you.0 -
Well, that's easy. Thanks! 0 -
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. 0 -
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.
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.0 -
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. 0 -
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. 0 -
Hello @WebHostPro, You can delete the old email by running the
/usr/local/cpanel/scripts/convert_maildir_to_mdbox --user=$username --delete-old-format
Thank you.
Hello. If I understand correctly, if the user mailboxes are already in mdbox format, this just deletes old maildir backup, isn't it?0 -
If I understand correctly, if the user mailboxes are already in mdbox format, this just deletes old maildir backup, isn't it?
Yes, that is correct. Thank you.0 -
Just for convenience, here is a script that removes all backups from all users: #!/bin/bash cd /var/cpanel/users for user in * do /usr/local/cpanel/scripts/convert_maildir_to_mdbox -user=$user -delete-old-format done
FYI, the quota usage is doubled for all users after conversion if you choose to keep old format as backup.0 -
I converted several accounts on the server using WHM interface, keeping the old files. As everything seems ok, can I run the process again in WHM to delete the old files? Or I should do it on the command line? 0 -
I converted several accounts on the server using WHM interface, keeping the old files. As everything seems ok, can I run the process again in WHM to delete the old files? Or I should do it on the command line?
Hello, You will need to use the command line if you've already converted the mailboxes for the accounts, as WHM will only list accounts that have not yet been converted to the mdbox format. Thank you.0
Please sign in to leave a comment.
Comments
11 comments