Check the current situation.
davidyin@instance-20230911-1538:~$ sudo su - mastodonmastodon@instance-20230911-1538:~$ cd livemastodon@instance-20230911-1538:~/live$ cd binmastodon@instance-20230911-1538:~/live/bin$ lsbundle heroku-web rails rake retry rspec setup tootctl update webpack webpack-dev-server yarnmastodon@instance-20230911-1538:~/live/bin$ ./tootctl media usageAttachments: 11.9 GB (23.8 MB local)Custom emoji: 91.7 MB (8.5 KB local)Preview cards: 481.8 MBAvatars: 768.8 MB (18.8 KB local)Headers: 1.5 GB (85.5 KB local)Backups: 0 字节Imports: 0 字节Settings: 289.6 KBmastodon@instance-20230911-1538:~/live/bin$ |
There are 1.5GB of header images. none of which are from local accounts except 85.5KB which is my account header on the server.
For Avatars, it is 768.8 MB, only 18.8KB is from my instance.
./tootctl media remove --days 1 --prune-profiles --dry-run6700/6700 |=============================================================================================================| Time: 00:00:09Visited 6700 accounts and removed profile media totaling 1.8 GB (DRY RUN) |
Do a dry-run to see what will happen to delete profile media from accounts I haven’t seen in one day or more.
Let’s run the actual purge operation.
mastodon@instance-20230911-1538:~/live/bin$ .//tootctl media remove --days 1 --prune-profilesError processing 111460850187830601: end of file reachedError processing 111460829052463449: end of file reached6702/6702 |=============================================================================================================| Time: 00:05:58Visited 6702 accounts and removed profile media totaling 1.8 GB |
Check the usage of storage now.
mastodon@instance-20230911-1538:~/live/bin$ ./tootctl media usageAttachments: 11.9 GB (23.8 MB local)Custom emoji: 91.7 MB (8.5 KB local)Preview cards: 483.3 MBAvatars: 170.2 MB (18.8 KB local)Headers: 340.4 MB (85.5 KB local)Backups: 0 字节Imports: 0 字节Settings: 289.6 KBmastodon@instance-20230911-1538:~/live/bin$ |
OK. 1.8GB spaces is saved.
There are more commands for maintenance jobs.
# Prune remote accounts that never interacted with a local usermastodon@instance-20230911-1538:~/live/bin$ ./live/bin/tootctl accounts prune1195/1195 |=============================================================================================================| Time: 00:00:47OK, pruned 1168 accounts# Remove remote statuses that local users never interacted with older than 3 daysmastodon@instance-20230911-1538:~/live/bin$ ./tootctl statuses remove --days 3Creating temporary database indices...Extract the deletion target from statuses... This might take a while...Removing temporary database indices to restore write performance...Beginning statuses removal... This might take a while...21/21 |=================================================================================================================| Time: 00:00:02Done after 2.361309051513672s, removed 20643 out of 20643 statuses.Removing temporary database indices to restore write performance...Run ANALYZE to statuses...Beginning removal of now-orphaned media attachments to free up disk space...3318/3318 |=============================================================================================================| Time: 00:09:31Done after 571.8121016025543s, removed 3318 out of 3318 media_attachments.Creating temporary database indices...Extract the deletion target from conversations... This might take a while...Removing temporary database indices to restore write performance...Beginning orphans removal... This might take a while...18/18 |=================================================================================================================| Time: 00:00:00Done after 0.8161077499389648s, removed 17359 out of 17359 conversations.Removing temporary database indices to restore write performance...Run ANALYZE to conversations...mastodon@instance-20230911-1538:~/live/bin$ ./tootctl media usageAttachments: 9.6 GB (23.8 MB local)Custom emoji: 91.7 MB (8.5 KB local)Preview cards: 483.3 MBAvatars: 168.1 MB (18.8 KB local)Headers: 331.0 MB (85.5 KB local)Backups: 0 字节Imports: 0 字节Settings: 289.6 KB# Remove media attachments older than 3 daysmastodon@instance-20230911-1538:~/live/bin$ ./tootctl media remove --days 32357/2357 |=============================================================================================================| Time: 00:01:36Removed 2357 media attachments (approx. 1.7 GB)# Remove all headers (including people I follow) Very aggressivemastodon@instance-20230911-1538:~/live/bin$ ./tootctl media remove --remove-headers --include-follows --days 07235/7235 |=============================================================================================================| Time: 00:00:39Visited 7235 accounts and removed profile media totaling 330.9 MB# Remove link previews older than 3 daysmastodon@instance-20230911-1538:~/live/bin$ ./tootctl preview_cards remove --days 31926/1926 |=============================================================================================================| Time: 00:00:40Removed 1926 preview cards (approx. 269.7 MB)# Remove files not linked to any postmastodon@instance-20230911-1538:~/live/bin$ ./tootctl media remove-orphans#The orphan removing command took a little bit longer to remove these files. And I run the usage of storage command again to see the results.mastodon@instance-20230911-1538:~/live/bin$ ./tootctl media usageAttachments: 7.9 GB (23.8 MB local)Custom emoji: 91.7 MB (8.5 KB local)Preview cards: 213.6 MBAvatars: 168.2 MB (18.8 KB local)Headers: 85.5 KB (85.5 KB local)Backups: 0 字节Imports: 0 字节Settings: 289.6 KB |
After these procedures, the total space I saved is 12.99GB – 8.37GB =4.62GB.
My question is why Backblaze did not show the correct space occupied. Mastodon Administration Dashboard shows as 8.36 for media storage.

The Backblaze web interface, in Caps & Alers.
It is 28GB. I don’t know how to read it and why it is such a big number.






