I'm a total newbie in Linux specially Ubuntu, I'm just asking on how to format a USB using Ubuntu terminal. Hope you can help me thanks!
-
It is not that easy for a niewbie. Why do not use GUI tools?– Pilot6Aug 18, 2015 at 13:14
-
1If you make a mistake, you can format your HDD. There will be no warning.– Pilot6Aug 18, 2015 at 13:24
-
This question is NOT a duplicate (at least not the one marked). That one asks for a GUI, and this one for a command line solution...– CalimoAug 19, 2015 at 10:06
-
@Calimo The other question has been broadened to include command-line solution, just the wording was never removed.– SethAug 20, 2015 at 1:33
1 Answer
First, you have to find out which device (
/dev/sd??
) your USB stick is. Therefore look at the output ofsudo fdisk -l
After that unmount the device/partition (if necessary) by running
sudo umount /dev/sd??
Make sure you replaced
??
with the correct device/partition name from the previous output.To format The partition as FAT32 use
sudo mkdosfs -F 32 -I /dev/sd??
Again replace
??
with your respective letters.
Be careful that if you enter the wrong device name, you might also accidentally format your hard disk!
You can also do
sudo -s
and you don't have to put "sudo" in front of everything!
-
1Hi, after doing this I get a:
Error while copying to XXXXX The destination is read-only.
any clue?– vabadaSep 9, 2016 at 6:17 -
-
Have a SCRIPT for the whole shebang would be nice (with some sanity checks, that it's a a) USB b) removable device c) no larger than 32 GB d) unrelated to the usual pack like
/
,/boot
, etc. as an extra precaution)– Frank NSep 16, 2017 at 12:27 -
If you want to name the volume while formatting, add
-n YOUR-NAME
to themkdosfs
command.– ZoltánSep 14, 2018 at 14:34 -
I know it's been 4 years but @vabada you probably messed with the usb too much and it's broken– NitwitMay 13, 2020 at 11:57