Linux tips 5-format a USB flash drive and linux tips 5 --
Generally, it is very easy to format a partitioned USB flash disk. You only need to use The mkfs command to specify the target file system. The example is as follows:
$ sudo fdisk -l$ sudo mkfs -t vfat /dev/sdb1
The-t parameter is the target file format. Other parameters include ext3 and msdos. The default value is ext2.
We can also use the following simple command to do this:
mkdosfs(8), mke2fs(8), mkfs.bfs(8), mkfs.ext2(8), mkfs.ext3(8), mkfs.minix(8), mkfs.msdos(8), mkfs.vfat(8), mkfs.xfs(8), mkfs.xiafs(8)
After using Linux Tip 3 to make a USB flash drive into a system boot disk, the USB flash drive is actually divided into two partitions.
$ sudo fdisk -l...Disk /dev/sdb: 4009 MB, 4009754624 bytes64 heads, 32 sectors/track, 3824 cylinders, total 7831552 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x7680fe3e Device Boot Start End Blocks Id System/dev/sdb1 * 0 2611199 1305600 17 Hidden HPFS/NTFSDisk /dev/sdb1: 1336 MB, 1336934400 bytes64 heads, 32 sectors/track, 1275 cylinders, total 2611200 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x7680fe3e Device Boot Start End Blocks Id System/dev/sdb1p1 * 0 2611199 1305600 17 Hidden HPFS/NTFS
This will hide a large part of the space. It is not enough to format/dev/sdb1 only. Also format/dev/sdb so that the entire USB flash disk is formatted. However, there will be a problem:
$ sudo mkfs -t vfat /dev/sdbmkfs.vfat 3.0.9 (31 Jan 2010)mkfs.vfat: Device partition expected, not making filesystem on entire device '/dev/sdb' (use -I to override)
Follow the prompts to add the-I parameter:
$ sudo mkfs.vfat -I /dev/sdbmkfs.vfat 3.0.9 (31 Jan 2010)
Re-insert the USB flash disk, and the whole USB disk space is back.