3

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.

migrated from stackoverflow.com Feb 27 '14 at 17:50

This question came from our site for professional and enthusiast programmers.

6
  • Install e2fsprogs brew install e2fsprogs
  • Format disk sudo $(brew --prefix e2fsprogs)/sbin/mkfs.ext3 /dev/diskN
  • I've tried to take this approach, but every time I try to format the disk it complains about the device being busy. lsof-ing the device shows nothing. – AlexMax Nov 10 '14 at 18:10
  • @AlexMax you need to unmount any volumes on the disk before you can format them. – KingRadical Nov 26 '14 at 2:15
  • Tried that, said it was busy. Which is why lsof showing nothing in use was so distressing. – AlexMax Dec 1 '14 at 22:47
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
1

Minor addition to other excellent answers: On the raspberry pi site, on the page

https://www.raspberrypi.org/help/noobs-setup/

... they write:

"It is best to format your SD card before copying the NOOBS files onto it. To do this:

  • Visit the SD Association’s website and download SD Formatter 4.0 for either Windows or Mac.
  • Follow the instructions to install the software.
  • Insert your SD card into the computer or laptop’s SD card reader and make a note of the drive letter allocated to it, e.g. G:/
  • In SD Formatter, select the drive letter for your SD card and format it. "

This suggests to me that SDFormatter is the way to go.

Despite this, I'm not terribly happy with SDFormatter.

  • It doesn't explicitly list compatibility with OS X > 1.8.
  • It doesn't provide the option of installing for just one user.
  • On startup, you get a Finder dialog stating "SDFormatter wants to make changes." This is exactly how malware obtains privilege escalation. Creepy.
  • The app itself suffers from OEM-itis: ugly dialog, bad grammar.

EDIT: In fact, my SD card is 64G, and the card I prepared with SDFormatter failed horribly. After reading man pages for a while, I used diskutil to reformat the SD card to have two 32G FAT32 partitions, dumped the NOOBS file on the first one, and then everything was fine. In fact, as others have noted, the NOOBS loader will actually reformat the card to a single large partition itself.

1

I needed to format a partition to ext3 on my USB flash drive. The drive was already formatted, and had 3 partitions, and I wanted to convert partition 1 from FAT32 to ext3.

  1. install brew, visit http://brew.sh/
  2. install e2fsprogs using brew install e2fsprogs
  3. figure out the name of your partition or drive using diskutil list -- in my case, my partition had was on disk2 and had the identifier of disk2s1
  4. sudo $(brew --prefix e2fsprogs)/sbin/mkfs.ext3 /dev/disk2s1 but you may need to change the drive from disk2s1 to the partition or drive that you want to format. This command will ask you to verify the name of the partition, just to be sure :)
0

This link should help you for Mac/Windows/Linux users.

http://computers.tutsplus.com/articles/how-to-flash-an-sd-card-for-raspberry-pi--mac-53600

  • Welcome to Ask Different! While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. – grg Feb 27 '14 at 18:02

You must log in to answer this question.