Format Flash Drive Mac Command Line

Summary :

If a USB drive is corrupted/damaged, or needs to be formatted, you can easily format USB by using CMD on Windows 10/8/7. This tutorial includes a detailed guide. However, any disk formatting will erase all data on the disk, so you should back up all needed data beforehand. To recover data from formatted USB, you can try MiniTool Power Data Recovery.

Quick Navigation :

In this note i will show how to format an external HDD, SSD or USB flash drive in Linux from the command line using mkfs utility. I will provide the examples of disk formatting to the most popular file system types: FAT32, exFAT, NTFS, EXT4, XFS and will show how to list the all supported file systems. Format USB flash drive to FAT when there is no FAT option on format window. Add Tip Ask Question Comment Download Step 1: Why There Is No FAT Option on Format Window. Most external drives ship in formats that are universally recognised amongst nearly all operating systems (FAT, I’m looking at you), but there may be times where you might want to completely wipe a drive and/or set it up to be compatible with Apple’s Mac lineup only. Either way, you’ll want to format your drive accordingly.

USB flash drive is widely used for storing and transferring files. But sometimes you may need to format the USB drive because of corrupted file system, data corruption issues, bad sectors, virus infection, etc. This post gives a step-by-step guide for how to format USB using CMD, namely the Windows built-in free DiskPart command tool, on Windows 10/8/7.

Windows comes with a built-in format disk option to erase everything from a USB flash drive. This is accessible from a simple right-click, but at this stage it probably won’t work. If you no longer need the data in the removable media, the command-line tool is a better way to help you get to the root of the problem and fix the storage space. This tutorial will show you the basics on how to use the command-prompt-based program called diskpart. I will be showing how to format HDDs and USBs using t.

Line
Note: Disk formatting will wipe all data on the disk. If the USB flash drive can still be recognized by computer, you can connect it to computer and copy needed files to another device. If the USB can’t be recognized by computer, you may try some tips to see if you can make it visible on PC before you use Command Prompt to format it.

How to Format USB Flash Drive/Pen Drive Using CMD on Win 10

Step 1. Open Command Prompt on Windows 10

You have several ways to open Command Prompt on Windows 10. One easy way is: press Windows + R, type cmd in Run dialog, press Ctrl + Shift + Enter and click Yes to run Command Prompt as administrator.

Step 2. Open DiskPart command tool

Next you can type the command diskpart in Command Prompt window. Press Enter to launch DiskPart utility.

Step 3. List all disks on PC

Then you can type the command list disk, press Enter and all detected disks will be displayed with detailed information. Check carefully which disk is your USB drive. You may identify the USB by checking the size. Here, my USB is Disk 3.

Step 4. Select and clean the target USB drive

Type the command select disk 3 and press Enter to select the target USB flash drive. Then type clean command and press Enter. DiskPart will wipe disk data.

Step 5. Format USB flash drive/pen drive with CMD (Command Prompt)

Tip: Before you format USB using CMD, you can confirm again that you’ve selected the right disk, to avoid formatting the wrong disk. You can type list disk command again, press Enter, and the selected disk should have a “*” mark before the disk number.

After that, you can type the command create partition primary, and press Enter.

Then type the command format fs=ntfs or format fs=fat32, and press Enter to format the USB flash drive to NTFS or FAT32 format. Optionally you can add a “quick” flag after the command for a faster format.

Step 6. Assign a drive letter for the USB

Continue to type the command assign letter=h, replace “h” with the preferred drive letter you want to assign to the USB drive. Press Enter to assign a letter for the USB drive and make it visible in Windows File Explorer.

Type exit to close DiskPart and type exit to close Command Prompt window.

After formatting the USB flash drive in CMD (Command Prompt), the USB drive should be shown in Windows File Explorer and is available for storing files.

Format USB Flash Drive for Free with Software

Mac Command Line

Actually, you can easily format a USB flash drive on Windows 10 by using File Explorer. You can connect your USB to your Windows computer, open File Explorer, and right-click the USB drive to select Format and select a file system to format the USB flash drive.

However, you might get an error message “Windows was unable to complete the format” when using this way to format USB. If you meet this error, you can use the Command Prompt to format the USB drive or use other USB formatter software to do this task for free.

MiniTool Partition Wizard is the best free disk partition manager for Windows 10. You can use this program to easily format USB to NTFS or FAT32 for free. The process is much simpler than formatting USB with CMD.

MiniTool Partition Wizard allows you to easily create/resize/format/delete/wipe partitions, convert FAT to NTFS or vice versa, check and fix disk errors, migrate OS, clone disk, benchmark disk, etc.

Download and install MiniTool Partition Wizard on your Windows 10 computer. Check how to use this tool to format USB in a few clicks below.

Step 1. Connect you USB to PC. Launch the USB format tool.

Step 2. Right-click the partition on the USB drive, and choose Format.

Step 3. In the pop-up Format Partition window, choose a file system like FAT32, NTFS. Type a preferred partition label if you like. Click OK.

Step 4. Click Apply button at the bottom-left to start the USB formatting process.

How to Recover Data from a Mistakenly/Intentionally Formatted USB

Formatting USB with CMD or other USB format tools will erase all data on it. No matter you mistakenly or intentionally formatted the USB flash drive/pen drive, you can recover data from USB drive if you want.

MiniTool Power Data Recovery is a professional data recovery program for Windows. This free data recovery software lets you recover any deleted/lost files from USB flash drive/pen drive, SD card, HDD, SSD, and Windows local hard drive. You can use it to recover data from various data loss situations.

Download and install MiniTool Power Data Recovery on your Windows 10 computer, and check how to use it to recover data from formatted USB below.

Step 1. Plug in the USB to your Windows 10 computer. Launch MiniTool Power Data Recovery.

Step 2. Next you can click Removable Disk Drive in the left column, and find the USB in the right window. Select the USB flash drive, and click Scan button.

Step 3. After the software finishes the scanning, you can see it displays all files incl. deleted and lost files on the USB. It recovers all data on the formatted USB drive. You can check the folders to find needed files and click Save button to select a new destination to store the recovered files.

Conclusion

In this guide, you have learned how to format corrupt USB with CMD (Command Prompt) on Windows 10. An alternative free USB formatter software is also attached with an easy guide if Command Prompt is not working on your Windows 10 computer. To recover data from a formatted USB, this post also covers a free and easy guide.

If you have any problems when using software from MiniTool, you can contact [email protected].

Format USB CMD FAQ

You can press Windows + R, type cmd, and press Ctrl + Shift + Enter to run Command Prompt as administrator. Then type the following commands and press Enter after each command.

  • diskpart
  • list disk
  • select disk * (replace * with the exact disk number of USB)
  • clean
  • format fs=fat32 quick (replace fat32 with ntfs if you want to format USB to ntfs format)
  • assign letter=* (replace * with preferred drive letter)
  • exit
You can either use CMD or MiniTool Partition Wizard to completely format USB flash drive or pen drive for free.

Click Start menu, type cmd, right-click Command Prompt to run it as administrator. Then type the following commands to format write-protected USB using CMD. Press Enter after each command.

  • diskpart
  • list disk
  • select disk <disk number>
  • attributes disk clear readonly
  • select disk <disk number>
  • clean
  • format fs=fat32 quick (replace fat32 with ntfs if you want to format USB to ntfs format)
  • assign letter=<preferred drive letter>
  • exit
You can use Command Prompt or MiniTool Partition Wizard to easily format your USB to FAT32. The detailed guide is included in this post.

Most users use Disk Utility to erase a disk or hard drive. But some Mac users might need to erase them from the command line on Mac OS. To do that, the only thing you need is a bit of precise syntax to make sure that you are erasing the proper disk.

Format Flash Drive Mac Command Line Linux

Here I'll show you how you can erase and format a disk using the command line.

Working with Terminal

Reformat Flash Drive Mac

Start off by running the following command in the command line: Diskutil list

This is going to list all the mounted drives on your Mac.

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 /dev/disk5s2

It’s important to keep in mind that if you run the eraseDisk command, the target disk is going to lose all its data, so make sure you are erasing the proper disk.

If you need different system format types, here are a few references you could use instead of JHFS+:

  • Mac OS Extended: HFS+
  • MS-DOS fat32: FAT32
  • ExFAT: ExFAT