First task: format a 16Gb SD card

Yesterday I bought a 16Gb SDHC memory card, and I will try to boot the Raspberry Pi from it.

The image I downloaded from http://www.raspberrypi.org contains a boot partition with several executable files and a partition with a “raspbian” OS (a debian flavour linux distribution). The  boot partition is a FAT partition, and the OS partition contains an ext4 filesystem with the OS deployed in it.

I did a:

# dd if=2012-07-15-wheezy-raspbian.img of=/dev/mmcblk0 bs=1M

As can be seen, the dd is done on the hard disk device file, not on a single partition, so it is going to create a new partition table at the begining of the card, erasing the previous one.

After completing the “dd”:

# fdisk -l /dev/mmcblk0
Disk /dev/mmcblk0: 15.9 GB, 15931539456 bytes
4 heads, 16 sectors/track, 486192 cylinders, 31116288 sectores en total
Units = sectores of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Identificador del disco: 0x000714e9

Disposit. Inicio    Comienzo      Fin      Bloques  Id  Sistema
/dev/mmcblk0p1            8192      122879       57344    c  W95 FAT32 (LBA)
/dev/mmcblk0p2          122880     3788799     1832960   83  Linux
If you sum the blocks, only 2Gb are used, so we need to expand the OS partition to use the complete memory card. I would like to have a swap partition also, because the Raspberry Pi has only 256Mb.

In the WrightRocket blog I found this useful tutorial for doing so:

http://wrightrocket.blogspot.com.es/2012/06/bigger-slice-of-raspberry-pi.html

In it , you can grab a python script for calculating starting and finishing sectors for partitions (including a swap one),  and how to resize the filesystem. After doing so, you can mount the ext4 partition and edit /etc/fstab to activate the swap partition.

After the whole operation, this is how the partition table looks like:

# fdisk -l /dev/mmcblk0

Disk /dev/mmcblk0: 15.9 GB, 15931539456 bytes
4 heads, 16 sectors/track, 486192 cylinders, 31116288 sectores en total
Units = sectores of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Identificador del disco: 0x000714e9

Disposit. Inicio    Comienzo      Fin      Bloques  Id  Sistema
/dev/mmcblk0p1   *        8192      122879       57344    c  W95 FAT32 (LBA)
/dev/mmcblk0p2          122880    30331901    15104511   83  Linux
/dev/mmcblk0p3        30331902    31116286      392192+  82  Linux swap / Solaris

Ready to boot, hopefully. Well, before booting I will connect several things to it.

 

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s