Formatting SD cards

From Pandora Wiki
Revision as of 22:45, 20 July 2015 by Jadedpa (Talk | contribs) (Added to tutorial category.)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
SD card

All SDIO device should work with Pandora, it only requires the device driver to be present and loaded. There is no electronic or physical difference between SDHC and SDXC. Cards with larger capacities are marketed as SDXC. Most SDHC and SDXC cards will work in the Pandora USB_compatibility_list. provided they are formatted with a compatible filesystem, such as FAT32 or EXT2/3. Cards that preformatted with exFAT need to be formatted to compatible filesystem.

Insert Card

SD cardslot

The openpandora has two fullsize SD-card slots to chose from.

Chose a filesystem to format to

The Pandora OS can read cards formatted with various filesystems including ext2, ext3, ext4, fat32. Also, NTFS if you install the codec pack.

If you want something easy, go with a single ext2 partition, as you need one anyway if you want to put an OS on it. (as per Boot_setup If you want to use an ext2 SD-card on Microsoft windows you need this [1] Same goes for Apple OSX [2]

If you don't want to install an OS on your card, FAT32 gives good interoperability.

Take care with using these command line tools, to be certain you are accessing the correct device. They will not ask you and will DESTROY any data on the device. This command will replace an existing partition with an empty EXT2 formatted filesystem (this includes the single FAT partition most SD cards come shipped with). Assuming /dev/mmcblk0p1 for your SD device (left slot, first partition), LABELNAME for the partition:

If you run into problems with formatting the SD card, try unmounting it first:

sudo umount /media/[LABELNAME of SD card]

ext2, ext3, ext4

To format a card with ext4, insert the card into the Pandora, open terminal, and type: [3]

sudo fdisk /dev/mmcblk0  # (use mmcblk1 for the second slot)
# 't' then '83' to change the partition type to linux, then 'w' to save.
sudo mkfs.ext4 -m 0 -L volumename /dev/mmcblk0p1  # (use mmcblk1p1 for the second slot)

ext4 works well, and fsck is very quick.

If you'd rather use ext2 or ext3, run mkfs.ext2 or mkfs.ext3 instead, with the same options.

Another option you can use, -N sets the number of inodes (max file count). You can reclaim some space by using fewer inodes, e.g. -N 500000 or -N 1000000 for a 32GB card.


The software to format FAT32 is not included with the Pandora, but can be easily installed. Open terminal, and type: [4][5]

sudo opkg update
sudo opkg install dosfstools

Once installed, you can format a card like so:

sudo mkfs.vfat /dev/mmcblk0p1 # (or mmcblk1p1 for the second slot)


the Community Codec Pack must be installed.

Formatting options

Using a Digital camera

A digital camera, provided you have one, is a quick and easy way to format an SD card. Put it in, select format, done.

Using a live CD on a PC

Use gparted.

Using a windows box

Use the Panasonic SD Formatter.


SD cards perform much better when the partitions are aligned correctly, starting at 4MB. This is important!

If your partitions are messed up, you can fix them using the Panasonic SD Formatter, or using parted:

Dev=/dev/mmcblk0   # or mmcblk1 for 2nd slot
FS=ext4            # or fat32
sudo parted -s $Dev mklabel msdos
sudo parted -s $Dev unit cyl mkpart primary $FS -- 0 -2

Partition your SD card

It may be a good idea to set up multiple partitions on your SD card - reasons include wanting to include a separate first FAT32 partition for use on Windows, or having a Swap partition

If you do want to slice your SD card into several partitions (see #Boot_setup#Setting up mutliple-partition SD cards for booting), you can use the cfdisk command-line tool on the Pandora to create a partition table, or you can also download and use the graphical tool gparted.

Note that - as of Zaxxon HF5 - the Pandora firmware doesn't have a command to format FAT partitions, so if you want to use the FAT/ext2/swap - scheme, you'll have to format the first partition on another system later on (under Windows, use the Disk Management tool).

Using cfdisk

Assuming your card is in the left slot:

sudo cfdisk -z /dev/mmcblk0

WARNING: mmcblk0 will not necessarily be the left slot. It's the first card that the system recognizes, which is usually the left slot (but not if you inserted an SD into the left slot after you had one in the right slot, for example). Please make sure before you do anything dangerous e.g. use 'mount' to see what filesystems you recognise are mounted from where.

cfdisk -z starts off with a clean partition table - if you want to see what's set up currently, use cfdisk /dev/mmcblk0.

Use only primary partitions (so you're limited to four slices).

Using gparted

Download the gparted PND and install it. Note: this generally requires having a second SD card to install it to, though it should be possible to install it to the /pandora folder in your filesystem root, which will install it to NAND.

Find the program under 'System' in the menu and launch it. WARNING: It will start off pointing at /dev/mmcblk0 which is usually your left slot, but may not be. You can switch between the two card slots (if you have a card in each) and deduce which is which from the graphical display and the partition labels, but please be sure before applying any changes. Selecting 'information' from the right-click menu will also show you where each partition is mounted on the root filesystem, if it is currently mounted.

If the system has automounted the existing partition it'll show as locked and you'll need to unmount it using the right-click menu before you'll be able to change it. In this case, you'll probably want to delete it and create new partitions. Note that whatever partition your end up installing your boot/autoboot.txt to must be either ext2 or FAT, but you have a freer choice of filesystems to use on other partitions.

Once you've decided on your partitions and marked up the changes you'll need to apply them. Use the Apply All Operations menu item from the Edit menu. Then sit back and wait as it repartitions and reformats your card.

Labeling an SD card

tune2fs -L volumename /dev/mmcblk0p1    # for ext2, ext3, ext4
mlabel -i /dev/mmcblk0p1 ::volumename   # for fat32

This guide assumes you have got the operating system of choice at the ready. Check out the many different OSes available and pick your favourite from software section.