2 Custom Storage Configuration
rustmailer edited this page 2026-01-20 09:59:12 +08:00

Storage Configuration Guide (v0.3.2+)

Since version 0.3.2, Bichon allows users to independently configure the storage paths for the application root, search indices, and raw email data. This provides the flexibility to store large datasets on high-capacity drives while keeping core configurations on faster or more secure storage.


1. Directory Structure & Parameters

Bichon manages three distinct data areas. While --bichon-root-dir is always required, the other two can now be decoupled and moved.

Parameter Default Sub-folder Description Security
--bichon-root-dir (Required) Contains account credentials, system settings, and core databases. Encrypted
--bichon-index-dir /envelope Search Index Store: A Tantivy instance containing extracted metadata and server sync info. Unencrypted
--bichon-data-dir /eml Data Store: A Tantivy instance containing the actual email content (comparable to a collection of .eml files). Unencrypted

2. Configuration Examples

You can specify these paths via Command-Line Arguments or Environment Variables.

Command Line Interface (CLI)

If you move your index and data to an external drive (e.g., Drive E:), use the following syntax:

cargo run --bin bichon -- \
  --bichon-root-dir "E:\bichon-data" \
  --bichon-index-dir "E:\envelope" \
  --bichon-data-dir "E:\eml"

Environment Variables

For persistent setups, you can define these in your system environment:

  • BICHON_ROOT_DIR
  • BICHON_INDEX_DIR
  • BICHON_DATA_DIR

3. Data Migration & Flexibility

How to Relocate Existing Data

  1. Shutdown: Ensure Bichon is not running.
  2. Move: Locate the envelope and eml folders inside your current root directory.
  3. Relocate & Rename: Move them to your new target location. You may rename the folders during this process (e.g., renaming eml to mail-storage).
  4. Point: Restart Bichon using the new parameters pointing to these new paths.

Note: If you do not specify --bichon-index-dir or --bichon-data-dir, Bichon will automatically default to looking for the envelope and eml folders inside your --bichon-root-dir.


4. Backup & Security Logic

Security Note

  • Root Directory: This is the "brain" of your Bichon setup. It contains sensitive account tokens and is encrypted for your protection.
  • Index & Data Directories: These are not encrypted. They consist of a standard Tantivy search index and raw email files. They are designed as independent instances to facilitate high-speed indexing and retrieval.

Backup Strategy

To perform a complete system backup, you must back up all three specified locations:

  1. bichon-data-dir: The most critical. It contains your entire collection of emails.
  2. bichon-root-dir: Essential for maintaining your account access and app settings.
  3. bichon-index-dir: Contains the metadata index. While this is largely extracted from the email data, it also includes specific information synchronized from the mail servers.

FAQ: Storage Ratio

Q: How much disk space will the Search Index (envelope) take compared to the Data store (eml)?

A: There is no absolute ratio, but the index is typically much smaller than the data. For example, in one real-world case (see README), 145GB of email data resulted in only 1.3GB of index. The actual size depends on your email content: if your emails have many large attachments, the data store will grow much faster than the index.