Difference between revisions of "Hardware: Raspberry Pi"

From Luky-Wiki
Jump to: navigation, search
(FS cache)
(FS cache)
Line 66: Line 66:
 
Then file system:
 
Then file system:
 
<pre>
 
<pre>
mkfs.ext4 -m 0 -O ^has_journal,dir_index -L fscache /dev/sda1
+
mkfs.ext4 -m 0 -O dir_index -L fscache /dev/sda1
tune2fs -o acl,user_xattr /dev/sda1
+
tune2fs -o user_xattr /dev/sda1
 
</pre>
 
</pre>
Reserve for root is not necessary (so 0%) and also journal. It is only cache, so no important data + journal on "usb key" will reduce life it's life. I think I'll connect more devices in future so mounting via label is recommended (LVM is not present in raspbmc).
+
Reserve for root is not necessary (so 0%). I think I'll connect more devices in future so mounting via label is recommended (LVM is not present in raspbmc).
 +
 
 +
'''Note:''' apparently journal on device is required by kernel driver. Without it registering of cache fail with strange error.
  
 
Cache coherency information is stored inside extra attributes on file system. Therefore it is necessary to mount it in following way (<code>/etc/fstab</code>):
 
Cache coherency information is stored inside extra attributes on file system. Therefore it is necessary to mount it in following way (<code>/etc/fstab</code>):
 
<pre>
 
<pre>
LABEL=fscache  /var/cache/fscache      ext4    defaults,noatime,acl,user_xattr          2 0
+
LABEL=fscache  /var/cache/fscache      ext4    defaults,noatime,user_xattr          2 0
 
</pre>
 
</pre>
 
'''Note:''' I am not sure why but by default raspbmc is is skipping fsck during boot. I corrected this at this point in fstab.
 
'''Note:''' I am not sure why but by default raspbmc is is skipping fsck during boot. I corrected this at this point in fstab.

Revision as of 23:55, 5 November 2013

Just few notes about Raspberry Pi ...

Power

According to details from RPi project voltage between 4.75 and 5.25 volts is fine. I personally preffer voltage between 4.80 and 5.00 volts. Voltage below 4.8 volts, can lead to instability of 3v3 regulator (RG2) (e.g. CPU power source) and connected equipment. Voltage above 5.00 (5.25) can shorten life of board and lead to problems with connected equipment. Voltage above 5.6V trip D17 over voltage protection diode. Make sure that connected USB hub (if any) is not back feeding power. It can cause serious problems as there is no protection on USB output ports.

If you are experiencing random USB device disconnects, repeating keys from keyboard or random reboots (hung) of board then there is something wrong with power source. I think USB charger as source was not so good decision as most of the chargers drop voltage up on power demand. This can lead to under voltage and cause stability problems. If you hit some of them, then try to measure voltage between test points or change power source.

My Raspberry Pi is running pretty stable with following power sources:

  • RASPBERRY PI PSU is only 1A PSU, so no "hungry" devices. I Have ADATA N005 64GB USB flash disk + receiver for air mouse connected and it is just fine.
  • Powerocks Stone 3 this can act as UPS, but there is still question what is impact of this usage on battery. Only this device provide power at almost exactly 5.00 volts also under load.
  • Gembird the name state "Gembird" but it is "energenie". This source is also fine, but without load it is providing approximately 5.20 V which is so close to upper limit. Additionally it is noisy without load. It is working but i don't recommend it.

Boot configuration

Raspberry Pi don't have so called "BIOS" and it's configuration interface. Configuration of CPU, GPU and board is stored in /boot/config.txt. If you have problem with overscan or screen resolution then You can resolve it by modification of this file. For example I have one RPi connected to old television and this television don't use overscan only if output of RPi is in DMT / PC mode. My boot config for Raspbmc is:

# default Raspbmc config
arm_freq=800
force_turbo=1
gpu_mem=128
disable_overscan=1
start_file=start_x.elf
fixup_file=fixup_x.dat
# My configuration:
# Set stdv mode to PAL (as used in Europe)
sdtv_mode=2
# Force the monitor to HDMI mode so that sound will be sent over HDMI cable
hdmi_drive=2
# Set monitor mode to DMT
hdmi_group=2
# Set monitor resolution to 1360x768  60Hz
hdmi_mode=39

More details can be found on elinux.org in section RPi_config.

Temperature

I was trying to get clear answer "what is safe temperature" for Raspberry Pi and apparently there is no clear statement. From my findings safe temperature is up to 60C and shutdown temperature should be 70C. Although it looks like RPi can run up to 80C running close to this temperature can reduce board lifetime. Current temperature measured by CPU itself can be displayed by vcgencmd command or by direct read from /proc file system.

$ vcgencmd measure_temp
temp=54.1'C

FYI 1: original plastic case with ventilation opening in RPi logo is concentrating heat. If i open this case temperature drop for more that 10C.

FYI 2: small "ram" heatsink don't change temperature too much especially if adhesive side is cheaper with significant thermal resistance. I tried several heatsinks and result was only 2 to 5 degree Celsius temperature drop.

Additional software

List of handy tools in case of manual configuration or simple debugging:

apt-get install man screen strace htop nload traceroute mc vim pydf ca-certificates lsscsi

FS cache

FS cache can store read only cache pages from NFS to speedup further reading of filesystem. I'll use it to reduce network load. Configuration is following:

My cache disk (usb key) is /dev/sda. First of all I created partition over whole disk.

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1            2048   123535359    61766656   83  Linux

Then file system:

mkfs.ext4 -m 0 -O dir_index -L fscache /dev/sda1
tune2fs -o user_xattr /dev/sda1

Reserve for root is not necessary (so 0%). I think I'll connect more devices in future so mounting via label is recommended (LVM is not present in raspbmc).

Note: apparently journal on device is required by kernel driver. Without it registering of cache fail with strange error.

Cache coherency information is stored inside extra attributes on file system. Therefore it is necessary to mount it in following way (/etc/fstab):

LABEL=fscache   /var/cache/fscache      ext4    defaults,noatime,user_xattr           2 0

Note: I am not sure why but by default raspbmc is is skipping fsck during boot. I corrected this at this point in fstab.

Mount of file system itself:

mkdir -p /var/cache/fscache
mount /var/cache/fscache

Now fs cache daemon installation:

apt-get install cachefilesd

By default is is disabled. To enable it use modify /etc/default/cachefilesd:

RUN=yes

Configuration of daemon should point to mounted file system (config file: /etc/cachefilesd.conf):

dir /var/cache/fscache
tag mycache
brun 10%
bcull 7%
bstop 3%
frun 10%
fcull 7%
fstop 3%

If yes then it is time to start daemon:

/etc/init.d/cachefilesd start

TODO: ...

Results

TODO: ...

NFS

There are two possibilities how to mount remote file system. NFS or SMB/CIFS. If i compare both protocols then i can say: if possible then use NFS. SMB/CIFS is working also, but this protocol require more CPU, access is less "Unix like" and under same condition CIFS use more bandwidth in both directions. Usable throughput is lower compared to NFS. On regular system this is normally not noticeable, but RPi have limited resources. Therefore use NFS, if it is possible and don't expect too much if you are using CIFS.

TODO: ... mount options (ro,bg,hard,rsize=32768,wsize=32768,vers=3,tcp)


sandbox

man screen htop nload mc vim


build-essential

https://www.kernel.org/

wget --no-check-certificate https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.10.18.tar.xz


apt-get install git

git clone http://git.code.sf.net/p/aufs/aufs3-linux


git checkout origin/aufs3.2

http://www.raspberrypi.org/phpBB3/viewtopic.php?p=228099

apt-get install man

http://aufs.sourceforge.net/