How to erase and reformat SD card to ext3 on my macbook to prepare it for my raspberry pi

I'm trying to reformat my 32G SD card to prepare it for my raspberry pi. My GUI program on my mac does not allow me to format it to ext3 which is what i'm told to reformat it to for my raspberry pi.

How do I reformat this SD card to ext3. I've researched some links on how to do it from the command line but i'm having a hard time understanding the procedures. Is there a GUI program out there that will do this for me or will i need to do it from the command line.

I've tried using fdisk but i can't figure out what commands I need to add on to erase and format to ext3. I know the path and name of my SD card which is /dev/disk1s1 so that is no problem.

I've also tried using the GUI program SDFormatter which is located here (https://www.sdcard.org/downloads/formatter_4). But I doubt this will reformat it to the format I want which is ext3.

It takes some time to write a Linux distro to my SD card so I would like to get this right. Otherwise I wait for 2 hours for the writing process to complete plug in the SD card and then start up my pi and notice it doesn't work. I would like to stay away from making this time consuming mistake another time.


Solution 1:

  • Install e2fsprogs brew install e2fsprogs
  • Format disk sudo $(brew --prefix e2fsprogs)/sbin/mkfs.ext3 /dev/diskN

Solution 2:

You don't need to do format or preparation on the OS X side except for unmounting the SD card.

Copying the image uses the dd command to dump the proper ISO on to the card - partition format and all the data in one step. Here's how I prepare a SD card for my beagle bone black (similar ARM computer on a chip that runs Linux):

  • diskutil list - verify that disk1 or whatever is the proper mount point for it
  • diskutil eject disk1 - closes any files and leaves the storage free for the linux data to arrive
  • dd if=whatever.iso of=/dev/disk1 - write the image verbatim starting from the first block of the SD card.

Here is what things look like if you capture the contents from terminal using script:

Mac:~ user$ diskutil list
/dev/disk0
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *251.0 GB   disk0
   1:                        EFI EFI                     209.7 MB   disk0s1
   2:                  Apple_HFS Macintosh HD            250.1 GB   disk0s2
   3:                 Apple_Boot Recovery HD             650.0 MB   disk0s3
/dev/disk1
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *31.9 GB    disk1
   1:                        EFI EFI                     209.7 MB   disk1s1
   2:       Microsoft Basic Data                         8.0 GB     disk1s2
Mac:~ user$ diskutil unmountDisk disk1
Unmount of all volumes on disk1 was successful
Mac:~ user$ sudo time dd bs=1m if=ubuntu-precise-12.04.3-armhf-3.8.13-bone30.img of=/dev/disk1
Password:
1832+0 records in
1832+0 records out
1920991232 bytes transferred in 767.278741 secs (2503642 bytes/sec)
      767.32 real         0.00 user        23.16 sys
Mac:~ user$ diskutil list
/dev/disk0
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *251.0 GB   disk0
   1:                        EFI EFI                     209.7 MB   disk0s1
   2:                  Apple_HFS Macintosh HD            250.1 GB   disk0s2
   3:                 Apple_Boot Recovery HD             650.0 MB   disk0s3
/dev/disk1
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     FDisk_partition_scheme                        *31.9 GB    disk1
   1:                 DOS_FAT_12 BOOT_ARMHF              1.0 MB     disk1s1
   2:                      Linux                         1.9 GB     disk1s2