RE: Mastodon media storage

Hugo GameiroFAQs, Mastodon

To clarify, when you or another user in your server follows a remote user, from that moment on, all new posts from that remote user start to federate with your server. By federate, you can think of a copy of those posts are stored in the database.

If you follow 1000 remote users and another user on your server follows another 1000 different remote users, in terms of database storage, we now have 2002 user posts that get saved in your database. As you can see, the local number of users in most cases influences little on the storage space needs of a Mastodon server. It does influence in terms of ‘Processing Threads’ (think CPU/RAM needed to handle requests), but it is probably not much unless they are posting hundreds of thousands of posts.

Media is the same but I have automated a Mastodon provided script to do remote media cache clean up, meaning that media files from remote servers are deleted locally after:

  • 7 days for media files in posts
  • 30 days for avatars/headers of inactive remote accounts
  • 30 days for preview cards in links
  • 90 days for preview cards in other media types (videos/photos)

So, it’s normal for the media storage to grow very fast in the first days but after the 7 days the growth starts to slow down.

Updated to include ’30 days for avatars/headers of inactive remote accounts in March 2023.