A USB Drive full of viruses

Mon 03 March 2008 by Thejaswi Puthraya

A USB Drive Full of Viruses

Yesterday, when I plugged in my usb stick onto a college computer little did I realize that it would get infected with hundreds of viruses. Not that I am bothered by these viruses because I use GNU/Linux. I just wanted to safeguard my friends (no prizes for guessing which operating system they use ;-) ) who would share the USB disk. The stupid virus created an EXE file under every folder with the name of the parent folder. I could have written a small python script to have deleted the EXEs. But I decided to format it and get rid of all the viruses.

So here is what I did:

  • First tried to figure out what was the exact device name of the USB drive. I plugged in the usb device and had a look at the dmesg output.
$ dmesg|tail

The output that I got was

sd 3:0:0:0: [sdb] Assuming drive cache: write through
sdb: sdb1
  • Next I logged in as root and unmounted the drive and used the mkdosfs utility to format it.
# umount /dev/sdb1
# mkdosfs -F32 -I -c -v /dev/sdb1

Once the process was completed, I unplugged it and plugged it back. The virginity (excuse the pun ;-) ) of the USB drive was restored.