How to remove malware from SD card without formatting it

Before the days when virtually every computer on the planet was connected to the internet, the most common way to spread a virus was to infect removable storage media like a floppy disk. Those disks may have long since gone, but there’s one type of removable storage that is still prone to malware — flash storage, most commonly the SD card. Mostly used in digital cameras and for additional storage on smartphones, SD cards are also connected to Macs and PCs to download photos or share other types of files. Sadly, it’s possible to share viruses this way, too. And if you find a virus on an SD card that has precious photos on it, the last thing you want to have to do is reformat it and lose your photos. So, here’s how to remove a virus from an SD card without formatting it.

Symptoms of a virus on an SD card

There are several ways to tell whether your SD card is infected with a virus. Some of the most common are:

  • Files may turn into Windows shortcut links.
  • Files may become hidden.
  • Files may be corrupted or have been erased.
  • The SD card may start to become slow, and it will take longer to copy files to and from the card, or your camera or phone may seem to slow down.
  • Files are missing.
  • You get an error message when you try to use the card.
  • You can’t access the card at all.
  • You see a pop-up prompt asking you to reformat the card when you plug it into your computer.

All of the above are signs that your card may have a virus. So, before you use it again, you should remove it.

How to manually remove virus from an SD card

If you’re a Mac user, you’ll need to persuade someone who has access to a Windows PC to help you or let you use their computer since this method relies on using the Windows “cmd” command to launch the command-line interface.

  1. Put the SD card in the SD slot on the PC or if it doesn’t have one, use a USB card reader.
  2. Note the drive letter for the SD card — in this example, we’re going to assume it’s “F,” so wherever you see “F” below, replace it with the drive letter for your SD card.
  3. Click on Start.
  4. Choose Run, then type “cmd” and press Enter.
  5. You should see a new command interface window open.
  6. Type the following, remembering to replace “F” with the drive letter for your SD card: attrib -h -r -s /s /d f:\*.*
  7. Press Enter.

Once the command has run, it should have removed the virus from the SD card. However, it doesn’t work in all cases. Fortunately, there is one more thing you can try before resorting to reformatting the card.

Another option for removing a virus from an SD card

If the manual method described doesn’t work, there are a couple of other options. The first is to manually copy as many of your photos and other files from the SD card as you can. Once you’ve done that, you can reformat the card. Here’s how to do that on a Mac:

  1. Go to Applications, then Utilities, and double-click Disk Utility to launch it.
  2. Click on the SD card (not the volume underneath) in the sidebar.
  3. Choose the Erase tab.
  4. Type in a name for the card.
  5. Choose “Mac OS Extended (Journaled)” as the format. If you want the SD card to be compatible with Windows, choose “FAT” for flash drives of less than 32 GB or “ExFAT” for larger ones.
  6. Choose GUID Partition Map as the scheme.
  7. Press Erase.

To reformat an SD card on a Windows PC, do the following:

  1. Click on the Start menu and then choose the folder icon (above the cog on the left side of the screen) to open File Explorer.
  2. Choose This PC.
  3. Click on the name of your SD card.
  4. Select the Manage tab at the top of the window.
  5. Press Format.
  6. Click on the menu under “File System” and choose exFAT.
  7. Type a name into the “Volume label” box.
  8. Press Start and then Ok.

The SD card will now be erased and reformatted. The virus will be gone, but so will all your data. So, if there’s anything you weren’t able to copy to your computer before you reformatted, you’ll need to try and recover it.

The best way to recover data from an SD card is to use specialist recovery software. There are many tools available, including some that are specifically designed to recover photos from an SD card. Research which is the best one for your needs and find out whether you can try it for free to see if it finds any recoverable data before you pay for the software, so you can recover it.

If you think the virus on your SD card may have been transferred to your computer, you should scan the computer using antivirus software. Several antivirus tools are available for Mac and PC, some of which will allow you to both scan and remove malware for free. An alternative, if you’re using a Mac, is to use the Malware Removal module in CleanMyMac X. This tool thoroughly and quickly scans your Mac and either returns a clean bill of health or allows you to remove any malware it finds at the click of a button. You can download CleanMyMac X for free here.

Malware removal module of CleanMyMacX

Finding a virus on an SD card doesn’t necessarily mean that you have to reformat it — though you should copy your most precious photos from it as a precaution. It is possible to remove the virus without reformatting it. However, if you do have to wipe the SD card completely to get rid of the virus, running a data recovery tool specially designed for flash storage media might allow you to recover your data.