Linux command to format U disk

Run the
df -l
or
fdisk -l
command first to view the U disk mount point.


1. To unmount the U disk first, use the following command:
            #umount /dev/sdb1
            Note: The device behind /dev/ should be determined according to your actual situation, otherwise it will be formatted later and data will be lost! !
           Format the U disk, and create a vfat file system
            #mkfs.vfat /dev/sdb1
            Finally, mount the U disk, or unplug the U disk and plug it in, the system may mount it automatically, and you can use the U disk.
2. Completely format the U disk
     If your U disk has been mirrored, you will find that your U judgment will be much smaller, that is because part of the space is hidden, the method to completely format the U disk is as follows:
    umount /dev /sdb1 and /dev/sdb
    mkfs.vfat /dev/sdb and mkfs.vfat /dev/sdb1
    If mkfs.vfat /dev/sdb has the following error:
    mkfs.vfat 3.0.10 (12 Sep 2010)
    mkfs.vfat: unable to open /dev/sdb
    , you need to format /dev/sdb1 first, that is, use the mkfs.vfat /dev/sdb1 command to format /dev/sdb1 first;
    Then format /dev/sdb again, if the following error occurs:
    mkfs.vfat 3.0.10 (12 Sep 2010)
    mkfs.vfat: Device partition expected, not making filesystem on entire device '/dev/sdb' (use -I to override)
         The system prompts you to use the -I parameter to complete the format: mkfs.vfat -I /dev/sdb
         so that you can completely format your USB flash drive.
Reminder: Data is priceless, please back up your data before formatting.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326444650&siteId=291194637