Formatting USB drives using Slackware

So you have decided to format your USB flash drive because of those annoying viruses. Using Slackware, formatting can be done in just a couple of commands.

1. Plug your USB flash drive to your PC
2. If it is automatically mounted, the you must unmount it. (You need root privileges)
sudo su
3. Check the device of your USB, if it is automatically mounted, you can check it by using df command
df -h
You can see it at the buttom result, like for example /dev/sdc1—-419M—–4.0k——419M—–1%——-/media/disk
the first value /dev/sdc1 is your USB device
419M is the total space
4.0k is the used space
419M is the available space
1% is the total usage
/media/disk is where it is mounted

4. Supposing your USB drive is detected as /dev/sdc1 and you have of course 1 partition on it, unmount it by
umount /dev/sdc1

5. Use fdisk to alter the partition table if you want changes.
fdisk /dev/sdc
Use the fdisk help to navigate through the commands. Then type w if you are done. This will write/save the new partition table to your disk

6. Then you can format it. If you want your disk to be universally recognized, then use vfat 32. Before formatting make sure that your disk isn’t mounted, check it using
df -h

7. To format it for vfat 32, then
mkfs.vfat -F 32 /dev/sdc1
All data is erased, and your USB flash drive is now formatted

8. To check out other filesystems which can be used by mkfs
ls /sbin/mkfs\.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s