Please see https://doc.dovecot.org/admin_manual/migrating_mailboxes/

Aki

-------- Original message --------
From: tseegerkrb@gmail.com
Date: 6/8/23 16:10 (GMT+02:00)
To: dovecot@dovecot.org
Subject: Migration dovecot server with local users to dovecot with virtual mailboxes

Hello,
we are using a dovecot server with NIS, we want to transfer it to a new setup. As backend a mysql server will be used in the future.
My problem is, if I just copy the maildir or use "doveadm import" all mails are flagged as "unseen". How can i preserve the flags?

This is how I have tried it so far.
root@mail / $ doveadm import -s -u testuser@testdomain.local maildir:/tmp/testuser-maildir-230608/Maildir/:INDEX=MEMORY "" "All"

As a "workaround" I tried to change the flags.
root@mail / $ doveadm -v flags add -u testuser@testdomain.local "Seen" "ALL"
This led partially to the desired success, the mails are shown as "seen", but the folders (e.g. Roundcube) still show unread mails.

dovecot -n
############################################
# 2.3.13 (89f716dc2): /etc/dovecot/dovecot.conf
# Pigeonhole version 0.5.13 (cdd19fe3)
# OS: Linux 5.10.0-23-cloud-amd64 x86_64 Debian 11.7
# Hostname: mail.testdomain.local
auth_mechanisms = plain login
mail_fsync = always
mail_gid = vmail
mail_home = /var/vmail/mailboxes/%d/%n
mail_location = maildir:~/mail:LAYOUT=fs:INDEX=MEMORY
mail_privileged_group = vmail
mail_uid = vmail
managesieve_notify_capability = mailto
managesieve_sieve_capability = fileinto reject envelope encoded-character vacation subaddress comparator-i;ascii-numeric relational regex imap4flags copy include variables body enotify environment mailbox date index ihave duplicate mime foreverypart extracttext imapsieve vnd.dovecot.imapsieve
mmap_disable = yes
namespace inbox {
  inbox = yes
  location =
  mailbox Drafts {
    auto = subscribe
    special_use = \Drafts
  }
  mailbox Sent {
    auto = subscribe
    special_use = \Sent
  }
  mailbox Spam {
    auto = subscribe
    special_use = \Junk
  }
  mailbox Trash {
    auto = subscribe
    special_use = \Trash
  }
  prefix =
}
passdb {
  args = /etc/dovecot/dovecot-sql.conf
  driver = sql
}
plugin {
  imapsieve_mailbox1_before = file:/var/vmail/sieve/global/learn-spam.sieve
  imapsieve_mailbox1_causes = COPY
  imapsieve_mailbox1_name = Spam
  imapsieve_mailbox2_before = file:/var/vmail/sieve/global/learn-ham.sieve
  imapsieve_mailbox2_causes = COPY
  imapsieve_mailbox2_from = Spam
  imapsieve_mailbox2_name = *
  quota = maildir:User quota
  quota_exceeded_message = User %u has exhausted allowed storage space.
  sieve = file:/var/vmail/sieve/%d/%n/scripts;active=/var/vmail/sieve/%d/%n/active-script.sieve
  sieve_before = /var/vmail/sieve/global/spam-global.sieve
  sieve_global_extensions = +vnd.dovecot.pipe
  sieve_pipe_bin_dir = /usr/bin
  sieve_plugins = sieve_imapsieve sieve_extprograms
}
protocols = imap lmtp sieve
service auth {
  unix_listener /var/spool/postfix/private/auth {
    group = postfix
    mode = 0660
    user = postfix
  }
  unix_listener auth-userdb {
    group = vmail
    mode = 0660
    user = vmail
  }
}
service imap-login {
  inet_listener imap {
    port = 143
  }
  process_min_avail = 1
  service_count = 1
}
service lmtp {
  unix_listener /var/spool/postfix/private/dovecot-lmtp {
    group = postfix
    mode = 0660
    user = postfix
  }
  user = vmail
}
service managesieve-login {
  inet_listener sieve {
    port = 4190
  }
}
ssl = required
ssl_ca = </etc/dovecot/private/ca-testdomain.local_tls_srv_crt.crt
ssl_cert = </etc/dovecot/private/mail.testdomain.local_tls_srv_crt.crt
ssl_cipher_list = ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384
ssl_dh = # hidden, use -P to show it
ssl_key = # hidden, use -P to show it
ssl_min_protocol = TLSv1.2
userdb {
  args = /etc/dovecot/dovecot-sql.conf
  driver = sql
}
protocol imap {
  imap_idle_notify_interval = 29 mins
  mail_max_userip_connections = 20
  mail_plugins = " quota imap_quota imap_sieve"
}
protocol lmtp {
  mail_plugins = " sieve notify push_notification quota"
  postmaster_address = postmaster@testdomain.local
}
############################################

Thanks for your help
_______________________________________________
dovecot mailing list -- dovecot@dovecot.org
To unsubscribe send an email to dovecot-leave@dovecot.org