Format Flash Drive Mac Command Line



Raspbian Lite and command line. On a Lite version, it’s not the same thing You can plug your drive, and nothing happens 🙂 There are a few steps to follow to access it. Find the virtual drive name. Note: skip this if you already learn how to do it in the format part 🙂 Before doing anything else, you need to find the current name of the drive. Disk Utility within Mac OS X provides a range of disk management tools, from erasing and repartitioning hard disks to restoring images and repairing volumes. It's a simple way of interacting with attached storage on your Mac. Beyond this graphical front-end are some powerful command-line tools that we can use directly.

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.

Mac Flash Drive Format

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.

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:

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.

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?

Line

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.


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.

  • Shares

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.

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

Working with Terminal

Format Thumb Drive Mac Command Line

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

Command

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

Mac Command Line Download

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.

Mac Command Line

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

Format Flash Drive Mac Command Line Download

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