How To Format Usb In Terminal

broken image


Format fs=FAT32 Quick The above command will format the USB drive in the FAT32 format which is ideal for USB drives. You can use fs=NTFS instead to format the drive as NTFS which will then only work on a Windows PC. Is it from GUI or terminal? How to minimize tabs with keyboard. I see formatting USB drives from the terminal very handy. Today I am going to show you how to format USB drives using the terminal. Things needed for this tutorial to be useful is just a USB drive, the capacity doesn't matter. Let us get started! Insert your USB drive into your system. Open the terminal. How to Format USB Flash Drive from Command Prompt. For your information, any form of disk formatting will completely erase data, so backup as many as important files before the start. Altogether, you'll walk through the whole formatting process in eight steps, and the time spent will depend on the USB flash drive capacity and used space on it.

  1. How To Format Usb In Terminal
  2. How To Format Usb Hard Disk

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

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

Not every USB drive can be used with a Mac out of the box, you'll need to format the drive to compatible with the MacOS extended file system. If you want to ensure full Mac compatibility on your USB drive or flash disk, just read this article. And you will find two ways which will teach you how to format a USB drive on Mac, including Disk Utility and Terminal command. And if you lost your important data because of formatting, you can use a data recovery tool to recover data from a formatted USB drive on Mac.

1 What You Should Do First Before Formatting USB Drive on Mac

Yоu hаvе tо be sure that уоu know whаt уоu are doing whеn you execute thе соmmаndѕ, because you саn еrаѕе your еntirе hаrd drivе if уоu do this wrоng.

The only way to be sure of the content you are formatting is to first remove the USB drive from Mac, know the title of other storage disks, insert the USB disk again and note the name of the disk. Now you are sure not to be formatting a wrong disk this way. Next, drag the USB data to a safe location for backup/recovery measures before formatting it. Then you are set to get it done!

2 What is the Best Format to Choose When Formatting USB Drive on Mac

You'll be given several format options when you try to format a USB drive on Mac, including OS X Extended (Journaled), OS X Extended (Case-sensitive, Journaled), MS-DOS (FAT) and ExFAT. If you are using macOS 10.13 or later, you'll also see an option named APFS, which is the default file system of macOS 10.13 and later.

1APFS

APFS is a new file system for macOS. It's the most appropriate format for flash drives and SSDs. However, in order to write to this file system, you need to have the latest macOS. If you're sure that you won't connect the USB drive to a Mac computer running old version, then you can format your USB drive with APFS.

2OS X Extended (Journaled) & OS X Extended (Case-sensitive, Journaled)

This is the default file system for macOS 10.12 and earlier. It doesn't put a limit on the size of files you can save on the drive, and that's the greatest advantage. Windows-running computers can read the files formatted to OS X Extended (Journaled), but can't write to them. In other words, you can transfer files from Macs to PCs without any problem, but you won't be able to transfer files from PCs to Macs. If you need to transfer data between PCs and Macs, you should consider other options.

The biggest difference between OS X Extended (Journaled) and OS X Extended (Case-sensitive, Journaled) is the latter is case-sensitive to folder names. Therefore, if you do not have special needs, you can ignore this option.

3MS-DOS (FAT)

This is Disk Utility's name for FAT32 file system. It's compatible with Windows operating systems and macOS. A USB drive formatted this way can easily transfer data between PCs and Macs. However, a USB drive formatted to FAT32 doesn't support an individual file larger than 4GB.

4ExFAT

ExFAT, the successor of FAT32, offers larger storage space and supports files larger than 4GB. So, if you need to transfer large files between PCs and Macs, ExFAT will be the best format for your USB drive.

3 How to Format a USB Drive on Mac

As earlier stated, you need to first back up your USB drive before formatting the drive as you may not be able to recover the contents again. Now, you can follow the steps highlighted below to get it successfully formatted.

Method 1: Format a USB Drive in Mac OS with Disk Utility

Step 1: Insert the USB to be formatted to a Mac computer.

Step 2: Navigate to Applications > Utilities, and click it twice to open it.

Step 3: Select the drive you want to format and click on Erase.

How To Format Usb In Terminal

Step 4: Rename the USB drive (optional), and choose one file system from the options.

How to install windows xp on xbox. Step 5: Then select Master Boot Record for scheme, hit Erase.

Step 6: Once the process is done, you are ready to reuse the drive with new file system to save data again.

Method 2: Convert/Format USB Drive to FAT32/ExFAT

Step 1: Connect the USB drive to your Mac computer.

Step 2: Click on cmd + space to run spotlight, input terminal then tap Enter key.

Step 3: Type diskutil list to find the location of your USB drive (eg: dev/disk2 is the USB drive in the below picture).

Step 4: Type sudo diskutil eraseDisk FAT32 MBRFormat /dev/disk2.

  • sudo gives you user right.

  • Diskutil calls disk utility program.

  • eraseDisk commands to format.

  • FAT32 sets the file system.

  • MBRFormat tells disk utility to format with a Master Boot Record.

  • /dev/disk2 is the location of the USB drive.

Note: You can replace FAT32 with ExFAT in the command, and your USB drive will be formatted in that way.

After the process completes, type diskutil list in command once more to check if the USB drive has been formatted successfully.

4Bonus: How to Recover Lost Data after Formatting a USB Drive

Users perhaps format a USB drive by mistake. Only after formatting it, they would realize that they had lost important data. If you don' t have a backup for data, then you can recover lost data from formatted USB drive on Mac with this trusted data recovery software - iMyFone AnyRecover. You can now recover all kinds of data from formatted USB drive on Mac with only 3 simple steps.

Features of iMyFone AnyRecover:

- Your Comprehensive Mac Data Recovery Solution

You can get back your lost photos, videos, documents, compressed files, and numerous kinds of data from formatted USB drive easily.

It adopts all-round scan and deep scan simultaneously, which can greatly shorten the scanning time and recover more data.

It supports data recovery on all types of USB drives. It also supports file formats like NTFS, HFS+, FAT32, exFAT, etc.

How To Format Usb In Terminal

It allows you to preview scanned files before recovery. And you can recover any 3 files for free.

Follow the simple steps below to recover data after formatting USB flash drive on mac:

Step 1: Make sure you have connected your USB drive to your Mac successfully. Launch AnyRecover software on your system and select the formatted USB drive you are trying to recover from. And press the 'Start' button to start the scanning.

Step 2: The software will immediately begin the scanning process. You can pause the process at any time and resume from that point later.

How

Step 4: Rename the USB drive (optional), and choose one file system from the options.

How to install windows xp on xbox. Step 5: Then select Master Boot Record for scheme, hit Erase.

Step 6: Once the process is done, you are ready to reuse the drive with new file system to save data again.

Method 2: Convert/Format USB Drive to FAT32/ExFAT

Step 1: Connect the USB drive to your Mac computer.

Step 2: Click on cmd + space to run spotlight, input terminal then tap Enter key.

Step 3: Type diskutil list to find the location of your USB drive (eg: dev/disk2 is the USB drive in the below picture).

Step 4: Type sudo diskutil eraseDisk FAT32 MBRFormat /dev/disk2.

  • sudo gives you user right.

  • Diskutil calls disk utility program.

  • eraseDisk commands to format.

  • FAT32 sets the file system.

  • MBRFormat tells disk utility to format with a Master Boot Record.

  • /dev/disk2 is the location of the USB drive.

Note: You can replace FAT32 with ExFAT in the command, and your USB drive will be formatted in that way.

After the process completes, type diskutil list in command once more to check if the USB drive has been formatted successfully.

4Bonus: How to Recover Lost Data after Formatting a USB Drive

Users perhaps format a USB drive by mistake. Only after formatting it, they would realize that they had lost important data. If you don' t have a backup for data, then you can recover lost data from formatted USB drive on Mac with this trusted data recovery software - iMyFone AnyRecover. You can now recover all kinds of data from formatted USB drive on Mac with only 3 simple steps.

Features of iMyFone AnyRecover:

- Your Comprehensive Mac Data Recovery Solution

You can get back your lost photos, videos, documents, compressed files, and numerous kinds of data from formatted USB drive easily.

It adopts all-round scan and deep scan simultaneously, which can greatly shorten the scanning time and recover more data.

It supports data recovery on all types of USB drives. It also supports file formats like NTFS, HFS+, FAT32, exFAT, etc.

How To Format Usb In Terminal

It allows you to preview scanned files before recovery. And you can recover any 3 files for free.

Follow the simple steps below to recover data after formatting USB flash drive on mac:

Step 1: Make sure you have connected your USB drive to your Mac successfully. Launch AnyRecover software on your system and select the formatted USB drive you are trying to recover from. And press the 'Start' button to start the scanning.

Step 2: The software will immediately begin the scanning process. You can pause the process at any time and resume from that point later.

How To Format Usb Hard Disk

Step 3: Immediately after the scanning process is complete, the software will list all the files in their respective file formats and folders. Tick on and confirm what you are going to recover, then click on 'Recover' button.





broken image