Posts: 27
Joined: Fri Jun 01, 2012 5:19 pm

How to solve a sd creation problem

Fri Jun 01, 2012 5:57 pm


I'm not an linux expert, so the solution I write here could be not correct, but it worked for me, so I share here, so other people can use it.

I downloaded the archlinux image and copied to my sd card, which is 2GB. In theory it should work, but it did not. The raspberry pi didn't boot, with a nice kernel panic at the beggining, not being able to mount a partition. I checked the card in the computer and realized that I could not mount the ext4 partition, the problem was that the partition itself was a bit larger that its physical size.
I read a lot about ways to solve this and found that working with fschk.ext4 was easy, so thought an easier way.

1. Delete the current partition table in the card
2. Create a partition of 80MB with type FAT32.
3. Create a partition in the rest of the card type ext4.
4. Write changes and set the flag of FAT32 partition to bootable.
These steps can be performed with multiple programs (fdisk, parted, gparted, ...) at your own choice.

5. Check the image file for the position of the different partitions inside it:

Code: Select all

file -s archlinuxarm-29-04-2012.img
will return something like:

Code: Select all

archlinuxarm-29-04-2012.img: x86 boot sector; partition 1: ID=0xc, starthead 0, [b]startsector 1[/b], 195312 sectors; partition 2: ID=0x83, starthead 71, [b]startsector 197265[/b], 3665263 sectors, code offset 0xb8
We are interested in the start sector information concerning each partition, in this case, 1 for the first partition and 197265, for the second one.

we must mount the different partitions in the image one by one and copy their contents to the corresponding partitions in our card:
so, if you have a directory named /mnt/partition/ and your card partitons are:

mount the fat partition:

Code: Select all

sudo mount ./archlinuxarm-29-04-2012.img /mnt/partition/ -o offset=$((1*512)),ro
copy its contents to the card:

Code: Select all

copy -r /mnt/partition/* /media/partFAT

Code: Select all

umount /mnt/partition

do the same with the ext4 partition:

Code: Select all

sudo mount ./archlinuxarm-29-04-2012.img /mnt/partition/ -o offset=$((197265*512)),ro
copy -rp /mnt/partition/* /media/partEXT
umount /mnt/partition
umount the sd card and plug in your raspberry pi, power, and... go.

Return to “Troubleshooting”