Created
September 22, 2018 22:26
-
-
Save tbotalla/e3f20e467109b44ac4549da47291d9cb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://askubuntu.com/questions/22381/how-to-format-a-usb-flash-drive | |
The Command-Line Way | |
In case you can't get your device formatted from the GUI, try this way. | |
Open the Terminal (Ctrl + Alt + T) | |
List your block storage devices by issuing the command lsblk | |
Then identify your pen drive by it's SIZE. In my case its /dev/sdb | |
enter image description here | |
Erase everything in the pen drive (OPTIONAL): | |
sudo dd if=/dev/zero of=**/dev/sdb** bs=4k && sync | |
Replace /dev/sdb with your corresponding device. This will take some time. It will pretend to be stuck. Just be patient. | |
for example: | |
dd if=/dev/zero of=/dev/sdb bs=4k && sync | |
dd: error writing '/dev/sdb': No space left on device | |
1984257+0 records in | |
1984256+0 records out | |
8127512576 bytes (8.1 GB) copied, 1236.37 s, 6.6 MB/s | |
Make a new partition table in the device: | |
sudo fdisk /dev/sdb | |
Then press letter o to create a new empty DOS partition table. | |
Make a new partition: | |
Press letter n to add a new partition. You will be prompted for the size of the partition. Making a primary partition when prompted, if you are not sure. | |
Then press letter w to write table to disk and exit. | |
Format your new partition. | |
See your new partition label with the command lsblk | |
In my case it is /dev/sdb1 | |
lsblk output | |
Issue the command below to format the new volume: | |
sudo mkfs.vfat **/dev/sdb1** | |
Please replace /dev/sdb1 with your corresponding device. | |
Eject the device: | |
sudo eject /dev/sdb |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment