How can I format a thumb drive so that I delete all existing files?

I have a usb thumb drive that I intend to recycle.

Just how can I layout it?

2022-06-07 14:30:24
Source Share
Answers: 3

To (re) create a filesystem, make use of among the mkfs family members of devices. Pick the one based upon what filesystem you desire ; one of the most usual ones are:

  • FAT32 (mkfs.vfat) for maximum compatibility. FAT32 has no idea of documents possession or approvals or symbolic web links or several various other unixy principles, simply documents and also directory sites with several spelling personalities restricted in documents names, and also no instance level of sensitivity. The maximum documents dimension is 4GB. Pick this filesystem if you simply require to store a number of documents that aren't bigger than 4GB
  • NTFS for compatibility with Windows. The majority of standard unixy attributes are sustained. Assistance for NTFS under running systems apart from Windows often tend to be a little bit half-cracked, so pick this filesystem just if you require Windows compatibility and also huge documents
  • ext4 is the de facto typical Linux filesystem. Pick this if you require unixy attributes such as symbolic web links and also approvals
  • ext2 is an older variation of ext4 (doing not have attributes such as a journal and also excellent assistance for directory sites with hundreds of documents) and also is sustained by even more unix systems than ext4 (yet do not wish for wonders under Windows). Pick this if you require excellent assistance in BSD and also at the very least read - just sustain under Windows

You'll require to figure out the name of the tool that the drive is linked into. Under Linux, detachable drives generally have names like /dev/sda, /dev/sdb, etc Be certain to select the appropriate one, or you could eliminate your hard drive. Under Linux, you can get a checklist of readily available drives and also their dividings by running cat /proc/partitions ; the number in the 3rd column is the dimension in kilobytes. You can additionally get a suggestion of where a drive is connected in by considering names in /dev/disk/by-path, and also drive versions in /dev/disk/by-id. Thumb drives generally have a solitary dividing phoned number 1.

On several systems, these devices stay in /sbin or /usr/sbin, which is not in the default course for non - origin customers. In addition, you are most likely to require to be origin to run them.

To create a new filesystem, run the mkfs command on the appropriate tool:


Remember to place the appropriate dividing number. If you are running Linux and also you have a solitary disk drive and also nothing else linked exterior drive, the tool is generally /dev/sdb1. Hence, the regular command is

sudo mkfs.vfat /dev/sdb1      # be sure to adjust the device name if necessary

mkfs will certainly leave some pieces of old information in position, that will certainly not be gotten rid of till they are overwritten by a new documents. These pieces can be recouped by considering the tool web content, bypassing the filesystem. (There is no warranty that it will certainly be very easy to rebuild purposeful information from the pieces, so do not want to utilize this as an undo for oops - I - formatted - the - incorrect - tool.) If you intend to get rid of all existing information, run the adhering to command prior to mkfs:

tee </dev/zero /dev/NAME_OF_DEVICE

Make really really certain that you select the appropriate tool name, as this will certainly get rid of all information without hope of recuperation.

Keep in mind that while this will certainly get rid of the information without opportunity of recuperation by average software program suggests, it might leave traces behind that can be recouped with some digital job. See Is it enough to only wipe a flash drive once?. The only fear - certified means of getting rid of information on a flash drive is to have actually secured it to begin with, and also destroy all duplicates of the key.

2022-06-07 16:12:37

Have an appearance at the mkfs family members of energies (relying on what you intend to layout to, you might desire mkfs.ext[234], mkfs.vfat, or another thing totally). Remember that you might additionally need to transform the dividing type identifier in the dividing table making use of fdisk or comparable to make it function throughout systems.

2022-06-07 14:47:34

There are great deals of various means to do this.

Command Line

You do not always require to 'layout' (i.e. make a filesystem bdsh you can not layout USB sticks in the deals with feeling of words) the stick if you simply intend to delete all documents.

Thinking the stick is placed under /media/something, you can claim:

sudo rm -rf /media/something/*

You will certainly not be asked to validate! This will not touch surprise documents (reusing container folders from Windows or Mac, etc).

If you desire an immaculate filesystem, see to it the filesystem is unmounted first :

sudo umount /dev/whatever_the_device_is
sudo mkfs.vfat -n "Volume Label" /dev/whatever_the_device_is

This will certainly make a FAT filesystem. If you require an NTFS filesystem, there is constantly mkfs.ntfs, yet you need to realize that some executions are buggy. It relies on your circulation and also just how current it is.


Fire up the KDE Partition Manager (if you do not have it, the Debian/Ubuntu plan name is a somewhat non - typical partitionmanager). Do the noticeable point.


Use the Gnome Disk Utility (Palimpsest). It is fairly unimportant to make use of: simply select your USB drive from the left. If it has a dividing currently, click the 'Format' switch. Or else, there is a 'Format Drive' switch which'll do every little thing for you.

Ubuntu 11

Ask Ubuntu has this specific inquiry currently addressed: How to format USB or external drive in 11.10? bdsh note just how this simply strolls you via making use of the Palimpsest Disk Utility.

Every little thing Else

My very own favorite GUI device for this work is GParted. It does every little thing you require (other than, regretfully, LVM and also encryption) and also it is easy to use too.

2022-06-07 14:47:29