How to format a flash drive through the command line and what are the ways?

Removable USB flash drives have to be formatted quite often, not only to completely clear them of the available information, but also to create bootable media or if the file system is damaged due to some malfunction. And not always the built-in tools of Windows-systems can cope with such a task. Therefore, the question of how to format a USB flash drive through the command line of Windows 7, previous or next versions, becomes very relevant. In this case, you can offer users three basic options, two of which are very similar to each other.

The main problems when formatting a flash drive using Windows

The most common problem that Windows users encounter when trying to format removable media is that the process seems to start first, but it doesn't get to the end.

how to format a flash drive through the command line

Even if you select any of the standard options, the system reports that Windows cannot produce or complete formatting. Why it happens? Yes, only because the drive has software or physical damage. No matter how good Windows systems are, fixing the situation with regular methods does not work.

Next, we will consider the problem of how to format a USB flash drive through the command line (Windows 10 will be used or XP, it does not matter - the proposed methods work in all OSs of this type). But first, there are a few key points to consider.

Which format to prefer?

So, before deciding on how to format the USB flash drive through the command line, you should decide on the type of file system that will be installed on it at the end of the process. Since this is specifically about Windows, systems for Linux and Android will not be considered.

format a flash drive in ntfs via the command line

Thus, there are only two options left: either FAT32 or NTFS. What to choose? Firstly, pay attention to the memory capacity of the flash drive. If it does not exceed 4 GB, you can use FAT32. In the case of a larger size, you will have to choose NTFS, since the first kind of file system does not determine large volumes. Rather, it determines the devices themselves, but sets the maximum size for any drive to just 4 GB.

Secondly, if you create bootable media for computers in which a new UEFI system is installed instead of an outdated BIOS, it will be impossible to use NTFS, since such systems do not recognize this format initially.

Next, we will talk about how to format a USB flash drive in NTFS via the command line or apply similar actions with the choice of FAT32. Immediately I want to upset all lovers of the simplest methods that tend to use the standard format command without using additional attributes: this approach will be ineffective.

How to completely format a flash drive through the command line using the format command and its main attributes?

Now directly on formatting. The format command for the simplest case needs to be applied not only with the letter of the removable medium under which it is registered in the system, but also add additional attributes.

format flash drive via command line in fat32

For example, the user needs to format the USB flash drive through the command line in FAT32, and the media in the system is indicated by the letter F. In this case, the full command will look like this: format / fs: fat32 F: / q (in the image above - the drive letter I).

What do the characters in this line mean? The first is the command to start the formatting process, the second is responsible for choosing the file system (in this case FAT32), F is the drive letter, the attribute ā€œ/ qā€ indicates that when formatting the volume label (the future name of the medium that will be displayed in the system) no need to create and formatting can be, so to speak, quick. If you need the NTFS file system, it is indicated in the line itself instead of FAT32. After entering a command, the system will prompt you to insert the device into the port, and after that you will need to press the enter key and wait for the process to complete.

How to format a USB flash drive through the command line with a quick addition of a volume label

The second technique proposed for consideration allows you to immediately add a volume label without using additional commands at the end of the formatting process.

In this case, the problem of how to format the USB flash drive through the command line in this way is solved due to the fact that instead of the ā€œ/ qā€ attribute the ā€œ/ vā€ attribute (short for English Volume) is used, after which the desired media name is indicated through a colon. The formatting command itself is also somewhat modified.

how to format a flash drive through the command line

For a flash drive from the previous example, the command looks like this: format F: / fs: fat32 / v: NAME (in this case, NAME is a user-defined name; you can leave the ā€œ/ qā€ operator). Further, the same actions as in the first example.

Using the diskpart sequence

Finally, the longest method to solve the problem of how to format a USB flash drive through the command line. And if using the first two methods, errors can be generated, which will be discussed a little later, then this technique provides an almost one hundred percent guarantee of a successful process.

how to format a flash drive through windows 7 command line

First, the diskpart command is written to the console, after which you will need to enter the list disk line and select the desired device (all partitions are indicated by numbers, so you can determine the desired volume by size). Then, with the line select disk N (N is the number of the partition number), a flash drive is selected.

Now the main stage. In some cases, when the medium may contain errors or restrictions in terms of the actions applied to them, you may first need to clear the Read-Only attribute with the attributes disk clear readonly command. This will avoid errors in the future. After that, you need to clear the media of all contents. To do this, use the clean command.

Next, create the primary partition on the media (create partition primary command) and only after that enter the format fs = fat32 (or ntfs) formatting command directly. This will be the full formatting. If you want to perform quick formatting, in addition, the quick attribute is added to the line with a space. At the end of the process, the exit command is applied. When creating bootable media at an intermediate stage, select partition primary and active commands are additionally entered.

What should I do if a format error occurs?

But formatting may also produce an error. In particular, this applies to cases when the drive in the system has the RAW format, which appeared as a result of some software malfunction, which is not recognized in Windows.

how to format a flash drive through windows 10 command line

To fix the problem, you can first check the device from the command console by writing the line chkdsk F: / x / f / r there, but you can also give preference to special utilities, among which the palm belongs to such software packages as HDD LLF (Low Level Format - formatting) lower level) and R.Saver.

Brief summary

To summarize briefly, it can be noted that the first two methods are very simple, but they should be used only with full confidence in the absence of software failures and physical damage on the media. But the third technique is unique, and it should be used without fail if after formatting it will be necessary to create bootable media (even using the most powerful applications designed for this), as well as for situations where standard formatting is not possible.

Source: https://habr.com/ru/post/A6046/


All Articles