The mkfs command for Linux may be used to create new file-systems on a USB drive. I have used this to format a USB drive that had errors on it. Instead of using Windows 8.1 to format it, I have chosen to use the mkfs command as that is the standard command for formatting a partition. This is also useful if you are creating a loopback file-system and you need to create a file-system within that file to store files. The command by default will take a while, it zeroes the drive first to clean the file-system and then creates the new file-system in place. I am using NTFS as this is a USB drive I use on Windows as well.
This is the command that I used to format my USB drive.
sudo mkfs.ntfs /dev/sdb1 |
And this is the result.
homer@deusexmachina ~ $ sudo mkfs.ntfs /dev/sdb1 Cluster size has been automatically set to 4096 bytes. Initializing device with zeroes: 100% - Done. Creating NTFS volume structures. mkntfs completed successfully. Have a nice day. |
If you do this whilst the USB drive is mounted, you will get this error:
homer@deusexmachina ~ $ sudo mkfs.ntfs /dev/sdb1 [sudo] password for homer: /dev/sdb1 is mounted. Refusing to make a filesystem here! |
So make sure that the drive is unmounted first.
I used this command:
sudo umount /media/homer/OS\ Stuff |