Formatting a flash drive through the command line without data loss

Without flash drives today it is difficult to imagine the modern life of an office or an ordinary user. Transferring data from computer to computer, submit a report or save something important and sacred - all this is possible thanks to removable storage media. All flash drives shipped from the factory are already formatted. Typically, their file system is FAT32. In the modern world, it is already outdated, as it has several significant drawbacks. Among them are the impossibility of moving files larger than 4 GB to a USB flash drive, as well as the restriction on the size of hard disk partitions.

A little bit about file systems and their differences

Since the release, Windows has been using the FAT file system for operation. Its more advanced version is FAT32. It is followed by NTFS, which appeared in Windows XP.

formatting a flash drive via the command line

The differences between these representatives of file systems is the restriction on the size of the placed files and partitions. FAT16 can use up to 2 GB, FAT32 - up to 4 GB for a file and 8 TB for a volume. More modern NTFS can manage files and partitions up to 16 exabytes. However, it has a limit on the path length, which should be no more than 255 characters.

Apple uses the HFS + file system for its technology. It also has a limit on the length of a path or file name of 255 characters. This is worth remembering when automatically creating documents or saving them. Files and partitions can be up to 8,000 petabytes in size.

Linux distributions use the ext file system line . Its latest version is ext4, which has been implemented so far since 2008.

formatting a flash drive through the diskpart command line

Interestingly, Linux systems can easily work with the FAT, FAT32 and NTFS file systems. But the Windows environment does not even see ext and derivative partitions without additional software.

How to format a flash drive through the command line

The newer and more modern is the NTFS file system. It can work effectively with large partitions and files. Moreover, its speed is much higher than its predecessor. Also, reliability when placing data on a partition and its indexing help to occupy a place more optimally for both performance and volume.

formatting a flash drive through the command line without data loss

In order to format a flash drive via the command line from FAT32, there are several ways in NTFS.

Standard operating system tools

All operating systems of the Linux and Windows families are equipped with standard utilities that can format a flash drive through the command line. First you need to deal with the Windows system. It has a utility for formatting a flash drive through the command line - diskpart. Since this is a system program and affects important areas of the OS, you need to run it on behalf of the administrator.

You can do this in Windows by going to the "Start" menu, then "All Programs" - "Standard". Here you need to right-click on the item "Command Prompt" and select "Run as administrator."

A command prompt window will open. It is enough to type diskpart and press "Enter". Now further input of commands will be broadcast through the utility and executed by it.

formatting a flash drive via the fat32 command line

In order to start the formatting process, type format Z: / FS: NTFS. Here Z means the drive letter of the flash drive. And the FS key and the NTFS directive tells the utility that it is necessary to format the drive specifically to the NTFS file system.

The only drawback of this method is that if there were files on the flash drive, they will be hopelessly lost.

Formatting a flash drive through the command line without data loss

In fact, this task is impossible. You cannot format a disk without erasing data. But you can convert from one file system to another. The diskpart utility can also help here. How to run it from the administrator is described above. Next, enter the list volume command. It will display a list of all available partitions and disks with their letters and volumes. The next command is list disk. It will show the presence of all physical drives in the system. Discs can be marked with numbers 0, 1, 2, and so on.

formatting a flash drive through the windows 7 command line

Now, using the select disk 1 command, the desired drive will be selected. Next, convert ntfs is executed. After that, the specified disk will acquire the NTFS file system.

other methods

Before that, we showed how to format a flash drive through the Windows 7 command line. But what if you need to perform this procedure under Ubuntu or Debian? Next, a method for formatting a flash drive through the Linux command line will be described.

More precisely, it is called a terminal or console in Linux. You can open it by pressing Ctrl + Alt + T. Then you need to see a list of connected devices. This allows the fdisk -l command.

In this case, the flash drive is listed as / dev / sdb1. On Linux, to work with changing partitions or disks, you need to unmount them. This is necessary in order to access data that may be currently occupied.

But in order to accurately verify that the drive is unmounted, you should type a simple command:

df -h

After pressing Enter, a list of all the devices that are currently mounted is displayed on the screen. If something like / dev / sdb1 is present in it, then it means you have to disconnect it. This is done with the umount / dev / sdb1 command.

formatting a flash drive via linux command line

Now you can format the flash drive through the command line. There is a built-in mkfs command for this. She needs to pass several parameters to the input. The first is the file system. In this case, ntfs. By the way, this utility can format a flash drive through the command line in fat32. Next, you need to specify a name or label for the drive. Well, the last - the path to the flash drive. As a result, it should look like this:

mkfs.ntfs label_name / dev / sdb1.

After the process is completed, a flash drive with a new NTFS file system will be obtained.

Third-party formatting software

Some manufacturers of removable drives have their own software for fast and reliable formatting in a convenient graphical interface. There are also programs from third-party developers. The following is a list of commonly used products:

  • HP USB Disk Storage Format Tool. Probably the most famous program. Its interface is simple and resembles standard windows of the operating system.
  • Transcend Autoformat. This utility is mainly used for mobile storage formats - SD, MMC, CF.
  • HDD Low Level Format Tool. A utility that performs low-level formatting. Sometimes it helps to bring a flash drive or hard drive back to life. It supports many devices and has wide functionality.
  • SD Formatter is a very simple and easy program. It is mainly used for formatting flash drives for mobile devices. The interface is simple and straightforward, and the license to use it is free.

Conclusion

Many operating systems have more elegant ways to format without using the command line. Using the graphical interface, you can also easily perform this task. Formatting a flash drive through the command line is intended mainly for a low-level process, when other methods do not help.

There are more complex and multi-stage ways to reanimate flash drives. They use special programs that are oriented individually to each drive controller . But this information is beyond the scope of this article.


All Articles