Main Menu

search

You are here

rPi: Prepare SD card

[last updated: 2019-11-27]
go to: raspberry Pi home page
go to: SD card problems
go to: creating a new NOOBS card

-----

There are different procedures listed at different places on the www for how to prepare your SD card. Some are for doing the process on a Windows machine, others for Macs. But the ones I'm using (mostly from: (link to:) dunbar-it, with edits and rearrangements) are for Linux machines.

    However: If you first extract the NOOBS .zip file on your PC, you will find a INSTRUCTIONS-README.txt file in the root directory. This file contains slightly different instructions, notably how to format the SD card using GParted rather than using the command line. go to: GParted for my notes on formatting with that software.

--------------------------

    Proceeding with instructions from dunbar-it ...
  • Obtain a blank micro-SD card, preferably 16gb, though larger is possible too .
    (if your card is not blank ...)
    • If you want to use a 64gb or larger SD card, (link to:) raspberrypi.org formatting instructions:
    • It should be formatted in FAT32 (also called MSDOS) protocol
    • Find the name of your card:
      Before inserting the SD card, open a terminal and run:
      $ sudo fdisk -l (lower-case "L")
      Then insert the SD card and run fdisk again.
      Your SD card will now be listed. See how it is listed/named.
      Mine was named: /dev/sdd1
      A different card was named: /dev/sdf1
  • Format & partition your SD card:
    • Open the fdisk utility to allow manipulation of your SD card:
      $ sudo fdisk /dev/sdd1
      • Delete any partitions that are defined on your SD card,
        by entering 'd' at the command prompt.
        My SD card didn't have any partitions defined, so entering 'd' gave the message "No partition is defined yet"
        • When re-partitioning a card, in order to delete previous partitions, it was necessary to close any File manager windows that were automatically opened when it was inserted, and unmount the partitions before they could be deleted.
      • Now create a partition with 'n', specify "primary", and partition #1.
        Press enter to accept default "first" and "last" sector addresses
      • Enter 'p' at command prompt to print out partition status:
        mine showed partition /dev/sdd1p1 was successfully created.
      • However note that partition type is listed as 'Linux', and we need 'FAT32'
        Enter 't' at command prompt, then 'b' to select "W95 FAT32"
        Enter 'p' to see the partition type was successfully changed.
      • [It may be necessary to use the 'a' command to make this partition bootable if you have a problem in your rPi.]
      • So far all these changes are just in memory and not actually on the SD card.
        Now write to the disk using the 'w' command.
        • However at this point I got an error not mentioned in the tutorial:
          "Failed to add partition 1 to system: Invalid argument
          The kernel still uses the old partitions. The new table will be used at the next reboot.
          Syncing disks."
        • OTOH, re-entering fdisk /dev... then 'p'
          in fact showed the p1 partition was created as /dev/sdf1p1 and FAT32 formatted.
          Close the fdisk command with: q
        • And in fact I successfully completed the rest of the procedure and created a workable SD card.
      • At this point the fdisk utility will close, giving you back your standard Linux prompt
    • Now format the card with:
      $ sudo mkfs.vfat /dev/sdd1p1
      but this returned:
        mkfs.fat 4.1 (2017-01-24)
        mkfs.vfat: unable to open /dev/sdd1p1: No such file or directory
        [perhaps command should be:
        $ sudo mkfs.vfat /dev/sdd1 ???

      Regardless proceeding as if all is well...

    • After formatting and partitioning, be sure to eject and reinsert to remount before copying onto it.

.

.

.

eof