Clean a linux drive on Mac Os X

Short tips: when a drive has been formatted for Linux (like a SDCard for a RPI) and you want to clean it ans reuse it as a normal (Fat32) drive, you can’t do it from Diskutil graphical tool.

Here are the way to make it with the command line. Assuming your drive is /dev/diskX and the drive is unmounted.

# get the list of partitions
[~] sudo diskutil list
...
/dev/diskX (external, physical):
   #:   TYPE NAME                  SIZE       IDENTIFIER
   0:   FDisk_partition_scheme   *4.0 GB     diskX
   1:   Windows_FAT_32 boot      58.7 MB     diskXs1
   2:   Linux                     3.9 GB     diskXs2

Here we have 2 partitions to remove

[~] sudo diskutil eraseVolume free none diskXs1
[~] sudo diskutil eraseVolume free none diskXs2

Now we can create a new one:

[~] sudo newfs_msdos -F 32 /dev/diskX

The created partition will get the full disk size.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.