This chapter describes how to list, create, remove, rename, move, and view information about mailboxes. It also describes how to find the directory location for a particular mailbox, restore expunged messages, and see how many users other than the mailbox owner have read messages in a shared IMAP folder. Specifically it describes how to use the mboxutil, hashdir, and readership utilities.
Use the "mboxutil" command to perform typical maintenance tasks on mailboxes. mboxutil tasks include the following:
List and remove orphaned and inactive mailboxes
Move mailboxes from one partition to another
Restore expunged messages that have not been purged
List personal mailbox subscriptions and unsubscribed mailboxes that no longer exist
When an end user deletes a mailbox, all messages are expunged and purged according to the value of store.cleanupage. However, expunged messages can be restored by using the mboxutil -R command, as long as you have enabled the store.mailboxpurgedelay option. Expunged messages are moved to the new location when a mailbox is renamed.
Caution:Do not kill the mboxutil process in the middle of execution. If it is killed with SIGKILL (kill -9), it may potentially require that every server get restarted and a recovery be done.
To list all mailboxes for all users:
To list all mailboxes and also include path and ACL information:
mboxutil -l -x
To create the default mailbox named INBOX for the user daphne:
mboxutil -c user/daphne/INBOX
To delete a mail folder named projx for the user delilah:
mboxutil -d user/delilah/projx
To delete the default mailbox named INBOX and all mail folders for the user druscilla:
mboxutil -d user/druscilla/INBOX
To rename the mail folder memos to memos-april for the user desdemona:
mboxutil -r user/desdemona/memos user/desdemona/memos-april
To move the mail account for the user dimitria to a new partition:
mboxutil -r user/dimitria/INBOX user/dimitria/INBOX partition
where partition specifies the name of the new partition.
To move the mail folder named personal for the user dimitria to a new partition:
mboxutil -r user/dimitria/personal user/dimitria/personal partition
By default, mailboxes are created in the primary partition. If the partition gets full, additional messages cannot be stored. There are several ways to address the problem:
Reduce the size of user mailboxes
If you are using volume management software, add additional disks
Create additional partitions ("To Add a Message Store Partition") and move mailboxes to the new partitions
If possible, add additional disk space to a system using volume management software because this procedure is the most transparent for the user. However, you might also move mailboxes to a different partition.
To move mailboxes to a different partition using the mboxutil command:
Create an input file of the mailboxes to be moved.
The input file must consist of pairs of duplicate lines, because the other use of mboxutil -r is to rename folders. Thus, the first line of each pair is the old folder name and the second line is the new folder name. In the case of moving a user from one partition to another, the folder names are the same. Here is an example input file, mvusers, for three users:
firstname.lastname@example.org/inbox email@example.com/inbox firstname.lastname@example.org/inbox email@example.com/inbox firstname.lastname@example.org/inbox email@example.com/inbox
Move the users to a new partition called pool4:
mboxutil -r -f /tmp/mvtest pool4 rename firstname.lastname@example.org/inbox to email@example.com/inbox rename firstname.lastname@example.org/inbox to email@example.com/inbox rename firstname.lastname@example.org/inbox to email@example.com/inbox
Note:If an error occurs with any individual mailbox move, the mboxutil command continues processing the rest of the input file. Thus, you must review the output (and possibly the default log file) to determine if any mailbox moves failed. Be sure to save that output.
To search for orphaned accounts (orphaned accounts are mailboxes that do not have corresponding entries in LDAP) use the following "mboxutil" commands:
Command output follows:
mboxutil: Start checking for orphaned mailboxes user/annie/INBOX user/oliver/INBOX mboxutil: Found 2 orphaned mailbox(es) mboxutil: Done checking for orphaned mailboxes
Use the following command to create a file listing orphaned mailboxes that can be turned into a script file that deletes the orphaned mailboxes (example filename is orphans.cmd):
mboxutil -o -w orphans.cmd
The command output is as follows:
mboxutil: Start checking for orphaned mailboxes mboxutil: Found 2 orphaned mailbox(es) mboxutil: Done checking for orphaned mailboxes
Delete the orphan files with the following command:
mboxutil -d -f orphans.cmd
The mailboxes in the message store are stored in a hash structure for fast searching. Consequently, to find the directory that contains a particular user's mailbox, use the "hashdir" utility.
This utility identifies the directory that contains the message store for a particular account. This utility reports the relative path to the message store, such as d1/a7/. The path is relative to the directory level just before the one based on the user ID. The utility sends the path information to the standard output.
For example, to find the relative path to the mailbox for user crowe:
An owner of a IMAP folder may grant permission for others to read mail in the folder. A folder that others are allowed to access is called a shared folder. Administrators can use the readership utility to see how many users other than the owner are accessing a shared folder.
This utility scans all mailboxes and produces one line of output per shared folder, reporting the number of readers followed by a space and the name of the mailbox.
Each reader is a distinct authentication identity that has selected the shared folder within the past specified number of days. Users are not counted as reading their own personal mailboxes. Personal mailboxes are not reported unless there is at least one reader other than the folder's owner.
For example, the following command counts as a reader any identity that has selected the shared IMAP folder within the last 15 days:
readership -d 15