Low-level formatting of the flash drive via the command line. Diskpart program

Formatting a flash drive is software process Forming the logical structure of the flash drive with the preceding removal of all data stored on it. The file structure or file system is a certain order, a method for organizing storing information on a carrier or its section (in the case of a rigid and solid-state disk). It defines the length of the file name, its structure, the maximum occupied volume, the method of renaming, etc. Some file systems provide additional service features - distribution of data access rights, encryption, archiving.

Formatting is two types: full and fast. In the process of quick formatting, the file table of the flash drive, in which the paths are stored to files, their names, attributes, etc. Clears, then a new data structure is formed and the main boot record of the drive is created. After quick formatting, the operating system perceives the carrier as free from any information. The data itself and their structure are in no way affect physically. In the process of writing files to a flash drive formatted by the rapidly, the data on it marked as deleted is simply overwritten by new bits of information.

Full formatting - The same cleaning of the table of contents (file table) with the formation of the block data structure, but with overwriting each sector of the flash drive of the zero bit. In the process of complete formatting, the logical disk or the drive is further damped to the presence of faulty (broken) sectors on it, which cannot be recorded information.

Many users are asked about why and whether to format a flash drive, in various forums and blogs, but most of them do not get a clear clear answer. Let's try to deal with the main reasons that require formatting removable flash drives.

Causes of formatting flash drive

    Removing viruses

    Flashki very often become victims of malicious software and viruses. Sometimes their number reaches dozens of malicious files on one flash drive, which can prohibit the user to make changes to the Flash Drive File System. In this case better decision There will be formatting - it will delete all malicious programs in a matter of seconds.

    The change file System

    The Windows family operating systems can work with multiple file systems for storing data. The most common ones are NTFS and FAT32, each of which has its own advantages and disadvantages. Recently, users have become increasingly recorded on flash drives images and films in ultra-high resolution, which take up to a dozen and more GB. But when copying a file that occupies more than 4 GB flash drive with file fAT system or FAT32, issues a similar error:

    Why does she arise? In the FAT32 file system, 4 bytes are given to the file entry, which are 32 bits (4 bits multiplied by 8 (bits in 1 one byte) and get 32). Two possible states Bit (zero and one) to degree 32 equals 4 gigabytes: 232 4 GB. The file size cannot exceed this value, because it will not be possible to specify its volume - for this, simply does not have enough addresses. As a solution to the problem and appeared the NTFS file system, where such a deficiency is eliminated.

    There are cases of replacement of the NTFS file system to outdated FAT or FAT32. It happens when on the computer installed old version Microsoft Operations. For example, Windows 2000 is far from always correctly determines and normally works with the NTFS file system. The same goes and old chipsets motherboardnot supporting the NT file system.

    Fast cleaning flash drive from a huge number of files

    Even with the advent of the high-speed data interface, on which new flash drives, USB 3.0, the speed of deleting a significant number of files, such as photographs, or distributions portable programs, it happens long enough. About devices running through outdated uSB interface The 2nd generation and nothing to say - the removal process can delay for many minutes. To quickly delete a significant number of files from the flash drive, it is sometimes easier to copy the desired data from it and use the quick formatting function to clean the flash drive.

  1. Acquisition of a new device

    As a rule, new flash drives do not need formatting - the manufacturer has already defined their file system. To make sure that the device is fully fulfilled, it is recommended to format, using the full formatting function, in order to verify each memory cell of the device for performance. Even thoroughly trusting the world brand, it is better not to neglect the possibility of once again to make sure the functionality and integrity of the product.

    Creature boot flash drive

    A very common reason to format the USB drive is the creation of a loading flash drive. As mentioned above, during formatting, the main boot record of Master Boot Record or MBR is generated. She is needed in order basic system I / O or BIOS could find the loading device with the MBR in its first sector. The main characteristic of the main boot record is the presence of a specific signature (digital code) in its last bytes. The bootloader is needed to detect active partitionwhich is a flash drive, and transfer to the primary instructions contained in the loader.

    If errors occur

    Formatting, as already mentioned, is an excellent method of eliminating problems with the structure of the flash drive. During full formatting, the flash drive is tested to the presence of non-working memory cells on it and, if possible, they will be replaced with the backup or excluded from the file table. They are simply designated as idle or non-existent for Windows. Thus, it is possible to slightly extend the service life of the drive and eliminate some problems (damaged sectors, for example), causing the hang, errors appear, etc.


2. Why format a USB flash drive in NTFS. What are the advantages over Fat. Disadvantages.

Before you decide which NTFS is the advantages, shortcomings, it is necessary to get acquainted with it.

NTFS is the latest file system designed for storage devices used in operating windows systemsstarting with XP. In the 2000 edition, this file system is not always steady. It was taken for its basis HPFS, which has quotes, journalism and access limiting in its arsenal. In comparison with the predecessor, NFTS slightly inferior to it in performance.

The size of the section in NTFS is limited to the volume hard disk, of course, the limit, but before its achievement volume hard disks And, moreover, flash drives should increase for many orders. Supports this file system. All sizes of clusters, standard, among which is considered a 4 KB data block.

Free space volume is divided into two parts: about ~ 12% of them occupies a metafile. Recording other data to this area will not work. Even when the metafile takes an insignificant volume, its reservation will decrease by 2 times. The rest of the space is available to the user under the storage of its information.

The main metafile MFT is a file table. It is divided into areas of 1 KB, each of which is stored a record about one of the documents posted in the section, including the metafile itself, oddly enough. The first metafiles are of official character and are the key to the functioning of the logical partition or flash drive. They are stored in the middle of the disc / flash drive, which is a security deposit and improves the reliability of the data carrier.

MFT stores all information about all partition files (their size, location in the form of cluster addresses or memory cells in order to appeal to them, attributes). Also in the table stored files that take tens and hundreds of bytes (up to 1 KB). Any document in NTFS is a data flow, which is very convenient, for example, in the case of adding a performer or author of the document. In conventional method This data is not always possible, but for this there is a lot of utilities. Document dimensions are displayed as real, not including "attached" streams. It happens that after deleting a file occupied by several kilobytes, hundreds of megabytes are exempt. All because a stream of released megabytes was attached to it.

File and catalog names in NTFS can reach the lengths of 255 characters in Unicode, and the number of documents stored in the same directory cannot exceed 65635, which is 64 to. Directories are a file link, where the list of documents that are stored in it , With the observance of the hierarchy.

NTFS is a reliable and self-sufficient file system capable of making it in order after failures due to the use of the so-called transaction method, when the action is performed completely or not performed at all. If it is simpler, then patient or healthy, or not, patients, in NTFS interpretation, can not. For example, if when copying a file it turns out that it is not enough space for it (there is a parallel recording of multiple files, otherwise the operating system warns about the lack of free space on the disk) or part of the document falls on the damaged block, such a record is considered to be an unproved and the process is discouraged. All transactions are also canceled, which are carried out before turning off the power or by pressing "Reset", which makes unpredictable results: the place is indicated by free, and the MFT indices are returned to the previous position. Thanks to this, the power failure during high disk activity will not require even the launch of the chkdsk utility, because no failures in the file system will not occur.

Falov fragmentation in NTFS is one of its main problems that are not solved over several decades of its existence. It consists in the following: the MFT zone reserves the first 12% disk space, and when the disc is filled to 85 and more percent, this zone decreases 2 times and so several times. Thus, the drive will have several "endings". The result is the highest fragmentation of files recorded in the area that has been reserved under the MFT. Also, the files are quite well fragmented and with a large amount free space On the drive. This happens due to the imperfection of the algorithm for the detection of free sectors.

Additional features of the NTFS file system:

  • the Hard Links feature or a rigid link is rarely used option. It allows you to carry several names to one file and be in several directories at the same time (perfectly implemented in Total Commander. as well as nTFS program Links;
  • Symbolic Links - the ability to create virtual directory. Used to set shorter ways to folders stored in the wilds of your disk;
  • encryption - any type of data is easy to encrypt, in order to avoid contacting confidential information in other people's hands.

From the above, follow the main advantages of NTFS in front of FAT:

  • the maximum amount of the file being occupied is 264 GB against 232 \u003d 4 GB in FAT;
  • the presence of encryption, archiving, user rights, quotas;
  • automatic recovery after errors;
  • actual unlimited section size;
  • more efficient use of free space (fragments of multiple files can be enrolled in the cluster);
  • quick file search;
  • high reliability;
  • support for long addresses to documents and long file names.

Disadvantages of the NT file system:

  • reduced speed in comparison with FAT and HPFS;
  • significant data fragmentation, reduced the efficiency of the drive;
  • the need to carry out regular defragmentation;
  • extremely low speed of work filled by more than 80-85% of the drive.

3. Format a USB flash drive in Windows 7, 8, 10

The process of creating new file Structure Flash drive, that is, its formatting, in the latest editions of Windows occurs in a similar way. No differences in the process are observed, unless with the exception of options for calling some windows.

Before starting formatting, you should close all programs using a flash drive, otherwise Windows issues an error about the impossibility of performing this process due to the use of a flash drive of any service or program, as in the screenshot.


  1. We attach the drive to the computer.

    We are waiting for the emergence of autorun and / or scanning a flash drive for the presence of viruses and malicious applications on it installed antivirusIf this feature is activated in it.

  2. Call context menu Drive and choose "format ...".
  3. In the formatting window that appears, we specify the following parameters:

    • file system - NTFS;
    • cluster size is standard or 4096 bytes (it is standard);
    • tom label - Set the name of your flash drive or leave the field empty;
    • method of formatting - Depending on formatting purposes, the field can be left blank, to fully zeroing the flash drive and checking for defective sectors, or make only cleaning the main file table.

    As for the name of the flash drive (Tom label), it is easy to change it. Just call the context menu of the drive and select "Properties". In the appeared window in the first tab we are looking for the name of the flash drive (in our case, Win7) and change on the desired one.

    At the end, be sure to click "Apply" and close the window by clicking on the "OK" button.

  4. The operating system will request confirmation of the user, notifying that all information on the carrier will be destroyed. Before confirming, be sure to make sure that there are no important files on the media or they are copied to hDD. The recovery procedure of lost documents may take a long time and will not be crowned with success.
  5. Confirm the launch of the formation of a new file structure of the flash drive with checking the microcircuits of its memory to defects or without it by clicking on "OK".
  6. We are waiting for the operating system to formatting.

    During the successful execution of the operation, the next species window will appear.

    In no cases, do not turn off the computer and do not remove the USB port flash drive during the course of this process.

    Close it by clicking on the "OK" button.

    Our flash drive is formatted in a file nTFS system And ready to work.

The formatting of the drives can also be made by several alternative ways, but the meaning of operations will remain the same.

Through the command line


The flash drive is formatted and ready to use.

4. Formatting a flash drive in NTFS under Windows XP

In general, the process of formatting removable drives from the moment windows output XP did not change in more than a decade. The only feature of this procedure in obsolete, but still popular XP, is that the creation of the NTFS file structure in this edition operating system Unavailable by default and we will have to manually activate this feature.

    To do this, go to the Device Manager.

    It can be caused by one of the following methods.

    1st way:


    2nd Method:


    After calling the window with a list of equipment, one of the methods switches to the next chain of action.

  1. Deploy "Disk Devices" by click on the triangle near the inscription.
  2. In the list of media list, choose our flash drive, focusing on its name, where JetFlash is present, the manufacturer's name or volume.

    Call its context menu and select "Properties".


  3. In the dialog box, we translate to the third tab called Tomas.
  4. Go to the second tab "Politics".
  5. We carry the radio switch to the "optimal performance" position in order to enable the caching option windows files For quick search.

In this case, it is necessary to use the safe removal of the drive during its disconnection from the computer, because the operating system can work with a flash drive at the moment when the user extracts it from a USB connector.


5. Format using the HP USB Disk Storage Format Tool program

HP USB Disk Storage Format Tool - a simple portable utility for creating a file structure and boot sectors on flash drives. One of the shortcomings of the program is the absence of the ability to specify the size of the sector of the future USB file system.

Formatting a flash drive in the NTFS file system through HP USB FT is extremely simple.

6. Through the built-in File System Conversion Utility Convert.exe

Windows has another tool for generating a removable drive file structure. Its important feature is the function of converting file system storage systems without deleting data from them. That is, using the built-in in Windows Utilities You can easily convert FAT32 file system to NTFS. There is no reverse function in convert.exe.

This is done using the command interpreter.


As a rule, formatting a flash drive in NTFS makes sense only in the case of copying to it huge size Files that exceed 4 GB. That is, using the FAT32 file system on a carrier, up to 4 GB, is quite logical. In addition to all the advantages listed by little above, this file system has a number of shortcomings. Among them are:

  • significant fragmentation of files that contributes to accelerated carrier wear;
  • lower device performance, especially in cases of practically full file fill, even when compared with the HPFS predecessor and even outdated FAT.

The recovery system after failures in NTFS is also a stick about two ends. On the one hand, it allows you to eliminate the consequences of errors that have occurred damaged memory cells or disabling the device from the network, but with another, it is poured into the mandatory removal of the flash drive before it is turned off, and the likelihood of losing many data recorded on the device immediately before turning off it.

The journaling function to use on flash drives is not recommended due to the more active wear of its memory cells. As far as this process is active - depends on the frequency of its use. Also, you should not use archiving (compression) on removable UBS drives due to the same process of accelerated wear of the cells of their memory.

First we will deal with the question - why format flash drives

Oddly enough, the main reason for formatting is not viruses on Flashkee, And the inability to record the file on the USB flash drive more than 4 gigabytes. Some users faced such a problem, like a flash drive at 8 gigs A write on a flash drive movie, iSO image, folder and other files - it does not work. Many manufacturers produce flash drives in format FAT32.And Fat32 does not support the transfer of large files. The maximum file size that can be written on the FAT32 flash drive should not exceed 4 gigabytes (). For this format format flash drives fAT32. in nTFS.

Formatting allows you to get rid of viruses on a flash drive. If you checked the flash drive to viruses with and and they did not find anything, but you have a suspicion that on a flash drive virus - It is better to format it.

Another reason for formatting is the slow work of the flash drive. After deletion unnecessary files There are empty places (clusters). As a result, the flash drive began to work slower - the format of the flash drive will help speed up her work.

The same formatting must be made before creating a loading flash drive. If you want to install Windows to install from it, write to USB Live CD, the program to restore the system is first you first need to format the flash drive.

In principle, all the main answers to the question why format a flash drive.

Types of formatting

There are two formatting types - fast and complete. What are the differences between them? With quick formatting, only the file and MFT layout table is cleared, i.e. data that were on the flash drive can be restored. With full formatting there is a complete destruction of data - overwrite with zeros.
Full formatting Usually applied by faults - for example, when writing and reading the flash drive.

Formatting methods

You can format flash drives using the operating system itself or using software for formatting, for example or.

Formatting using OS Windows

IMPORTANT: Copulate before formatting files from flash drives on a hard disk or other drive, which would not have to restore files using !!!

The easiest and affordable formatting method. Right-click on the flash drive icon and select Formatting.

Formatting in such a way fat. in nTFS It is impossible, you can not change the size of the cluster and the flash drive capacity. You can only assign a volume label (name, name) - how to be called flash drive on your or other computer.

.

If you check the box to the Fast formatting point, the table of contents will be cleaned (the difference between full and fast formatting is given above).

About the buttons "Start" and "OK" I think to explain not worth it. After formatting you will see such a picture

The second formatting method using Windows

You can format a USB flash drive on the command prompt. For this, it is enough to know the letter of the volume (in this case, the flash drive). Open CMD and register for example such a command.

format L: / FS: FAT32 / V: Lamerkomp

where format. - this is formatting, L. - Letter volume (disk, flash drive, etc.) which will be formatted, fS. - the file system in which formatting (FAT or NTFS) will be performed and v. - This is a label (name) and press ENTER.

So you can register extra options: Q is, a - the size of the cluster. If you want to know about them in more detail, enter help Format. In the command prompt and press ENTER.
note: letters are all prescribed by the Latin alphabet, the register is unimportant.

The described methods are good for formatting a flash drive from FAT in FAT, from NTFS in FAT, if necessary uSB flash drive of fat in NTFS - Use.

Useful on the topic of the flash drive

Not all users know how to format the USB flash drive using the command line. Although this method is the most efficient and convenient solution that allows you to quickly change the media format. Therefore, we want to tell you in detail about this operation, various concomitant nuances and features.

The formatting procedure may be needed in a variety of situations:

  1. Suppose you need to quickly delete all the files stored on the flash drive.
  2. Another option - you want to completely clean the media from viruses and malicious software.
  3. Change the file system format. For example, with FAT32, where there are restrictions on the size of the recorded files, on NTFS.
  4. Tired of slow work flash drive? Or does the device sees it, but only gives the window with errors when connected? Formatting will again be useful and, most likely, will help to correct the problem.
  5. Also, quite often, users resort to this procedure if you need to correct the errors on the drive that interfere with reading or writing files.
  6. If you need to create a loading flash drive, then again do not do without formatting.

As you can see, there are a lot of situations in which this operation is useful and indispensable. So it will be useful for you to learn how to format a flash drive through command line.

Through the format command

This is the most common way. With it formally you do everything the same as if I used standard windows. But in this case the command line is activated. At the same time, there is nothing complex:


In addition, instead of the above command, you can enter the other slightly modified. It looks like this - "Format / FS: NTFS H". "N" - in this case, the drive you need. If you need to change the file system to FAT32, the command should look like "Format / FS: FAT32 H".

For reference! If your flash drive is bad, the information from it is not read, but new data, on the contrary, are not recorded, it remains to be resorted to at least low-level formatting. To do this, use not a command line, but a special utility. For example, the program HDD LOW. Level Format Tool.

Using the "diskpart" utility

Run the formatting of the flash drive via the command line can be in one way. This involves a special built-in utility, which serves to control the disk space. It is called diskpart.

To use the drive to format it, do this:


Now after formatting through the diskpart, the USB flash drive can be done boot. It is enough to copy the operating system distribution files to the carrier.

What else should I know the user? Work on the command line with the built-in utility diskpart Recommended in cases where the flash drive fails to format simple way From the Explorer menu. If, when working with a removable carrier, you noticed that part of the file system is not visible or for incomprehensible reasons has decreased its volume, it is also desirable to format the method described above.

Format flash drive SDFormatter utility

In case, if formatting methods are not suitable via the command line (for example, it seems uncomfortable), we can advise the SDFormatter graphics utility. It contains only two formatting options, while you can configure the cluster size. You can download the program by

One way to format the USB flash drive is to use the command line. Usually it is resorted to it in the case when standard means It is impossible to do this, for example, due to the error. How to format through the command line, we will look at further.

We will look at two approaches:

  • through the command "Format";
  • through the utility "Diskpart".

Their difference is that the second option is treated in more complex cases when the flash drive does not want to format.

Method 1: The "Format" command

Formally you will do the same as in the case of standard formatting, but only by the tools of the command line.

Instructions in this case looks like this:


If an error occurs, you can try to do the same, but in « safe mode» - So no extra processes Do not prevent formatting.

Method 2: Utility "Diskpart"

Diskpart - special utility To control the disk space. Its wide functionality provides for the formatting of the carrier.

To take advantage of this utility, do this:



So you can ask everything necessary settings Formatting a flash drive. It is important not to confuse the letter or the disk number so as not to erase the data from another media. In any case, to fulfill the task is easy. The advantage of the command line is that all Windows users have this tool without exception. If you have the opportunity to take advantage special programs To delete, use one of those specified in our lesson.

The appliance format affects the recording speed and reading information. If your flash drive works slowly, it is time to change its format. Earlier we wrote about how standard method Change the carrier format with FAT32 on NTFS, however, it may occur when this method It will not work. In this case, the method of formatting the media via the command line will be able to solve the task.

Formatting flash drive via the command line

To format the USB flash drive via the command line, you should perform the following steps:

  • We connect the USB flash drive and click "Win + R". The "Run" service window appears. Enter the "CMD" command.
  • The command line opens. We enter "diskpart" to start the disk space management utility.

  • Next, enter "List Disk" to see the list of drives and determine the number of your flash drive in this list.

  • We remember the disk number and enter the command "SELECT DISK 1", where "1" is the number of the flash drive.

  • Now, after selecting the disk it needs to be cleaned of attributes. To do this, the ATTRIBUTES DISK Clear Readonly command is intended. First we enter it, and then we prescribe "Clean".

  • When the flash drive is formatted, you need to create a primary partition. We enter "CREATE PARTITION PRIMARY".

  • To change the format of a flash drive with FS to FAT32, you should enter "Format FS \u003d FAT32" or "Format FS \u003d NTFS" to set NTFS format.
  • Starts the formatting of the media.

  • Upon completion of the operation, you should enter "EXIT" to exit.