Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Recently my computer had to be hard-reset, and fsck ran on /home filesystem, producing lots of errors (old HDD drive).

After reset I don't see all my saved emails in KMail (KDE 3.5.3), at least those that were present in folder that was opened when computer crashed. The files are there physically in ~/Mail/folder/cur, but they are not visible in KMail component of Kontact.

The configuration files got damaged -- beside not seeing all saved emails, I have lost configuration of all my email accounts.

Is it possible to fix KMail configuration to make those saved emails visible again?

Nb. I have month old backup, so KMail config should be recoverable.

share|improve this question

The solution I used (and it worked... somewhat) was to copy ~/Mail/Folder to ~/Mail/Folder.save. When starting KMail (or to be more accurate Kontact with KMail plugin / part) it scanned ~/Mail directory and shown 'Folder.save'. After clicking on 'Folder.save' I can now see all my saved (archived) email.

Longer story:

I recovered KMail config from backup (~/.kde/share/config/kmailrc), first saving current (broken) config, just in case.

Now what is strange that when starting KMail it apparently re-scanned ~/Mail directory, and it shown correct number of saved emails: 3000+... but when I clicked on folder (or when downloading new emails) KMail shown only 700 emails (with broken threading).

I have noticed that KMail shows folders which were absent in backed up version, soe it has to scan ~/Mail directory for mail folders. I have copied mail folder, and strangely, even though both folders had the same number of files, and the same files, 'Folder' shows 700 emails, 'Folder.save' shows 3000 emails.


share|improve this answer

From an abstract standpoint, your problem seems to be that there were files open (and being written to) on your filesystem at the point when the computer crashed. So, basically, it is possible that all kinds of data corruption show up with these files, and you should not make any assumptions about their state / completeness / correctness of their contents.

The first step when dealing with this sort of errors is always not to do too much work on the damaged file system. Copy it to another hard drive (or several) and work on those, keeping your original intact in case more involved methods become necessary.

Do you store your mails in maildir format? If so, just take a look at the mail directory with a different mail program. Most offer to import Mails from such a directory. If that works, fine -- just some KMail-internal stuff got damaged. Recreate your KMail config and import the mail from the mail directory.

If not, I'd start to take a look at whatever is left in your mail storage (using plain text editors) and assess if the mails really are missing or just appear to be missing. If you can't find everything that should be there, just restore from your backups -- everything beyond this stage will be serious, hard work.

share|improve this answer
It is strange that KMail didn't use "atomic write" (write copy and rename)... though I am not sure if it would matter (the filesystem in question is ext3). Anyway, emails (in maildir format) are there - I have checked most recent file in ~/Mail/folder/cur and it is most recent email... nut it is not visible in KMail. – Jakub Narębski Aug 3 '11 at 19:10
OK, so, pragmatically: Create a full backup of your stuff, move your old mail folder to some temp folder, and just try re-importing. – jstarek Aug 3 '11 at 21:17

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.