Raspberry Pi setup #1 : Before and after first boot.

Posted: 6th September 2012 by DExUS in News
Comments Off on Raspberry Pi setup #1 : Before and after first boot.

It took few days to get to know RPi a bit more, I will share with you ways to setup your raspberry to your liking.

Installation of web server, php and optimization of the OS it self for best performance.

We will be starting with setup and optimization

Let’s start with the assumption that you had just finished writing your linux image to the SD card and you are about to plug the card out. STOP.

Open the card, and replace start.elf with arm240_start.elf  , this will grant you some extra memory leaving only 16mb of dedicated ram for the graphics.

Also if you feel lucky you might edit config.txt and remove # from line : #arm_freq=800  , that will overclock the CPU to 800MHz. For more info about editing the file look here : elinux.org/RPi_config.txt

Now you can remove the SD card and boot your Pi.

After done, let’s begin with optimizing.

First of all you might want to extend the size of FS you have available if you have SD card with size more than 2GB.

1) run command : df  , to determine the device file, the output will be similar to this :

Filesystem 1K-blocks Used Available Use% Mounted on
rootfs 3743440 1876508 1676800 53% /
/dev/root 3743440 1876508 1676800 53% /
tmpfs 23792 216 23576 1% /run
tmpfs 5120 0 5120 0% /run/lock
tmpfs 10240 0 10240 0% /dev
tmpfs 47580 0 47580 0% /run/shm
/dev/mmcblk0p1 57288 36560 20728 64% /boot

2) Now take the red highlighted part without the “p1” and run command : sudo fdisk /dev/mmcblk0

3) Press key “p” and enter, the output will look like this :

Disk /dev/mmcblk0: 3959 MB, 3959422976 bytes
4 heads, 16 sectors/track, 120832 cylinders, total 7733248 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000108cb
Device Boot Start End Blocks Id System
/dev/mmcblk0p1 8192 122879 57344 c W95 FAT32 (LBA)
/dev/mmcblk0p2 122880 7733247 3805184 83 Linux
Command (m for help):

4) plese write down the highligted number, now press “d” for delete, and you want to select partition number 2 , so press “2”  and enter.

5) now press “n” for new partition, select “p”  for primary and after that “2” , most important thing is to set the first sector in the next step, please use the start sector which you did wrote down. After that enter the last sector which is by default set for maximum, so just press enter and that will extend your partition for the maximal size of your SD card.

6) press “w” to write the new settings & REBOOT

7) after you had rebooted your RPi use command : sudo resize2fs /dev/mmcblk0p2 , that will take some time depending on size of the SD card, but you can expect 5-8minutes + , after done you have successfully extended the file system.

Just for your information you can use hdparm -Tt /dev/mmcblk0 to benchmark speed of your SD card.

That is enough for today, I will post more setup guides soon.