Why this matters
Recently, the admin of a relatively prominent Mastodonยน server, med-mastodon.com, decided to stop maintaining the server and shut it down without warning. This is, generally speaking, a terrible thing to do, but I will give the admin the benefit of the doubt and assume that he had some very good reason why he needed to shutdown without giving his users time to export their data or migrate their account to a new server (though as far as Iโve seen he hasnโt shared any such explanation).
Unfortunately, this isnโt the first time this has happened, and it wonโt be the last. Even servers whose admins have agreed to follow the Mastodon Server Covenant, which among other things requires server admins to commit to giving users at least 3 monthsโ warning before shutting down, occasionally go belly-up without warning.
This could happen to your server at any time. Your server admins may be great people, but shit happens. Not only that, but your serverโs admins or moderators could decide at any time to suspend or delete your account.
Some people protect themselves from this by self-hosting their own server. That has advantages, but it also has disadvantages, including time and money costs, and so itโs not for everyone. If youโre not interested in self-hosting, but you also donโt want to run the risk of suddenly losing all your Mastodon data, then you should be backing up your data on a regular basis.
How to back stuff up
The most important thing to back up is the list of who you follow; fortunately thatโs also the easiest. In the Mastodon web app, go to Preferences, then click โImport and Exportโ on the left, and click โCSVโ to the right of โFollowsโ.
There you can also download your lists, muted and blocked people and domains, and bookmarks. All of those can be imported into a different Mastodon server using the โImportโ page linked on the left.
Set up a reminder to back up this stuff regularly!
The next thing to back up is posts and uploads. If you consider social media transient, you may not care about this, but otherwise, you can periodically click the โRequest your archiveโ button on the export page. Youโll receive a notification when the archive is ready to download.
Note that unlike the CSV files, your posts and media are not easy to upload into a new server. Unless you want to jump through some hoops (see below), youโre just downloading them for reference.
If youโre paying attention, you may have noticed that thereโs something important missing above: what about your followers? Can those be backed up? Alas, itโs not easy.
The way itโs supposed to work is when you decide you want to migrate to a new account, you configure your old account to tell your followers automatically what your new account is, and their accounts follow your new account automatically. But obviously, that doesnโt work if your old server goes away with no notice!
Iโm not aware of any web tools for backing up your followers (if you know of any, post a reply!), so if this is something you care about, youโre going to need to resort to the command line. Command-line tools that support exporting followers from your server include:
If youโre so inclined, you could also write code to do the export yourself; Mastodon has a rich, well-documented API.
Note that mastodon-archive also supports backing up a bunch of other stuff, so you could use it to set up periodic automated backups of all the data listed above, rather than just followers. Personally, I have mastodon-archive backing up my data automatically every night.
The toot utility mentioned above also supports downloading followed hashtags (โtoot tags followedโ), which you may also want to back up if following hashtags is a significant part of how you use the fediverse.
What to do with the backed-up data
You pretty much canโt import your old posts
The bad news first: there is no good way to migrate your posts from one server to another. This isnโt just true if the old server goes away; thereโs also no good way to copy posts from an existing server to a new one. People have been asking for this for many years but apparently it has not been enough of a priority for the Mastodon developers to implement it.
Thereโs at least one early-stage effort to build this functionality, and somebody has written a clever tool that server admins can use to do it as long as the old account is still available, but neither of these is a robust general-purpose solution.
You can still browse your exported data, look at the posts in a text editor, write your own code to do stuff with the data, etc. Furthermore. There are a number of tools for viewing and searching through your exported post archive.
How to get your followers back
If your account wasnโt migrated automatically because it disappeared out from under you, then assuming youโve archived your followers as described above, youโre going to need to reach out to them one by one, let them know what your new account is, and ask them to follow you again.
(If youโre in online fediverse communities where people know you, you can also make a public post about your new account and ask people you know in those communities to boost it. You may need to do this several times to catch everybody, and you might still miss some people.)
If you have a lot of followers, then sending a bunch of DMs one by one to all of them will probably be a drag. You could automate it with toot, but be careful of running afoul of your serverโs posting limits; you may get throttled if you post too many DMs too quickly.
Also, keep in mind that some people donโt read DMs at all, or donโt read DMs from people they donโt follow, so everyone may not see your messages asking for them to follow you again.
Restoring followed hashtags
You can use the toot utility (โtoot tags follow hashtagโ) to restore the followed hashtags from the list you previously exported with toot. Or if there arenโt too many you can just search for them by hand in the web app and then follow them.
Everything else, you can import
The import page in the web appโs preferences can be used to import the CSVs exported from the export page. If you used mastodon-archive or toot or whatever to export the data instead, then you can manually construct a CSV in the correct format for import.
ยนThis article focuses on Mastodon for clarity, but much of what is written here is applicable to any type of fediverse server.