Plug the USB drive in. It might be immediately obvious by using blkid:
$ sudo blkid
... other stuff deleted ...
/dev/sdf1: UUID="6A47-3EF3" TYPE="vfat" PARTUUID="5a821f1d-01"
Or use blkid:
$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 931.5G 0 disk
├─sda1 8:1 0 838.2G 0 part /home/me
├─sda2 8:2 0 46.6G 0 part [SWAP]
└─sda3 8:3 0 46.8G 0 part
... stuff deleted ...
sdf 8:80 1 7.5G 0 disk
└─sdf1 8:81 1 7.5G 0 part /mnt/usb1
... stuff deleted ...
Or tail dmesg:
[231357.824595] usb 1-4: new high-speed USB device number 9 using xhci_hcd
[231357.970547] usb 1-4: New USB device found, idVendor=8564, idProduct=1000
[231357.970550] usb 1-4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[231357.970552] usb 1-4: Product: Mass Storage Device
[231357.970553] usb 1-4: Manufacturer: JetFlash
[231357.970554] usb 1-4: SerialNumber: 394KF3CMJLN5IN18
[231357.971161] usb-storage 1-4:1.0: USB Mass Storage device detected
[231357.971392] scsi host5: usb-storage 1-4:1.0
[231359.222925] scsi 5:0:0:0: Direct-Access JetFlash Transcend 8GB 1100 PQ: 0 ANSI: 4
[231359.223976] sd 5:0:0:0: Attached scsi generic sg5 type 0
[231359.224197] sd 5:0:0:0: [sdf] 15667200 512-byte logical blocks: (8.02 GB/7.47 GiB)
[231359.224669] sd 5:0:0:0: [sdf] Write Protect is off
[231359.224676] sd 5:0:0:0: [sdf] Mode Sense: 43 00 00 00
[231359.225199] sd 5:0:0:0: [sdf] No Caching mode page found
[231359.225205] sd 5:0:0:0: [sdf] Assuming drive cache: write through
[231359.228136] sdf: sdf1
[231359.232641] sd 5:0:0:0: [sdf] Attached SCSI removable disk
This confirms /dev/sdf, with a partition of /dev/sdf1
The existing format:
$ sudo fdisk -l /dev/sdf
Disk /dev/sdf: 7.5 GiB, 8021606400 bytes, 15667200 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
Disklabel type: dos
Disk identifier: 0x5a821f1d
Device Boot Start End Sectors Size Id Type
/dev/sdf1 2048 15667199 15665152 7.5G b W95 FAT32
To kill the partition table and start over:
Method #1 (be very careful with dev names), and it might take a while (need to try 1M block size):
$ sudo dd if=/dev/zero of=/dev/sdf bs=4k && sync
dd: error writing '/dev/sdf': No space left on device
1958401+0 records in
1958400+0 records out
8021606400 bytes (8.0 GB, 7.5 GiB) copied, 332.251 s, 24.1 MB/s
Method #2:
$ sudo fdisk /dev/sdf
Welcome to fdisk (util-linux 2.29.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): p
Disk /dev/sdf: 7.5 GiB, 8021606400 bytes, 15667200 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
Disklabel type: dos
Disk identifier: 0x5a821f1d
Device Boot Start End Sectors Size Id Type
/dev/sdf1 2048 15667199 15665152 7.5G b W95 FAT32
Command (m for help): o
Created a new DOS disklabel with disk identifier 0xee623ec8.
Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
$
Create a partition, and change to vfat:
$ sudo fdisk /dev/sdf
Welcome to fdisk (util-linux 2.29.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): p
Disk /dev/sdf: 7.5 GiB, 8021606400 bytes, 15667200 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
Disklabel type: dos
Disk identifier: 0xee623ec8
Command (m for help): n
Partition type
p primary (0 primary, 0 extended, 4 free)
e extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1):
First sector (2048-15667199, default 2048):
Last sector, +sectors or +size{K,M,G,T,P} (2048-15667199, default 15667199):
Created a new partition 1 of type 'Linux' and of size 7.5 GiB.
Partition #1 contains a vfat signature.
Do you want to remove the signature? [Y]es/[N]o: y
The signature will be removed by a write command.
Command (m for help): l
... stuff deleted
b W95 FAT32 51 OnTrack DM6 Aux 9f BSD/OS e4 SpeedStor
... stuff deleted
Command (m for help): t
Selected partition 1
Partition type (type L to list all types): b
Changed type of partition 'Linux' to 'W95 FAT32'.
Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
$
The partition is back:
$ sudo fdisk -l /dev/sdf
Disk /dev/sdf: 7.5 GiB, 8021606400 bytes, 15667200 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
Disklabel type: dos
Disk identifier: 0xee623ec8
Device Boot Start End Sectors Size Id Type
/dev/sdf1 2048 15667199 15665152 7.5G b W95 FAT32
Format the partition:
Method #1, without a disk label:
$ sudo mkfs.vfat /dev/sdf1
mkfs.fat 4.1 (2017-01-24)
$ sudo blkid
... stuff deleted ...
/dev/sdf1: UUID="151F-416F" TYPE="vfat" PARTUUID="0c3e0f3f-01"
Method #2, with a disk label:
$ sudo mkfs.vfat -n 'carryall' -I /dev/sdf1
mkfs.fat 4.1 (2017-01-24)
mkfs.fat: warning - lowercase labels might not work properly with DOS or Windows
$ sudo blkid
... stuff deleted ...
/dev/sdf1: LABEL="carryall" UUID="3B0A-1501" TYPE="vfat" PARTUUID="0c3e0f3f-01"
Check it out:
$ df /dev/sdf1
Filesystem 1K-blocks Used Available Use% Mounted on
udev 24637516 0 24637516 0% /dev
$ sudo mkdir /mnt/usb1
$ sudo mount /dev/sdf1 /mnt/usb1
$ df /mnt/usb1
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sdf1 7817288 4 7817284 1% /mnt/usb1