DOVEADM-ALTMOVE(1)

πŸ’– DOVEADM-ALTMOVE πŸ’–

okay so bestie, we're doing the doveadm-altmove page, which is part of doveadm(1) in the Dovecot fam. she's a little niche but she's so useful, i promise.


✨ NAME ✨

doveadm-altmove β€” move matching mails to the alternative storage (dbox-only, so don't come here with your mbox nonsense, she's exclusive πŸ’…)


🌸 SYNOPSIS 🌸

doveadm [GLOBAL OPTIONS] altmove [-r] [-S socket_path] -A search_query

doveadm [GLOBAL OPTIONS] altmove [-r] [-S socket_path] -F file search_query

doveadm [GLOBAL OPTIONS] altmove [-r] [-S socket_path] --no-userdb-lookup search_query

doveadm [GLOBAL OPTIONS] altmove [-r] [-S socket_path] -u user search_query

like, four whole fits and she serves in every single one πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

so the tea is: this command works with sdbox or mdbox storage, and it moves mails over to the alternative storage path β€” but ONLY if mail_alt_path is actually specified for the mail location. no path, no move, that's the rule 🫢

and here's how the four forms go, because the way she reads who she's doing this for is literally different every time:

  • first form β€” doveadm(1) runs the altmove for ALL the users. everyone. the whole server. group chat, no exclusions.
  • second form β€” the command gets performed for all users listed in the given file.
  • third form β€” the command gets performed for the user sitting inside the USER environment variable.
  • last form β€” only the matching mails of the given user(s) get moved to the alternative storage.

πŸ‘‘ GLOBAL OPTIONS πŸ‘‘

the global doveadm(1) options, aka the ones that apply everywhere:

  • -D β€” turns on verbosity AND debug messages. she's chatty now, she's telling you everything.
  • -O β€” do NOT read any config file, just roll with defaults. the dovecot_storage_version setting defaults to the latest version, but you can override it with -o.
  • -k β€” preserve the entire environment for doveadm, not just the import_environment setting. keeping the whole vibe intact, no cap.
  • -v β€” enables verbosity, including the progress counter. numbers go up, serotonin goes up.
  • -i instance-name β€” if you're running multiple Dovecot instances, this picks which config file to use based on the instance name. peep the instance_name setting for more info.
  • -c config-file β€” read the configuration from the given config-file. by default it first reads the config socket, then falls back to /etc/dovecot/dovecot.conf. you can also point this at the config socket of some instance running a compatible version.
  • -o setting=value β€” overrides the configuration setting from /etc/dovecot/dovecot.conf and from the userdb with the given value. wanna override multiple settings? just stack the -o option as many times as you want. iconic behavior.

πŸŽ€ OPTIONS πŸŽ€

  • -A β€” if -A is present, the command gets performed for all users. > bestie, lowkey a warning: using this together with system users from userdb { driver = passwd } is NOT recommended, because that thing also contains users with a lower UID than the one configured with the first_valid_uid setting. πŸ‘€

when the SQL userdb module is in play, make sure the userdb_sql_iterate_query setting matches your database layout.

when you're using the LDAP userdb module, make sure the userdb_fields setting and the userdb_ldap_iterate_fields setting match your LDAP schema. otherwise doveadm(1) will be unable to iterate over all users. she's stuck. she's sad. don't do that to her. 😭

  • -F file β€” execute the command for all the users in the file. it's like -A but instead of pulling the user list from the userdb, she reads them from the given file. one username per line, periodt.
  • --no-userdb-lookup β€” do not perform a userdb lookup. use the USER environment variable to specify the username instead.
  • -r β€” with -r given, this command works the other way round. mails get moved from the alternative storage back to the default mail location. rewind, reverse, rewind πŸ¦‹
  • -S socket_path β€” the argument is either an absolute path to a local UNIX domain socket, or a hostname and port (hostname:port), so you can connect to a remote host via a TCP socket.

this lets an administrator execute doveadm(1) mail commands through the given socket. remote queen energy.

  • -u user/mask β€” run the command only for the given user. you can also use '*' and '?' wildcards, e.g. -u *@example.org. slay.

πŸ’œ ARGUMENTS πŸ’œ

  • search_query β€” messages matching this search query get moved to alt storage. peep doveadm-search-query(7) for the details, she explains the whole grammar.

πŸ“ FILES πŸ“

  • /etc/dovecot/conf.d/10-mail.conf β€” mailbox locations and namespaces. that's where the vibes live.

⭐ EXAMPLE ⭐

okay this example moves seen mails older than one week to alternative storage under /nfsmount:

mail_driver = mdbox
mail_path = ~/mdbox
mail_alt_path = /nfsmount/%{home}/mdbox

doveadm altmove -u johnd@example.com seen savedbefore 1w<

see how seen and savedbefore 1w< are doing all the work? that's the search query carrying the entire team πŸ’…


πŸ™ˆ REPORTING BUGS πŸ™ˆ

found a bug? report it β€” and please include your doveconf -n output β€” to the Dovecot Mailing List ⟨dovecot@dovecot.org⟩. info about reporting bugs lives at: ⟨https://dovecot.org/bugreport.html⟩

she's not mad, she just wants the config dump. help her help you 🫢


🌈 SEE ALSO 🌈


that's the whole page bestie, you ate it πŸ’– stay hydrated, back up your mdbox, and remember: alt storage is not a personality, it's a path ✨

f979264 β€” April 2026 β€” Dovecot πŸŽ€ (yeah that's the version stamp and the date, screenshot it, put it in the group chat, whatever, mwah 😘)

πŸ“¦ where this page comes from