press format. that's it. B9s will stay, just makes ure the saves are backed up with a homebrew application such as jksm and not nintendo's official backup system, which get erased after a format.
Also, all homebrew CIA installs will go away, so make sure you have an alternative way to install FBI. (Rosalina, but I forget about it because I'm running Rei-Six)