Format Flash Drive Mac Command Line

In some cases, you may need to format a USB flash drive or hard disk using the command line. For example, this can be useful when Windows cannot complete formatting, as well as in some other situations.

Once you have found the proper drive to erase, just copy its identifier so you can use it for the next command. Then pick a name and a system format type. This is the syntax we need: Diskutil eraseDisk FILESYSTEM DISKNAME DISKIDENTIFIER. Let’s say the disk I want to erase has “/dev/disk5s2” as its identifier and I’m going to use Mac OS Extended Journaled (JHFS+) as the system format type and name it “Empty”. The syntax is going to look like this: Diskutil eraseDisk JHFS+ Empty. Formatting a Disk to MS-DOS fat32 from the Command Line in Mac OS X. Diskutil eraseDisk FAT32 DiskNameGoesHere /dev/DiskNodeIDHere. Formatting a Disk to ExFAT from the Command Line in Mac OS X. Diskutil eraseDisk ExFAT DiskName /dev/DiskNodeID. Again, any of these commands erase the entire target disk and obliterates any data on it.

This guide will detail how to format a USB flash drive or hard disk using the command line in Windows 10, 8 and Windows 7, as well as an explanation of when which methods will work best.

Note: formatting removes data from the disk. If you need to format the C drive, you will not be able to do this in the running system (since the OS is on it), but there are ways, nevertheless, which is at the end of the instruction.

Using the FORMAT command from the command line

Format is a command for formatting drives on the command line, existing since the days of DOS, but working properly in Windows 10. With it, you can format a USB flash drive or hard disk, or rather, a partition on them.

For a flash drive, it usually does not matter, provided that it is defined in the system and its letter is visible (since they usually contain only one partition), it can be for a hard disk: with this command you can format only partitions individually. For example, if the disk is divided into sections C, D and E, with the help of format you can format D first, then E, but not merge them.

The procedure will be as follows:

  1. Run the command prompt as administrator (see How to start the command prompt as administrator) and enter the command (an example is given for formatting a flash drive or a hard disk partition with the letter D).
  2. format d: / fs: fat32 / q (In this command, after fs: you can specify NTFS to format not in FAT32, but in NTFS. Also, if you do not specify the / q parameter, then not fast, but full formatting will be performed, see Fast or full formatting of the flash drive and disk).
  3. If you see the message 'Insert a new disk into drive D' (or with a different letter), just press Enter.
  4. You will also be prompted to enter a volume label (the name under which the disc will appear in the explorer), enter at your discretion.
  5. Upon completion of the process, you will receive a message stating that the formatting is over and the command line can be closed.

The procedure is simple, but somewhat limited: sometimes it is necessary not only to format the disk, but also to delete all partitions on it (that is, to merge them into one). Here format will not work.

Formatting a flash drive or disk in the command line using DISKPART

The Diskpart command line tool, available in Windows 7, 8 and Windows 10, allows you not only to format individual sections of a flash drive or disk, but also to delete them or create new ones.

First, consider using Diskpart for simple partition formatting:

  1. Run a command prompt as administrator, type diskpart and press Enter.
  2. In order, use the following commands, pressing Enter after each.
  3. list volume (here pay attention to the volume number corresponding to the drive letter that you want to format, I have 8, you use your number in the next command).
  4. select volume 8
  5. format fs = fat32 quick (instead of fat32, you can specify ntfs, and if you need not quick, but full formatting, do not specify quick).
  6. exit

This completes the formatting. If you need to delete all partitions (for example, D, E, F and others, including hidden ones) from the physical disk and format it as a single partition, you can do it in a similar way. In the command line, use the commands:

  1. diskpart
  2. list disk (you will see a list of connected physical disks, you need a disk number to be formatted, I have it 5, you will have your own).
  3. select disk 5
  4. clean
  5. create partition primary
  6. format fs = fat32 quick (instead of fat32 it is possible to specify ntfs).
  7. exit

As a result, there will be one formatted primary partition with a file system of your choice. This can be useful, for example, when a flash drive does not work correctly due to the fact that it has several partitions (about it here: How to delete partitions on a flash drive).

Command line formatting - video

Finally, what to do if you need to format the C drive with the system. To do this, you will need to boot from the boot drive from the LiveCD (including utilities for working with hard disk partitions), a Windows recovery disk or an installation USB flash drive with Windows. Those. It is required that the system is not started, since it is deleted when formatting.

If you booted from a bootable Windows 10, 8 or Windows 7 flash drive, you can press Shift + f10 (or Shift + Fn + F10 on some laptops) in the installation program, this will bring up a command line where C formatting will already be available. Also, the Windows Setup program when selecting the 'Full installation' mode allows you to format the hard disk in a graphical interface.

Using flash drives like pen drive, SD card, memory card, microSD card, external hard drives has become so common today. But, sometimes it happens that due to some unexpected reasons, your flash drives get corrupted or damaged. It becomes so frustrating situation then and people get confused and don’t get anything to do.

So, keeping in mind, I am here going to tell you how to fix a corrupted flash drive using CMD option. But, before we move on to the fixing solution, let us have a look at the real practical scenario of a user who has shared his experience of a corrupted flash drive.

Corrupted USB flash drive is an old age problem. Almost every computer user has faced this common problem. It doesn’t matter what you do, at some point of time, your computer will reject to read your USB drive. But, have you ever thought about how USB flash drive gets corrupted?

Well, there could be various causes that can make your USB flash drive corrupted or damaged. Some of the causes are mentioned below:

Causes That Can Make Your USB Flash Drive Corrupted

  • Virus or malware infection.
  • System files corruption.
  • Availability of bad sector.
  • Connecting USB flash drive to multiple PCs or Mac.
  • And so on…

It doesn’t matter whatever the causes are, there are few effective solutions that you can follow to know how to fix a corrupted flash drive.

And one of the popular methods to fix corrupted flash drive is by using CMD command.

So, here comes the solution section – how to repair a corrupted flash drive using CMD (command prompt)?

How To Fix Corrupted Flash Drive Using CMD (Command Prompt)

The CMD command which is also known as the command prompt is one of the high rated and successful solutions to repair corrupted, not working, damaged or unrecognized flash drive, pen drive, SD card or hard drive. It can also be used to repair corrupted external hard drive, SSD or HDD with ease.

Format Mac Drive On Pc

Note: The solution works great on Windows 10/8/8.1/7 computer.

Below, follow the steps:

Step 1: Connect the corrupted flash drive (pen drive, memory stick, SD card or external hard drive) to your Windows computer.

Step 2: Click START and type CMD in the search bar and hit ENTER to open the command prompt. Alternatively, you can also open command prompt by pressing Windows Key + R followed by typing CMD in the RUN box that pops-up.

Step 3: Now in the command prompt box, type the following commands:

  • Type diskpart and hit ENTER button. After this type list disk and hit ENTER button.

Step 4: Next, type select disk followed by the number of your disk and press ENTER button. After your disk gets selected, type clean and press ENTER button.

Step 5: Next type create partition primary and hit ENTER.

Step 6: After this type active and press ENTER followed by select partition 1.

Step 7: Finally, in the last step type the following command format fs=fat32 and hit ENTER button.

A screenshot of the process is given below.

After the completion of the process, you should find your USB drive working as good as new.

Format flash drive mac command line download

Alternatively, there is another step to fix/repair corrupted USB flash drive using CHKDSK command.

Repair Corrupted USB Flash Drive Using CHKDSK Command

Below follow the steps:

Format thumb drive mac command line

Step 1: Connect the corrupted flash drive to your PC.

Step 2: On your computer click Start and type CMD in the search bar and hit ENTER.

Step 3: A new command prompt window will get open.

Mac

Step 4: Now type the following command: chkdsk /X /f H: or chkdsk H: /f and hit ENTER. Here you need to replace the H: drive with your corrupted pen drive/SD card/USB drive.

Just wait for the process to get complete and then you should find your USB flash drive working as good as new. Also, with this, you will be able to know how to recover corrupted files from USB using CMD.

Expert Tip: Recover Lost Data From Corrupted USB Flash Drive

While performing the above solutions to fix corrupted USB drive, you may encounter data loss from your flash drive. So, after fixing a corrupted USB flash drive, it is important that you get all the data back from such a drive. So, here, you can try USB Flash Drive Recovery Tool to and know how to restore lost data from USB flash drives. The best thing about this flash drive recovery software is that it is available for both Windows and Mac computer.

With the help of this photo recovery software, one can:

  • Easily get back inaccessible or lost pictures, videos and audio files from corrupted USB flash drive
  • Recover digital media files from corrupted pen drive, SD card, memory stick, hard drive, camera card
  • Also retrieve media files from unreadable, damaged, write-protected or unrecognized USB flash drive
  • 100% read-only. Safe, secure and easy to use


* Free version of the program only scans and previews recoverable objects.

Steps To Recover Files From Corrupted USB Flash Drive

Step 1: Select Desired Location

Firstly, select the drive, external media or volume from which you want to recover deleted media files. After selecting, click on 'Scan'.

Step 2: Preview Recovered Media Files

Next, you can preview the recoverable media files after the scanning process is completed.

Step 3: Recover Media Files

Lastly, you can select the images, audio, video files you want to restore and click on 'Recover' option to save them at the location you want.

Bonus Tip: People Have Also Asked

How Can I Repair My USB Flash Drive?

Well, as mentioned above, you can follow the above command prompt (CMD) to repair corrupted USB flash drive, SD memory card, memory sticks.

On the other hand, if you know that your USB flash got corrupted due to virus infection, then run anti-virus tool to scan your corrupted SDcard, USB flash drive, etc

For detailed information please visit: Learn To Remove Virus From SD Card Without Formatting It(though it is mentioned SD card you can follow the same solution to remove virus from your virus-infected USB drive).

How Do I Remove Write Protection?

Many USB drives, memory stick, pen drive, SD card come with the feature of write-protection.

But sometimes it creates problems and when it creates a problem then users are not able to access files from write-protected USB flash drive, SD card, pen drive, etc.

How Do You Fix An Unrecognized USB?

Well, there are also many users out there, whose USB drive does not get detected or does not get recognized by the computer.

In such situation, they look for the solution on how to fix an unrecognized USB drive?

Well, if your USB drive, pen drive, SD card or external hard drive does not get recognized by your computer, then please follow the related links mentioned-below and find out the best solution for your problems and get fixed your unrecognized USB/SD card or pen drive.

Conclusion

I hope after you try the above solution, you will be easily able to fix corrupted USB flash drive and know-how to recover corrupted files from USB using CMD.

This tutorial will definitely not let you down, so just try the solution with the step by step instructions mentioned above. And, if you notice that the data you have saved in the flash drive has been lost the try USB Flash Drive Recovery Tool.

This tool will definitely help you restore lost data from USB flash drive in no time. So, all the very best guys.


Format Flash Drive Mac Fat32

Alex is an expert technical writer with 7+ years of experience. His in-depth knowledge about data recovery and fascination to explore new DIY tools & technologies have helped many. Alex has a great interest in photography and loves to share photography tips and tricks with others.

Format Thumb Drive Mac Command Line

  • Shares