/ / Formatting flash drives via the command line without data loss

Formatting the flash drive via the command line without losing data

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

A bit about file systems and their differences

The Windows OS line since its release uses the FAT file system for operation. Its more advanced version is FAT32. After it comes NTFS, which appeared in Windows XP.

formatting a flash drive via the command line

Differences in file system representative dataconsists in limiting the size of files and sections. FAT16 can use up to 2 GB, FAT32 can use up to 4 GB for a file and 8TB for a volume. More modern NTFS can manage files and partitions up to 16 exabytes. However, it has a limit on the length of the path, which must be no more than 255 characters.

Компания Apple использует файловую систему HFS+ for your technique. It also has a limit on the length of the path or file name to 255 characters. It is worth remembering when automatically creating documents or saving them. File and partition sizes can be up to 8,000 petabytes.

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

formatting a flash drive via the command line diskpart

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

How to format a flash drive via the command line

Newer and more modern is considered fileNTFS system. It can work effectively with large sections and files. In addition, its performance is much higher than its predecessor. Also, reliability when placing data on a partition and indexing it helps to take up more optimized space for both performance and volume.

formatting a flash drive via the command line without data loss

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

Standard operating system tools

Все ОС семейств Linux и Windows оснащены штатными utilities capable of formatting a flash drive via the command line. First you need to deal with the Windows system. It has a utility for formatting a flash drive via the command line - diskpart. Since this is a system program and affects important areas of the OS, then you need to run it as an administrator.

You can do it in Windows by going to the “Start” menu, then “All Programs” - “Standard”. Here you need to right-click on the item "Command line" 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 transmitted through the utility and executed by it.

formatting a flash drive via the command line fat32

In order to start the formatting process,you need to type format Z: / FS: NTFS. Here Z means the drive letter of the flash drive. And the FS key and the NTFS instruction tells the utility that it is necessary to format the disk in 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 the flash drive via the command line without losing data

Actually it is impossible to perform this task.You cannot format a disk without erasing the 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, as described above. Next you need to 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 labeled 0, 1, 2, and so on.

formatting a flash drive through the windows 7 command line

Now, using the select disk 1 command, the required drive will be selected. Next, run convert ntfs. Then specified the disk will findyot NTFS file system.

other methods

Before that, formatting techniques were shown.flash drives via the Windows 7 command line. But what if you need to perform this procedure under Ubuntu or Debian? Next will be described the method of formatting a flash drive via the Linux command line.

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

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

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

df -h

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

formatting a flash drive via linux command line

Now you can format the flash drivethrough the command line. For this there is a built-in mkfs command. She needs to pass several parameters to the input. First is the file system. In this case, ntfs. By the way, this utility can format the flash drive via the command line in fat32. Next, you must specify the name or label for the drive. And finally - the path to the flash drive. In the end, should get this form:

mkfs.ntfs tagname / dev / sdb1.

After the process is complete, you will get a flash drive with a new NTFS file system.

Third-party programs for formatting

Some manufacturers of removable drives haveown 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 the most commonly used products:

  • HP USB Disk Storage Format Tool. Probably the most famous program. Its interface is simple and resembles the standard windows of the operating system.
  • Transcend Autoformat. This utility is used mainly for mobile storage formats - SD, MMC, CF.
  • HDD Low Level Format Tool.Low-level formatting utility. Sometimes it helps to bring a flash drive or hard disk back to life. It supports many devices and has wide functionality.
  • SD Formatter is a very simple and easy program. Used mainly 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 of formatting, without of application command line.Using a graphical interface, you can also easily accomplish 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 also more complex and multi-stage methods of resuscitation of flash drives. They use special programs oriented separately on each controller drive. But this information is beyond the scope of this article.