Hi,
Please do not use this script, you do not need anything so drastic.
The upgrade to 3.6+ does NOT move your mailboxes around on disk. If the upgrade fails, your mailboxes will be in their original location on disk because they are supposed to be.
What 3.6+ does do (on first startup), is it rewrites your mailboxes.db to be in a new internal format. It should not fail, but it might if you have missed prerequisite steps during the upgrade process. If it does fail, your mailboxes.db might be incomplete or empty, which will make Cyrus think some/all of your mailboxes no longer exist. To reconstruct your mailboxes.db from the mailboxes on disk, use reconstruct with the "-P" option (documented in the reconstruct man page, and the 3.6.0 release notes). I also wrote about this on this list a few weeks ago, here:
The upgrading process is documented here: https://www.cyrusimap.org/3.6/imap/download/upgrade.html
From the amount of failures reported by people who have let apt upgrade Cyrus for them, I guess there's a step missing in whatever apt does. Probably it skips directly to 3.6, missing the requirement that you must first update whatever version you're currently running to its latest patch version (full details in previous link).
Once you have successfully upgraded to 3.6+, you can choose to move your existing mailboxes from the legacy storage location to the new storage location, using the "relocate_by_id" tool. If you want this, you must run this tool -- Cyrus will NOT move mailboxes around on disk without being told to.
The advice to take a full backup before proceeding is good. Though you probably want to also lock users out, not just stop SMTP delivery. Perhaps even shut Cyrus down entirely? That way you know no changes will occur during or after the backup (which could then be lost if for some reason you need to restore to the backup).
Hope this helps,
ellie
On Thu, 3 Aug 2023, at 8:32 AM, phil@xxxxxxxx wrote:
Do a full backup of your data before hand (like, stop SMTP incoming, then do a backup, then do the upgrade).Also, familiarize yourself with this:(Full disclosure, that is my repo) If the migration fails, that script and README will help you recover and migrate all of your mailboxes.