As of gromox 3.3 you can export and import complete mailboxes w/o going the extra mile.
man gromox-export
# gromox-export --help
Usage: gromox-export [-prst] [-Y ARG] [-u EMAILADDR] [--ical] [--loglevel=N]
[--mail] [--mt] [--tnef] [--vcard] [-?|--help] [--usage]
-Y ARG Allday emission mode (default=-1, YMDHMS=0, YMD=1)
-p Show properties in detail (if -t)
-r Export folders recursively
-s Splice objects into existing store hierarchy
-t Show tree-based analysis of the archive
-u EMAILADDR Username of store to export from
--ical Export as calendar object
--loglevel=N Basic loglevel of the program
--mail Export as RFC5322 mail
--mt Export as Gromox mailbox transfer format
--tnef Export as TNEF object
--vcard Export as vCard object
-?, --help Show this help message
--usage Display brief usage message
man gromox-import
# gromox-import --help
Usage: gromox-import [-Dcptvx] [-B NAME] [-u EMAILADDR] [--loglevel=N]
[--repeat=N] [--skip-notif] [--skip-rules] [-2|--twostep] [--autoproc]
[-?|--help] [--usage]
-B NAME Placement position for unanchored messages
-D Use delivery mode
-c Continuous operation mode (do not stop on errors)
-p Show properties in detail (if -t)
-t Show tree-based analysis of the archive
-u EMAILADDR Username of store to import to
-v Be more verbose
-x Disable O_EXCL like behavior for non-spliced folders
--loglevel=N Basic loglevel of the program
--repeat=N For testing purposes, import each message N times
--skip-notif Skip emission of notifications (if -D)
--skip-rules Skip execution of rules (if -D)
-2, --twostep TWOSTEP rule executor (implies -D; development)
--autoproc Perform meeting request processing (development)
-?, --help Show this help message
--usage Display brief usage message
I'm still playing around but what worked here so far is the following.
gromox-export
export all mailboxes with the complete folder-structure to zstd-compressed files (to save some space)
gromox-mbop foreach.mb echo-username | while read -r username;
do echo "$username";
gromox-export -u "$username" --mt -s -r / |
pv -r -a -K -c |
zstd -o "$username".mt.zstd ;
done
the pv call needs some changes but at least some progress to see something is happening
gromox-import
here i created just a new user to test the import which looked good so far
e.g. i could log in and see mails ^_^
zstdcat cb@clownflare.de.mt.zstd |gromox-import -u cbtest@clownflare.de -v
Happy backup and restore!
NOTES
This import even fixed a problem i had with my rsync-imported mailbox as the new user doesn't get any error-messages anymore.
I'm guessing either the ex/ or import just discarded any problematic entries that couldn't be looked up.
Which means if you have a f00ded up mailbox for some reason this could help you in fixing problems you won't be able to solve via any gromox-mbop* or other gromox-* tool 🤔
EDIT: What items i'm talking about? Well these missing one's i would say.
gromox-mbsize /var/lib/gromox/user/clownflare.de/cb/ |grep -e FS: -e Missing
== FS: Body analysis ==
Missing items 174 174
== FS: Attachment analysis ==
Missing items 70 37
gromox-mbsize /var/lib/gromox/user/clownflare.de/cbtest |grep -e FS: -e Missing
== FS: Body analysis ==
Missing items 0 0
== FS: Attachment analysis ==
Missing items 0 0
direct clone of a mailbox
grommunio-admin user create cbtest@clownflare.de
gromox-export --loglevel=5 -u cb@clownflare.de --mt -s -r IPM_SUBTREE | gromox-import --loglevel=5 -x -c -u cbtest@clownflare.de
@jengelh maybe you have some notes?