I recently made my pen-drive bootable with Ubuntu 14.04. But I need to unboot my pen-drive now. I formatted my pen-drive once,But the size of the pen-drive still shows 2.25 MB. Whereas,this is an 8GB pen-drive. How can I get rid of this problem. I'm still using Windows 7.
-
Tried to remove the files? – Gunnar Hjalmarsson Jul 11 '14 at 05:41
-
Try to fix it from Windows Disk Management Tool. – Nischay Jul 11 '14 at 05:44
1 Answers
If you want to know how to reformat your 8GB flash drive from Windows 7, then ask how to do it on Superuser Q&A, not here. The following commands are run from the terminal in Ubuntu. The results of these steps are reproducible. I reformatted 2 USB flash drives with the following steps after writing Ubuntu ISOs to them with dd
Remove all of your USB devices except for the 8GB USB flash drive that you want to reformat, so you won't get confused about the device name of the USB flash drive later on.
List all the partitions.
sudo fdisk -l
Search the results of the command for output that looks like this:
Disk /dev/sdc: 7864 MB, 7864320000 bytes 30 heads, 33 sectors/track, 15515 cylinders, total 15360000 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00016288 Device Boot Start End Blocks Id System /dev/sdc1 * 2048 15359999 7678976 b W95 FAT32
If you see something like
7864 MB
(8GB) in the output (see the example output above), then that is your 8GB USB flash drive. In this example it is called/dev/sdc
. Now open the Disks application from the Dash and check again to make sure that the device name of your 8GB flash drive is the same as what you got from running the command:sudo fdisk -l
.Create a partition table on the disk of type msdos, sometimes known as MBR or Master Boot Record.
sudo parted /dev/sdc mklabel msdos
In this example I used
/dev/sdc
for the name of the device which is what was found in the results of step 2. I can't stress strongly enough how important it is to verify the device name before running this step!Warning: If you type the wrong device name you may overwrite your operating system or another one of your partitions containing important personal files!!! So be careful and check the device name a second time. Open the Disks application and check the device name of your 8GB USB flash drive in Disks. It should be the same device name!!! Now check again! You don't want to accidentally type the wrong device name!
Add an empty "primary" partition, which will hold a FAT filesystem later.
sudo parted -a none /dev/sdc mkpart primary fat32 0 8192
Once again in this example I used
/dev/sdc
for the name of the device which is what was found in the results of step 2. The command specifies the start point (from 0 MB) to the end point (8192 MB). If the 8GB USB flash drive does not have the full 8192 MB space, parted will adjust it automatically. If the terminal returns a message that the start point can't start at 0 MB and you have to use some other small number close to 0 MB, type Y to accept this. Note the command is creating a single, primary partition on the whole disk.This newly created partition will have the ID
/dev/sdc1
. That is because the device name in this example is/dev/sdc
and the 1 at the end is because it is the first partition on that device.Create a FAT filesystem on the /dev/sdc1 partition by formatting the partition.
mkfs.vfat -n "8GB-USB" /dev/sdc1
/dev/sdc1
is the partition ID from step 4. "8GB-USB" is the partition label, which can be your own choice of label, just enclose the label inside two double quote characters.
You now have a ready-to-use reformatted USB flash drive with an 8GB FAT partition.

- 114,770
-
You can also/instead suggest to plug the device, do a
dmesg
and look for USB in last lines. Ordmesg | grep USB
. It would be option 2b or something like that. – CijcoSistems Jul 11 '14 at 09:12 -
This does nothing for the read only problem. You can not format a USB drive in Ubuntu that is read only by this method. This answer is for how to format a usb drive that is not read only. FAT32 when read only cannot be oer written. You could try NFTS but first you migh need something like DD – lewis Sep 19 '17 at 03:42
-
1I've done this with method successfully twice and the instructions in the my answer came from my own notes which I wrote while I was reformatting the USB flash drives. In both cases
dd
was the culprit that caused the USB flash drives to become temporarily unusable. – karel Sep 19 '17 at 04:00 -
+1 :-) This is explaining what should be done manually or automatically like in mkusb, with the menu option 'Restore to a standard storage device'. In addition mkusb starts by wiping the first mibibyte to remove data, that might confuse the tools, that create a partition table and file system. - But there can be other problems, for example that the drive itself is failing (hardware or built-in software failure). See the analysis and methods in this link. – sudodus May 14 '18 at 05:17
-
-
Yesterday an old SD card in my camera was getting slow. I noticed it when uploading pictures from it to my computer (only 1 MB/s vs 10 MB/s nominal speed). I let mkusb wipe the whole device and the original speed was restored. If I had waited just a bit longer, the internal management in the card would probably have failed and my card would have been 'gridlocked' (read-only beyond repair). – sudodus May 14 '18 at 05:32