A lot of people have joined the Fediverse lately, and many have done so through one of the many Mastodon instances, foremost among but certainly not the only one of which is mastodon.social.

Especially if you’re not self-hosting Mastodon or paying for a personal instance, the risk always exists that your chosen instance will shut down. For example, the large instance home.social recently effectively shut down, and social.vivaldi.net had difficulties from which the team were able to recover. Many Mastodon instances are run by individuals on what is effectively a best-effort basis and while responsible administrators will provide advance notice in case of a shutdown, things can happen that will cause an instance to shut down with very little or even no advance notice.

It is possible to migrate accounts from one Mastodon instance to another, but the process is lossy and requires the cooperation of the old instance.

For this reason, it’s a good idea to regularly back up your profile and to have at least one backup account on a different instance, run by different people, to which you can move should something happen to your preferred instance.

I speak specifically of Mastodon in this post, but the same general principle also applies to other Fediverse applications.

I recommend setting a calendar reminder for going through the backup process. Depending on how prolific a user you are, you may want to do it once every few weeks or maybe once every six months.

Here’s how you can do it.

Making a backup

  1. Log in normally to your Mastodon account.
  2. In the left-hand side bar and next to your profile picture, click Edit profile.
  3. Go to Import and export, then Data export, then click Request your archive. This will take a while to complete, but it runs in the background on the server and you will be notified when it finishes.
  4. Still under Data export, there is a series of CSV download links. Use each in turn to save the file somewhere you will be able to find it easily if you need it.
  5. Go to Filters, and then click on Edit filter for each in turn. You can open these in tabs if you want to. Save each page to a file locally; you can save just the web page without graphics (what Firefox calls “Web page, HTML only”), but it will look better if you also save the rest of it (“Web page, complete”). You can also use a browser add-on such as SingleFile for Firefox to save each page as a single self-contained file.
  6. Click Back to Mastodon, click the button near the Edit profile link you used previously, then click Followed hashtags in the menu that opens. On the resulting page, scroll all the way down to the bottom (you may need to scroll multiple times for this). Select all of the content, copy it to a text file and save that file together with the rest of your files.
  7. By now, it’s quite possible that your archive is complete. Go back to Edit profile, then Import and export, then Data export, and look at the bottom of the page. You should see a Download your archive link near the current date and time. Download that file and save it with the rest of your files.

At this point, you have a copy of most of what makes up your Mastodon experience. If you want to, you can also go through the rest of the profile settings and save those.

Set up a second account

If you haven’t already, consider setting up a second account on a completely different instance, which you can switch to in case your preferred instance becomes unusable for some reason. Just sign up on a different instance with the same (or a different) email address. It’s helpful, but not a requirement, if this account has the same username (the part between the two @ signs, like example in @example@mastodon.social) as your existing account, as well as the same avatar. You can use the display name or bio field to indicate that this is a secondary account belonging to the same person as your existing (named) account, and otherwise leave the account dormant if you want to.

Restoring on a different account

The best way to migrate to a different instance is by using the account migration feature built into Mastodon. However, if that isn’t possible for some reason, you can use your backup to get back up and running with a new account.

To restore your backup onto a different account, go to Edit profile, then Import and export, then Import. For each entry under Import type except for following list, select the corresponding file that you downloaded previously, and choose whether to merge or overwrite what’s in the account you are importing to, then upload. Again: don’t upload your following list just yet!

Once that is done, go to Filters and set up your filters according to the files you saved previously.

Finally, go to Profile and update your display name and/or bio as appropriate.

Then go back to Mastodon, and for each tag in your followed tags list, paste it into the search box, then navigate to the correct tag and follow it.

Post a short #introduction saying that you are the same as whatever your previous handle was. Remember, from an outside point of view, this profile is empty!

Once that is done, go back to Edit profile, Import and export, Import and import your following list.

It will take a short while for your home feed to repopulate, but this should get you back mostly to where you were, except for old posts which will still be on the old instance (or gone, if the old instance shut down).