Skip to content

Migrating from MailArchiva#

This documentation applies to Piler enterprise edition 2.1.0

Revision #1

Publication date: 2025-DEC-12

Overview#

MailArchiva provides a built-in volume export feature that outputs emails in EML or MBOX format. This guide walks you through the self-service export process and importing into Piler.

Prerequisites#

  • MailArchiva administrator access
  • Sufficient disk space for export (roughly equal to your archive size)
  • Network or USB storage for transferring data to Piler server

Step 1: Export from MailArchiva#

Access the Admin Interface#

  1. Log into the MailArchiva web interface
  2. Use an administrator account
  1. Go to Configuration in the main menu
  2. Click Volumes
  3. Select the volume(s) you want to export
  4. Click Export Data

Configure Export Settings#

  1. Format: Select EML (RFC 2822)
  2. EML is the standard format Piler accepts
  3. MBOX is also supported if preferred

  4. Date Range (if available):

  5. Select full range for complete migration
  6. Or filter by date for partial migration

  7. Destination: Choose export location

  8. Network share for large archives
  9. Local storage if transferring via USB

  10. Click Export to begin

Monitor Export Progress#

  • MailArchiva displays progress during export
  • Large archives may take several hours
  • Ensure sufficient disk space throughout the process

Step 2: Transfer to Piler Server#

Option A: Network Share#

If Piler server can access the export location:

# Mount network share
mount -t cifs //server/mailarchiva-export /mnt/import -o username=user,password=pass

# Or NFS
mount -t nfs server:/export/mailarchiva /mnt/import

Option B: rsync (Remote transfer)#

# Transfer with resume support
rsync -avz --progress /path/to/mailarchiva-export/ piler-server:/var/piler/import/

# Resume interrupted transfer
rsync -avz --progress --partial /path/to/mailarchiva-export/ piler-server:/var/piler/import/

Option C: Physical Media#

For large archives, USB drives are often fastest:

  1. Copy export to USB drive
  2. Connect to Piler server
  3. Mount and import directly

Step 3: Import into Piler#

Set Permissions#

chown -R piler:piler /var/piler/import/

Import EML Files#

pilerimport -dir /var/piler/import/mailarchiva-export \
  -tenantid fictive \
  -workers 8 \
  -progress

Import MBOX File (if exported as MBOX)#

pilerimport -mbox /var/piler/import/mailarchiva-export.mbox \
  -tenantid fictive \
  -workers 8 \
  -progress

For Large Archives#

Increase worker count for better throughput:

pilerimport -dir /var/piler/import/mailarchiva-export \
  -tenantid fictive \
  -workers 16 \
  -progress

With Automatic Cleanup#

pilerimport -dir /var/piler/import/mailarchiva-export \
  -tenantid fictive \
  -workers 8 \
  -progress \
  -remove

Step 4: Verify Migration#

Review Import Statistics#

After import completes:

Import completed:
  Processed:  850,000
  Success:    830,000
  Duplicates:  18,000
  Failed:       2,000

Verify in Piler UI#

  1. Log into Piler web interface
  2. Search for emails across different date ranges
  3. Verify attachments are accessible
  4. Confirm all expected mailboxes appear in search results

Investigate Failures#

If files failed to import:

  • Check for corrupted EML files
  • Review file permissions
  • Check Piler logs:

docker logs piler 2>&1 | grep -i error

or

journalctl -xeu piler | grep -i error

Troubleshooting#

Export option not visible#

  • Ensure you have administrator privileges
  • Check MailArchiva license includes export feature
  • Contact MailArchiva support if export is disabled

"Permission denied" during import#

chown -R piler:piler /var/piler/import/
chmod -R 644 /var/piler/import/*.eml

Slow import performance#

  • Increase workers: -workers 16
  • Use SSD storage for import directory
  • Ensure database server has adequate resources

High duplicate count#

Normal behavior - MailArchiva may have stored the same email multiple times (e.g., sent to multiple recipients). Piler deduplicates automatically without using extra storage.

Encoding issues with filenames#

If EML files have special characters in names:

# Rename files to safe names
cd /var/piler/import/mailarchiva-export
find . -name "*.eml" -exec rename 's/[^a-zA-Z0-9._-]/_/g' {} \;

MBOX import fails#

If MBOX file is corrupted or malformed:

  1. Try splitting into smaller files
  2. Convert to individual EML files using a tool like mb2md
  3. Import the EML files instead

Cleanup#

After verifying successful migration:

# Remove imported files
rm -rf /var/piler/import/mailarchiva-export/

# Unmount network share if used
umount /mnt/import

Reference#