mail_data.dat temp file is bloating my C drive

My C drive is purposely lean with only OS and program files. I always store my data on my E drive. I have my eM Client storage files on my E drive and I have my backups of eM Client also pointing to my E drive.

I tried to run a manual backup and it didn’t work saying disk was full. There 35 gigs of space on my E drive. I checked my C drive and last I checked it had about 16 gigs of space. I then found that eM Client created some huge temp files, maybe this was because I ran the backup.  They were stored here:

C:\Users\xxxxxxx\AppData\Local\Temp\eM Client temporary files\zi1151vt\dbfc0a97-32c8-4af6-b376-66012fa4938f

mail_data.dat on my E drive is about 30 gigs. mail_data.dat as a temp file on my C drive is 16 gigs and another one is 3 gigs. Are these temp files created only during the backup procedure? Is there a way to have these temp files be created on my E drive? If I have to I can make my C drive larger, if that’s my only option. I have 20 gigs of these temp files. Can I delete them?

When I run database repair (DbRepair.exe) does it also create huge temp files? Lately I have lots of trouble with that file running automatically. Once for 42 min

There was a question a couple of months back where a user had a non-traditional setup using a RAM disk for his temp folder. He was also experiencing this problem with \Temp\eM Client temporary files\ contents becoming quite large.

Here is the link https://forum.emclient.com/emclient/topics/running-out-of-disk-space

I checked out the other thread. Are you saying that I can reroute the temp files to my larger E drive? Why am i getting more than 1 mail_data.dat file? Should that also be created in the temp file location? I have 20 gigs of these temp files. Can I delete them? Is manually running Menu/File/Backup creating these huge mail_data.dat  temp files?

Well changing the temp location is certainly an option if space is an issue.

I tried to reproduce Dimitri’s problem but was never able to get a \Temp\eM Client temporary files\ folder anywhere.

What version of eM Client and Windows are you using?

Win 10 version 1607. eM 7.1.31849.0 (latest)  Last night that folder had 20 gigs in it. In my storage folder on my E drive it’s about 30 gigs in size with 2 mail_data.dat files, one about 27 gigs the other about 3 gigs.

This morning when I booted my computer I got a message from eM Client says that diagnostic logging has been on for 3 days and it takes up a lot of disk space and asked if I’d like to disable it. I said yes. EM Client started fine.

 I then checked that same temp folder and found that it only had a few megs and only 3 PDF files that came as email attachments and I had opened yesterday. 

To my knowledge I didn’t turn on diagnostic logging, yet for several days I’ve had lots of instability. Possibly because I imported lots of LiveMail and Outlook express EML files and maybe didn’t wait long enough after closing eM Client to shut down my computer. I suppose importing lots of files may give eM Client more work to do after shut down.

Last night I let it go at least 5 min before shutting down and was very pleased to not get the database check come up which once lasted 42 min. A lot of my latest problems came when I tired to create a manual backup and it failed each time saying there was not enough disk space. I was down to about 8 megs on my C drive due to those huge temp files and then created about 1.5 gigs of space. 

So it appears that diagnostic logging was already going on when I tried to backup and I’m assuming that’s why the backup failed. Do yo think it’s safe to try a manual backup again. I have 20 gigs of space on my C drive.

That is interesting about the diagnostic data. I certainly would not have expected it to take up so much space.

My backups are about 30% the size of my database directory, and I do not backup to the default My Documents location, but to another drive.

I tried Menu/File/Backup and watched the folders to see what was happening. Immediately the temp file folder that was very small started filling up at an alarming rate. I moved files from C to E, so C wouldn’t run out of space. At the very end C had 2.2 gigs of space left and the backup was compressing for about 30 min. E had 20 gigs of space, but the backup failed eventually, saying there was no enough disk space.

 I know you said your backups have been about 1/3 the size of your database and my database is 30 gigs. So I I would expect the my backup would be about 10 gigs. So one would think that 20 gigs should have been enough space, but not so. I suppose if I had 30 gigs or more space on E at the time maybe it would have worked.

 If you have any more insight on this, please let me know. I’d suggest letting the programmers know what happened, so maybe they could make some improvements in the backup creation. I wonder if eM Client had been closed while I was running the backup if it wouldn’t have felt it was necessary to make all those temp files. I did retrieve emails during the backup process, so this is something to consider and ask the programmers.

I successfully used the backup feature in EM Client. I first resized my C drive partition to 30 gigs larger. During the backup the temp files got about as  large as my database which is 29.6 gigs and the zip  file backup is 25.0 gigs. My E drive had about 32 gigs of space.

This time I didn’t use eM Client while the backup was going on. It was open just idle. I took about 2 hours to backup  

It is quite a large database, so I would expect it to take some time. If you are using a mechanical hard disk instead of an SSD, that could also account for how long it takes. Free disk space is also an issue, and that your C: drive essentially had zero free space during the operation is of concern. If you are using a mechanical drive, the old rule was there should always be 15% of the drive free at any time. I think with SSDs the amount of free space to have optimum performance is larger - probably 25%. I have seen different opinions on this. If you are using a single disk that is partitioned, you may find better performance by combining the partitions into one large partition.

The compression ratio has to do with content, so that will be different with everyone. I personally don’t keep many attachments in eM Client, so just like normal text files, my database compresses quite well.

You should be able to continue using eM Client during the backup but another option is to do it manually. All the backup option does is create a compressed archive of C:\Users_username_\AppData\Roaming\eM Client. From version 7.1 on that can be done while eM Client is running. Previously eM Client had to close for the backup to take place. But to do it manually, you need to close eM Client, then zip your database directory using your preferred zip application. Of course with this method you cannot use the restore function in eM Client, so would have to do that manually as well.

If you have setup an automatic backup, eM Client does not have to be open for the backup to take place, and it can be scheduled for a time when you are not using the computer. It can also be invoked from a batch file or command line.

Yes, I’m using a regular HD  on this computer, so it’s pretty slow. I’m in the music business so get get lots of mp3’s and send lots of them. That’s mostly why it’s large and now that I think about it an mp3 is already compressed, so that explains why I’m not getting much compression, whereas with your situation with text emails that would compress well.

I do have a nightly backup of 3 networked computers that I do, Yet if I had a HD failure and hopelessly lost all data, I need to have a disaster plan. With LiveMial there were some files that wouldn’t backup while the app was running, so I created a macro that on startup it would copy those files to a folder before LiveMail started. 

So I’m not sure if eM Client does that also, so this is why I wanted to run at least one backup in eM Client figuring that help me restore my huge database of emails going back to 1999. 

So as far as you know how does eM Client do with disaster recovery? Will the files that my nightly backup system copies be enough for a full restore? Or are there files not able to be copied when EM Client is running that would force me to use the zip backup I just created and then hopefully use my other backup files form my nightly backup to fully restore?

I changed my database storage path to my large E drive. You mentioned the backup creates a compressed archive of C:\Users_username_\AppData\Roaming\eM Client. IS that the default path of the database? And I can simply zip my database manually and it’d be the same? Of course to use it with  eM Client I’d have to manually unzip it like you said. And then would I’d just point eM Client to that database?

The best option is to use the built-in backup facility, because it creates a copy of the database whether eM Client is running or not. If that is not possible, the next best option is to manually backup the database directory. For that to work eM Client needs to be closed. If you copy or compress the database directory while eM Client is running, you may get a corrupt version.

Whichever method you use, you will get a full backup, that when restored will give you an exact state of eM Client at the point of backup. Everything is there. The backups are not incremental, so if you restore, it will replace all previous data, whether that data was there already, or it came from a manual zip file.

Yes, that is the default path for the database. If you change the path in eM Client settings, that will be the new database location, and if you wanted to zip it manually, you would have to use the new location as the source. Wherever you unzip it to, as long as you set that path in settings, that is what eM Client will use.

Useful info! Since my nightly backup is copying the database while eM is running, I need to know how to restore that without getting a corrupt version. With Live Mail I found out the names of those files and at startup had a macro run and copy those files to a folder before Live Mail started. Do yo happen to know which files are not copied correctly when eM Client is running?

Another option is the eM Client import feature. I see that it names EM Client 6 files in the import window? Could i use that to import specific folders from my nightly backup folder? When I imported LiveMail files, it created a folder tree where I could choose which folders to import.

Every file is copied incorrectly using an external method while eM Client is running. The built-in backup uses an SQLite backup API which puts a lock on each file before it is copied. Otherwise, if the file is not locked and a transaction is in progress, the backup file would contain both old and new data, thus being corrupt.

If you want to use an external method, it would be best to have eM Client closed. If you need to leave eM Client running, then let eM Client do the backup. If it is going to take 2 hours, and affects performance, it can be scheduled for a time when you are not using the computer. I described how to change the time for automatic backups in this thread https://forum.emclient.com/emclient/topics/when-does-backup-occur. As long as the computer is on, the backup will run, even if eM Client is closed.

The import feature has a special function to import from version 6 because the database was in a different format. This is not possible for importing from a version 7 database.

This is very good to understand about the lock on each file. I just did some testing with very good results. While eM Client was running, I copied my database to my backup HD. I was careful not to use eM Client while it was copying. And I have it set up so that there is no automatic email sync or auto marking a message read. I prefer to do all that myself manually.

I have 3 computers on my network. I just installed eM Client on the computer that has the backup HD. I did a very quick install bypassing all the windows setting up the email. I changed the storage file to point to my backup HD copy of eM Client.

 I closed eM Client and reopened it. I got the message saying it was checking the database for corruption and inconsistency. After that was done it opened and it’s absolutely perfect. All the data was there, even my email accounts were set up correctly. 

So it appears they eM Client has a very good database check. Any corruption was fixed. I’d rather not tempt fate, so from now on right before I start my backup I’ll check my emails one last time and make sure I don’t have any replies I need to do and then I’ll start the nightly backup with no activity with eM Client until it’s done. I’ll keep testing it on my 2nd computer and make sure the backups are working just to be safe.

My backup system has a nice feature that when it does delete files that have changed, instead of deleting them they are copied to a folder and periodically I’ll weed out that folder.

I must say eM Client is miles ahead of LiveMail in so many ways. I’ve decided I really like using it how you suggested with the email messages on the right column instead of below. This is better. I’m very pleased with eM Client. Thanks for all your excellent support.  

After much testing I’ve discovered some important things about manually backing up eM Client. If I close eM Client and then start my backup. The backup works perfectly. I can open eM Client on my 2nd computer which is using the backup HD eM Client database and everything is in tact and backing up great.

If I backup while eM Client is running then the files will be locked and the files cannot be copied. So when I open my 2nd eM Client nothing is corrupted, but the emails are only as current as the last backup I did with eM Client closed. 

So the bottom line is this, if you want a good manual backup of eM Client, it must be closed

Precisely Gerry. Fortunately eM Client’s built-in backup can run while the application is running, and this can also be run from the command line, so there are options if you don’t want to close the application.

Hi Gary
I have a similar problem, running out of space on my C: drive. EM backup is directed to another drive.
I have correctly shut down em client and the bloat reduced but em client temporary files still amounts to 13.8GB!


Can I deleate these?
It seems that there are copies of many images that I have sent and recieved in the folders in em client temporary files. Why?

Yes, with eM Client closed, you can delete that folder.

The C:\Users\yourusername\AppData\Local\Temp folder is meant for temporary files while applications are running. Once the application is closed, what is there is no longer required and can be deleted. You can clear it manually, or use Windows Disk Cleanup to do it for you.

OK that’s useful news thanks. To be clear are you saying I can delete eM Client temporary files folder or just the contents of that folder?

Yes, with eM Client closed you can delete the eM Client temporary files folder. When you restart eM Client, an empty folder will be recreated.

1 Like