format a disk to fat32 on raspberry pi or linux

By | January 5, 2020

—— part 1 ——-

create partitions

1) get list of disks
# fdisk -l

2) Find disk in list, /dev/???
in this example /dev/sda

3) run fdisk again and specify disk
# fdisk /dev/sda

4) print current partiions
Command (m for help): p

5) use the d command to delete any of the existing partitiond
Command (m for help): d
you may have to run this multiple times if there is more that 1 partition.

6) print current partiion list again, to make sure its empty
Command (m for help): p

7) Use the o command to create a new DOS partition table
Command (m for help): o

8) use the n command to create a new partition
Command (m for help): n
accept all defaults

9) use the t command to change the partition type
Command (m for help): t
use the hex code b to select W95 FAT 32

10) use the w command to write changes to disk.
Command (m for help): w

—– part 2 ———-

create filesystem

1) mkfs -t vfat /dev/sda1

Leave a Reply

Your email address will not be published. Required fields are marked *