From Newsgroup: alt.comp.os.windows-10
PSA:
How I recovered 27GB on a full 1TB hard drive by deleting Betterbird offline cache.
My PC is from 2009 and working just fine, save for the 1TB drive is full.
If you had a full 1TB C: drive that was causing Microsoft Windows to barf
in a variety of uncanny ways over a period of weeks, and you found that
just "one" culprit was the way you set up Betterbird to download all your
IMAP mail (as if it were the old POP days), what would you do?
Here's what I did just now, for what it's worth to help others also.
Check the disk space:
wmic logicaldisk where "name='C:'" get freespace
FreeSpace
0
Find the biggest files created or modified in the past 24 hours that are greater than 500MB in size (but ignore reporting errors).
Get-ChildItem C:\ -Recurse -File -ErrorAction SilentlyContinue | Where-Object { $_.Length -gt 500MB -and $_.LastWriteTime -gt (Get-Date).AddDays(-1) } | Select-Object FullName, @{N="GB";E={[math]::Round($_.Length / 1GB, 2)}} | Sort-Object GB -Descending
FullName GB
----------
C:\app\telecom\betterbird\profile\ImapMail\imap.gmail.com\[Gmail].sbd\Sent Mail 12.39
C:\app\telecom\betterbird\profile\ImapMail\imap.gmail.com\[Gmail].sbd\All Mail 6.12
C:\app\telecom\betterbird\profile\ImapMail\imap.gmail.com\INBOX 3.37
Ah. Well that was unexpected.
The only huge files (over 500MB) that grew in the last day were these
local copies of my IMAP folders. They likely didn't just grow today.
But they're still big. And they're contributing to the myriad errors
that Microsoft Windows causes when it thrashes on low disk space.
So, here's what I did even as BB wasn't the fundamental problem.
I closed Betterbird 140.8.0esr-bb19 (64-bit) & reopened it.
Then I set Betterbird to work offline:
BB:File > Offline > Work offline
Do you want to download messages for offline use
before going offline > Later
Again, I shut down Betterbird and checked that it's shut down.
tasklist | findstr /I betterbird (for BB users)
tasklist | findstr /I thunderbird (for TB users)
If necessary, we have to completely kill BB or TB to proceed.
taskkill /IM betterbird.exe /F (for BB users)
taskkill /IM thunderbird.exe /F (for TB users)
Now let's go to the IMAP folder on disk
cd C:\app\telecom\betterbird\profile\ImapMail\imap.gmail.com
Let's list the files so you we see the big ones:
dir /O:-S
Yikes!
INBOX is ~3.6 GB
Sent is ~0.8 GB
Drafts is ~0.13 GB
Everything else is tiny
Let's delete one or more of the big files to free space immediately
del INBOX
del Sent
del Drafts
Note: This does not delete any email from Gmail as it only removes
the local cached copy. Betterbird will re-download messages
later only if we later re-enable offline sync. .
Let's check our disk space now:
wmic logicaldisk where "name='C:'" get freespace
FreeSpace
3852890112
That's a start, but it's still likely not enough to even compact
in Betterbird, so let's get s'more disk space out of Betterbird.
cd "[Gmail].sbd"
dir /O:-S
Sent Mail is 13.36 GB
All Mail is 6.57 GB
Important is 2.55 GB
Starred is 182 MB
Let's get s'more disk space out of that offline BB storage:
del "Sent Mail"
del "All Mail"
del Important
del Starred
Note this deletes only the local cache.
Let's check how much disk space we've reclaimed from BB cache:
wmic logicaldisk where "name='C:'" get freespace
FreeSpace
27456434176
Woo hoo! Now I have 27.27 GB free.
Let's see if there's anything else worth deleting in BB.
cd ..
echo %cd%
C:\app\telecom\betterbird\profile\ImapMail\imap.gmail.com
dir /O:-S
There was nothing left here worth deleting.
Now let's prevent BB from filling up my already full disk.
Open Betterbird and don't touch anything for a minute
so it can rebuild little indexes and the like.
Then go to
BB:Tools > Account Settings > {account} > Synchronization & Storage
Change from:
[x]Keep messages in all folders for this account on this computer
Change to
[_]Keep messages in all folders for this account on this computer
Whew! Only now can we begin to compact the folders safely.
Exit the tools menu and then go to
BB: File > Compact Folders.
This removes leftover deleted-message fragments
It should shrink the .msf index files
And it should clean up any stale metadata
To test, close Betterbird completely, then open it again.
In Betterbird, click Inbox & look specifically for spinning wheels.
If none, then click on Sent Mail & All Mail & Important in series.
Close Betterbird if nothing seems out of place.
Here's the final tally from simply deleting BB local storage:
wmic logicaldisk where "name='C:'" get freespace
FreeSpace
27454423040
We still have 27.45 GB free so that's proof that our changes ensured
Betterbird did not recreate any giant cache files again.
In summary, the disk was full and we looked for the largest files
that were recently touched and since they were in the Betterbird
offline mail cache, we deleted them (as an emergency measure).
Since this freed up 17.45 GB on a 1TB old spinning drive, this
also enabled us to compact Betterbird's folders for a minor gain.
We left all real mail on the server untouched.
After cleanup, we disabled the offline storage setting
"Keep messages for this account on this computer"
so Betterbird will no longer store huge local copies of
Gmail folders.
We restarted Betterbird to rebuild small index files safely.
The result is over 27 GB of free space and a stable mail setup.
The problem wasn't Betterbird per se, but when you don't have
disk space to store offline files, the offline files have to go.
I just ran this command which will find the top-20 large files.
PS:\> Get-ChildItem C:\ -Recurse -File -ErrorAction SilentlyContinue | Sort-Object Length -Descending | Select-Object -First 20 FullName, @{Name="GB";Expression={[math]::Round($_.Length / 1GB, 2)}}
This will filter to only those touched in the past 24 hours.
PS:\> Get-ChildItem C:\ -Recurse -File -ErrorAction SilentlyContinue | Where-Object { $_.LastWriteTime -gt (Get-Date).AddDays(-1) } | Sort-Object Length -Descending | Select-Object -First 20 FullName, @{Name="GB";Expression={[math]::Round($_.Length / 1GB, 2)}}
I'm sure those will lead me in another direction altogether.
PS C:\Windows\system32> Get-ChildItem C:\ -Recurse -File -ErrorAction SilentlyContinue |Sort-Object Length -Descending |Select-Object -First 20 FullName, @{Name="GB";Expression={[math]::Round($_.Length / 1GB, 2)}}
FullName
--------
C:\data\mail\tb\20210701\ImapMail\imap.gmail.com.7z C:\app\telecom\tb_portable_unused\Data\profile\ImapMail\imap.gmail.com\[Gmail].sbd\All Mail
C:\data\mail\tb\20210701\ImapMail\imap.gmail.com\[Gmail].sbd\All Mail C:\app\telecom\betterbird_20260319\profile\ImapMail\imap.gmail.com\[Gmail].sbd\Important
C:\app\telecom\tb_portable_unused\Data\profile\ImapMail\imap.gmail.com\INBOX C:\app\editor\android\scrcpy\fullAndroidBackup.ab C:\app\telecom\tb_portable_unused\Data\profile\ImapMail\imap.gmail.com\[Gmail].sbd\Important
C:\app\telecom\betterbird_20260319\20230501profile\ImapMail\imap.gmail.com\[Gmail].sbd\Impo...
C:\data\mail\tb\20210701\ImapMail\imap.gmail.com\[Gmail].sbd\nstmp-3 C:\app\telecom\betterbird_20260319\20230501profile\ImapMail\imap.gmail.com\INBOX
C:\data\mail\tb\20210701\ImapMail\imap.gmail.com\[Gmail].sbd\Important C:\data\mail\tb\20210525\ImapMail\imap.gmail.com\[Gmail].sbd\Important C:\data\mail\tb\20210525\ImapMail\imap.gmail.com\INBOX C:\data\mail\tb\20210428\gmail\imap\INBOX C:\app\telecom\betterbird_20260319\profile\ImapMail\imap.gmail.com\[Gmail].sbd\Sent Mail
C:\data\bck\phone\g7\s0\DCIM\Camera\VID_20200914_140025.mp4 C:\data\mail\tb\20210701\ImapMail\imap.gmail.com\INBOX C:\app\telecom\tb_portable_unused\Data\profile\ImapMail\imap.gmail.com\[Gmail].sbd\Sent Mail
C:\app\telecom\betterbird_20260319\20230501profile\ImapMail\imap.gmail.com\[Gmail].sbd\nstmp
C:\app\telecom\betterbird\profile\Mail\Local Folders\20240501
--
Note this is just one account from one user of what I did.
--- Synchronet 3.21f-Linux NewsLink 1.2