Table of Contents

, , , , , , , , , , , , , ,

Format external USB storage for windows

Sources

How to do it

Display connected block devices:

lsblk

NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
loop0    7:0    0  65.2M  1 loop /snap/gtk-common-themes/1519
loop1    7:1    0  65.1M  1 loop /snap/gtk-common-themes/1515
loop2    7:2    0  42.2M  1 loop /snap/snapd/14066
loop3    7:3    0 162.9M  1 loop /snap/gnome-3-28-1804/145
loop4    7:4    0  61.5M  1 loop /snap/authy/7
loop5    7:5    0     4K  1 loop /snap/bare/5
loop6    7:6    0  55.5M  1 loop /snap/core18/2284
loop7    7:7    0  55.5M  1 loop /snap/core18/2253
loop8    7:8    0 164.8M  1 loop /snap/gnome-3-28-1804/161
loop9    7:9    0  61.3M  1 loop /snap/authy/6
loop10   7:10   0  43.3M  1 loop /snap/snapd/14295
sda      8:0    0 238.5G  0 disk 
├─sda1   8:1    0     8M  0 part 
├─sda2   8:2    0 222.9G  0 part /home
│                                /var
│                                /usr/local
│                                /root
│                                /srv
│                                /opt
│                                /boot/grub2/x86_64-efi
│                                /boot/grub2/i386-pc
│                                /.snapshots
│                                /
└─sda3   8:3    0  15.6G  0 part [SWAP]
sdb      8:16   0 465.8G  0 disk 
└─sdb1   8:17   0 465.8G  0 part 
sr0     11:0    1  1024M  0 rom

In my case the connected USB HDD is /dev/sdb. Verify that sdb is the correct device

parted /dev/sdb print

Model: BUFFALO External HDD (scsi)
Disk /dev/sdb: 500GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start  End    Size   Type     File system  Flags
 1      131kB  500GB  500GB  primary  ext4         type=83

create a fresh msdos partition table

parted /dev/sdb mklabel msdos

Warning: The existing disk label on /dev/sdb will be destroyed and all data on this disk will be lost. Do you want to continue?
Yes/No?

press Y

                                                           
Information: You may need to update /etc/fstab.

create the new partition

parted -a optimal /dev/sdb mkpart primary fat32 0% 100%

Information: You may need to update /etc/fstab.

check if the partition is aligned correctly

parted /dev/sdb align-check optimal 1

1 aligned

check the partition

parted /dev/sdb print

Model: BUFFALO External HDD (scsi)
Disk /dev/sdb: 500GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start   End    Size   Type     File system  Flags
 1      1049kB  500GB  500GB  primary               lba, type=0c

now format the partition

mkfs.vfat -v /dev/sdb1

mkfs.fat 4.2 (2021-01-31)
Auto-selecting FAT32 for large filesystem
/dev/sdb1 has 255 heads and 63 sectors per track,
hidden sectors 0x0800;
logical sector size is 512,
using 0xf8 media descriptor, with 976771026 sectors;
drive number 0x80;
filesystem has 2 32-bit FATs and 64 sectors per cluster.
FAT size is 119232 sectors, and provides 15258320 clusters.
There are 64 reserved sectors.
Volume ID is aa1a69ca, no volume label.

~~DISCUSSION~~