Format Flash Drive Mac Fat32 Terminal
- Format Flash Drive Mac Fat32 Terminal File
- Format Flash Drive Mac Fat32 Terminal Download
- How To Format Fat32 Mac
- Format Flash Drive Mac Fat32 Terminals
- Mac Format External Disk Fat32
If you're moving it between Mac and Windows, you want to format your flash drive with the FAT32 filesystem. It shouldn't matter whether you format it on your Mac or on a Windows machine. To do it on the Mac, plug in the flash drive, and open Disk Utility (in your /Applications/Utilities folder). Then, assuming your mounted flash drive is, say, /dev/disk2, do: sudo diskutil eraseDisk FAT32 NAME MBRFormat /dev/disk2 (Where 'NAME' is the volume name you want for the mounted disk, and can be whatever you want; to keep things simple, especially if you're plugging it into a TV, keep it short, and alphanumeric.).
Do you want to use a USB drive on your Linux server, but you are not sure how to manage the USB drive from the terminal? This article explains how to format and mount a USB drive in the Linux terminal. It covers topics ranging from file system selection, all the way to creating a mount point on your system.
Background
For those that administer a physically present Linux server, a USB drive serves as an essential tool. Need to install the operating system for the first time? Need to quickly transfer files between systems? Looking for a place to backup your data? These are all potential use cases for a USB drive. Personally, I have a backup USB drive connected to my Debian based Samba file server. Once a day an automated script runs to mount the USB drive, run an incremental backup with BorgBackup and then unmount it again.
As a server administrator you typically do not have the convenience of a desktop environment and you do all your work through the terminal. For this reason, this article explains how you can format and mount a USB drive directly in the Linux terminal.
File systems
When you buy a USB drive, it is typically formatted to the FAT32 or NTFS file system. This makes the USB drive somewhat usable under all popular operating systems such as Windows, macOS and Linux. In the case you solely run Linux on your system, the EXT4 file system serves you far better. With the EXT4 file system, you preserve file permissions when storing data on it. Additionally, you do not have to worry about data fragmentation. The only real downside is that both Windows and macOS do not know how to access a EXT4 file system by default. Since this website is dedicated to Linux tutorials, I assume that you primarily run Linux on your systems. Therefore, the EXT4 file system is the file system of choice for this article.
Finding the disk name
After inserting the USB drive to your PC, Linux automatically assigns a disk name to the device. Typically the disk name looks like /dev/sdX
. For performing formatting and mounting operations, you need to know the disk name to operate on. With other words, the disk name serves as an disk identifier under Linux. The following command lists all disk names on your system:
lsblk -p | grep 'disk'
As a result you can see that my system has two disks. The first one is the SSD where Linux is installed and the second one (/dev/sdb
) is my USB drive. This might be different on your system. When unsure which disk name belongs to your USB drive, simply run the command with the USB drive disconnected. Afterwards, connect your USB drive and run the command one more time. By comparing the output of both commands, you can deduce the disk name of your USB drive.
Once known, make a note of your USB drive disk name. You will need it later on. In the remainder of this article, I will use /dev/sdb
as the disk name in the examples. Just keep in mind to replace this with the disk name of your USB drive.
Unmounting the disk
Depending on the Linux distribution you run, the operating system might automatically mount your USB drive upon insertion. Currently I run Debian on most of my systems On my servers I installed a minimal version of Debian and the operating system does not automatically mount my USB drive. However, on this laptop I have a Debian version with a full Gnome desktop environment installed. On this system, Debian does automatically mount the USB drive upon insertion.
Formatting a USB drive only works with an unmounted disk. Consequently, we need to determine the mount status of the USB drive. You can find out the mount status of your disk by running the same command again that we ran for finding the disk name:
lsblk -p | grep 'disk'
Inspect the line that lists your USB drive disk name. For a mounted disk, the line ends with a directory name. The listed directory is the so called mount point. In the event that your USB drive is currently mounted, proceed with unmounting the disk. Just make sure to replace the /dev/sdb
disk name with the disk name of your USB drive:
sudo umount /dev/sdb
To verify that the unmount operation succeeded, you can run the lsblk -p | grep 'disk'
on more time. It should no longer list the mount point:
Formatting the disk to EXT4
Now that you know the disk name of your USB drive and that the disk is unmounted, you can proceed with formatting the USB drive to the EXT4 file system. Note that the formatting operation removes all data currently stored on the disk. So make sure to first backup the data, if you still need it. Additionally, make sure that you specify the correct disk name to prevent data loss. To proceed with the disk format operation, run the following command. Just make sure to replace the /dev/sdb
disk name with the disk name of your USB drive:
sudo mkfs.ext4 /dev/sdb
Creating the mount point
A mount point refers to the location on your PC’s file system that a disk is connected to. Under Linux manually mounted disk are typically located in a subdirectory under /mnt
. In contrast, automatically mounted disks are typically located under /media
.
Since we plan on manually mounting the USB drive, the creation of the mount point comes next. With other words, we need to choose a directory name where the files on the USB drive will appear after mounting the disk. For this article, I chose usbdrive
. Run the following command to create the mount point:
sudo mkdir -p /mnt/usbdrive
Mounting the disk
With the USB drive formatted and the mount point created, it is time to actually mount the disk. Run the following command to mount the disk. Just make sure to replace the /dev/sdb
disk name with the disk name of your USB drive:
sudo mount /dev/sdb /mnt/usbdrive
To verify that the mount operation succeeded, you can run the lsblk -p | grep 'disk'
on more time. It should list the mount point at the end:
At this point, the root user owns this directory. This means that only the root user has read/write access to the disk. In case you want your own user to have read/write access to the USB drive, you can change the owner of this directory with the chown
command. My user name is pragmalin
so I will use this in the example. You should change this to your own user name or write $USER
, which gets automatically replaced with your user name:
sudo chown $USER: /mnt/usbdrive
You can run the ls
command to verify that the owner change was successful:
To verify that your user has read/write access to the disk, you can create a text-file with some dummy content on the disk:
echo 'Can you read this?' > /mnt/usbdrive/testfile
With the cat
command you can read and show the file contents in the terminal:
cat /mnt/usbdrive/testfile
After verifying your read/write access to the disk, delete the text-file again by running the command:
rm /mnt/usbdrive/testfile
Linux automatically unmounts the disk when you shutdown or reboot the system. If at any time you want to manually unmount the disk, the command presented earlier does the trick: sudo umount /dev/sdb
.
Automatically mount the disk when booting
Now that you know how to format and mount a USB drive, you might be interested in automatically mounting the USB drive with each system boot. For example if your system has a permanently connected USB drive. The file /etc/fstab
on Linux holds a list of all the mount operations to perform upon system boot.
Before making changes to this important configuration file, consider creating a backup copy first:
sudo cp /etc/fstab /etc/fstab.backup
Using the Nano editor, open the file for editing:
sudo nano /etc/fstab
Next, add the following line at the end of /etc/fstab
:
/dev/sdb /mnt/usbdrive ext4 auto,nofail,sync,users,rw 0 0
After saving the changes to /etc/fstab
and rebooting your system, the USB drive gets mounted automatically.
Wrap up
After reading through this article, you learned how to format and mount a USB drive with the EXT4 file system, directly in the Linux terminal. This knowledge comes in handy every time you deal with an USB drive and only have access to your Linux system through the terminal. This is typically the case with servers or for example a headless Raspberry Pi. I hope you enjoyed reading this article as much as I enjoyed writing it. Feel free to leave a comment if you have additional questions.
How can I format USB drive in CMD? How to format USB using CMD to NTFS? Can I format a USB using CMD in Windows 10? Don't worry if you have the same questions in your mind.
On this page, you'll learn how to format USB using CMD or CMD alternative tool in Windows 10/8/7 successfully. Pick up the suitable USB format tool for help now:
USB Format Tool | Pros |
---|---|
1. Format USB Using CMD |
|
2. Format USB Via CMD Alternative |
|
- Notice:
- As formatting will remove all saved data on the USB drive, if your USB is accessible, make sure to back up valuable USB data to another secure location in advance.
If you prefer an easy and quick way to format USB or you need to format to Ext 4/3/2, pick up CMD alternative format tool for help.
Let's start to format your USB using CMD or its alternative tool and make the RAW, inaccessible, unreadable, and even corrupted USB flash drive, pen drive, memory stick work normally again.
Part 1. How to Format USB Flash Drive Using CMD (Command Prompt)
Applies to: Format USB to FAT32/NTFS, format RAW USB, repair corrupted USB, etc.
USB flash drive is worldwide used for storing data and transferring files. However, sometimes, USB may corrupt or become inaccessible due to RAW or invalid file system, bad sector, or other errors. Formatting USB using CMD is a quick way to resolve these problems.
The following are two detailed guides, illustrating how to format a USB flash drive using Windows Command Prompt that you should strictly follow.
Steps to Format USB (to NTFS or FAT32) Using CMD
#1. Format USB using CMD in Windows 10:
Step 1. Connect USB to your PC and press Windows + R keys.
Step 2. Type cmd in the Search box and hit Enter to bring up Command Prompt.
Step 3. Type the following command lines one by one and hit Enter each time:
- diskpart
- list disk
- select disk + number (Replace 2 with the number of your USB drive.)
- list volume
- select volume + number (Replace 10 with the volume number of your USB flash drive.)
- format fs=ntfs quick (You can also replace NTFS with FAT32 or exFAT.)
- exit
Format Flash Drive Mac Fat32 Terminal File
CMD also works to fix Windows was unable to complete the format error in your computer hard drive, USB, or other storage devices.
#2. Format USB Flash Drive using Command Prompt in Windows 8/7:
Step 1. Plug USB in your computer and click the Windows icon and select 'Search'.
Step 2. Type command prompt in the Search box.
Right-click on Command Prompt and choose 'Run as administrator'.
Step 3. On the Command Prompt window, type diskpart and press 'Enter'.
Step 4 Type list disk and press 'Enter'. Check the disk number of your USB flash drive. For example, disk 2.
Step 5. Now type select disk 2 and press 'Enter'. (If the USB number is not 2, replace it with the right one.)
Step 6. Type format fs=ntfs and press 'Enter'.
If you prefer other file system formats, change the command NTFS to the desired one, such as format fs=fat32.
Step 7. Type exit and hit Enter to close the window.
After this, exit DiskPart and you save data to your USB flash drive again. However, as Linux file system Ext2/3 is not compatible with Windows OS, you can refer to a UBS format tool in Part 2 for help.
Part 2. Format USB Using CMD Alternative in Windows 10/8/7
Applies to: Format corrupted USB, format USB to Ext2, Ext3, format FAT32 USB to NTFS, format USB to FAT32, etc. on all Windows OS.
Although CMD is capable of formatting USB flash drive, it's not user-friendly for most Windows beginners. Also, it requires users to remember all command lines while executing operations in Command Prompt.
Also, any importer operation may cause data loss on other storage devices. Here, we would like to recommend you try third-party CMD alternative software - EaseUS free partition manager.
EaseUS Partition Master Free Edition is a perfect CMD alternative tool for USB formatting. With an easy-to-use interface and precise operation, you can use it to format USB easily in only a few clicks.
Tutorial - 4 Steps to Format USB via CMD Alternative in Windows 10/8/7
All levels of users can apply this tool and format USB to usable again in Windows 10/8/7:
Step 1. Launch EaseUS Partition Master, right-click the partition on your external hard drive/USB/SD card which you want to format and choose the 'Format' option.
Step 2. Assign a new partition label, file system (NTFS/FAT32/EXT2/EXT3), and cluster size to the selected partition, then click 'OK'.
Step 3. In the Warning window, click 'OK' to continue.
Step 4. Click the 'Execute Operation' button in the top-left corner to review the changes, then click 'Apply' to start formatting your external hard drive/USB/SD card.
Part 3. Bonus Tips to Fix Errors While Formatting USB Using CMD
According to some USB users, they reported that they encountered some errors while formatting USB in CMD.
Here, we've collected two common errors in formatting USB using CMD, if you get the same errors, don't worry. You can follow the provided solutions to resolve them:
Error 1: Diskpart format fs=ntfs stuck at 0, 10, 11, 12...
If the formatting process gets stuck in DiskPart, as the shown message, don't worry. You have two ways to go:
- #1. Just wait for the formatting process to complete.
- #2. Close CMD, turn to EaseUS Partition Master in Part 2 to format your drive.
Error 2: Diskpart has encountered an error: Access is denied. See the System Event Log for more information.
Format Flash Drive Mac Fat32 Terminal Download
If you come across this issue, click the link below to get rid of the problem:
Data Recovery is not a challenge anymore. EaseUS serves as a dependable data recovery application to retrieve lost data within simple clicks.
The End Line
Due to its portability, flexibility, large storage size, and reasonable price, USB flash drive is still the No.1 external storage device around the world.
While using USB for data transferring or storage, problems with USB flash drives also increase. Formatting USB flash drive is one of the top issues.
On this page, we included two USB formatting tools to help you format USB using CMD or CMD alternative - EaseUS Partition Master. You may pick up a suitable tool and follow the respective tutorial guide to make your USB flash drive work normally.
For an easy and free formatting resolution, take EaseUS Partition Master as your first choice. It's a perfect CMD alternative tool that can help you anytime.
People Also Ask About Format USB Using CMD
Some of you may have more questions about formatting USB. Here we collected some top concerned questions and listed answers below. If you have the same doubts, check out the answers now.
1. Why do you need to format USB flash drive?
Usually, HDDs and SSDs are widely used for OS installation and data storage and removable storage devices like USB flash drives are more used for data transferring and storage. But the USB flash drive may become inaccessible, and you'll need to format it so as to make it work again.
Here is a list of reasons why do you and other USB users need to format the flash drive:
- 1. RAW, invalid, or unrecognized USB file system
- 2. USB flash drive corruption
- 3. Virus infection
- 3. USB is write-protected
- 3. Change USB file system to NTFS, FAT32, or Ext 2/3/4 by formatting
2. How to format bootable USB using cmd?
The process of formatting a bootable USB flash drive is almost the same as the process shown on this page. You can apply CMD to format it with the listed steps here:
- Step 1. Connect the bootable USB drive to your PC.
- Step 2. Open Command Prompt.
- Step 3. Type diskpart and hit Enter.
- Step 4. Type list disk and hit Enter.
- Step 5.Type select disk + number and hit Enter. (Replace 2 with the number of your USB drive.)
- Step 6. Type list volume and hit Enter.
- Step 7. select volume + number and hit Enter. (Replace 10 with the volume number of your USB flash drive.)
- Step 8. Type format fs=ntfs quick and hit Enter. (You can also replace NTFS with FAT32 or exFAT.)
- Step 9. Type exit and hit Enter.
How To Format Fat32 Mac
3. How to format write-protected USB using cmd?
Format Flash Drive Mac Fat32 Terminals
Here are the steps that you can follow to format a write-protected (read-only) USB using the command lines below:
- Step 1. Press 'Win + R', type cmd to open 'Command Prompt'.
- Step 2. Type diskpart and hit Enter.
- Step 3. Type list disk and hit Enter.
- Step 4. Type select disk 2 and hit Enter. (Replace 2 with the write-protected device number) and hit Enter.
- Step 5. Type attributes disk clear readonly and hit Enter.
- Step 6. Type exit to close the diskpart window.
Once the write protection removing process completes, you can format the USB drive again. You can either apply EaseUS Partition Master, Windows File Explorer, or even the CMD command as shown in Part 2 to format the USB drive.
4. Windows was unable to complete the format, how to fix it?
Mac Format External Disk Fat32
When you use File Explorer to format the USB flash drive, it warns you that 'Windows was unable to complete the format', don't worry. Here are 7 ways that you can try to fix this error:
- #1. Use EaseUS Partition Master
- #2. Use Diskpart Command
- #3. Use Disk Management
- #4. Clear Virus and Complete the Format
- #5. Remove Write Protection and Complete the Format
- #6. Fix Disk Errors and Complete the Format
- #7. Repair Bad Sectors and Complete the Format
Note that you can try the above two tutorials to format your USB flash drive and resolve this issue. You can also follow this link to get rid of the Windows Was Unable to Complete the Format error immediately.