Some zfs commands

Query status of pool:

zpool status

Check filesystem:

zpool scrub tank

Create snapshot with name derived from current date:

zfs snapshot tank/data@'date +%Y-%m-%d' (Replace ' with backticks)

List snapshots:

zfs list -t snapshot

Destroy snapshot:

zfs destroy tank/data@snapshotname

Send snapshot over network:

zfs send tank/data@snapshot  | ssh root@192.168.1.1 zfs recv tank/data

Send snapshop unencrypted, but very fast via nc:

nc -w 120 -l -p 8000 | zfs receive tank/data
zfs send tank/data@snapshot | nc -w 20 192.168.1.1 8000

Start transfer and detach process, so shell can be closed. Useful for very long running transfers:

sudo -b nohup sh -c "sudo zfs send backup/archiv@2017-11-04 | sudo zfs recv extern/archiv"

Edit mount point:

zfs set mountpoint=/mnt tank/data

 

Streaming video with raspberry pi camera

Here is a collection of different ways to stream videos from a raspberry pi with a pi camera.

Lowest latency in my experiments: rpicamsrc g-streamer plugin

This requires the g-streamer rpicamsrc plugin. Google for it.

Source: gst-launch-1.0 rpicamsrc preview=0 bitrate=4000000 exposure-mode=6 intra-refresh-type=2 hflip=TRUE vflip=TRUE ! 'video/x-h264, width=1280, height=720, framerate=49/1,profile=high' ! h264parse ! rtph264pay config-interval=1 pt=96 ! udpsink host=192.168.5.63 port=9001
Destination: gst-launch-1.0 -v udpsrc port=9001 caps='application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264' ! rtph264depay ! avdec_h264 ! videoconvert ! autovideosink sync=false

RAW udp streaming with netcat

Source: raspivid -n -ih -pf high -h 480 -w 640 -t 0 -hf -vf -fl -b 2000000 -o - | nc 192.168.5.63 5000 -u
Destination: netcat -l -p 5000 -u | gst-launch-1.0 -v fdsrc ! h264parse ! avdec_h264 ! videoconvert ! autovideosink sync=false

RTP Streaming with gstreamer

Source: raspivid -n -hf -vf -pf baseline -w 800 -h 600 -fl --intra 10 -t 0 -b 2000000 -o - | gst-launch-1.0 -v fdsrc ! h264parse ! rtph264pay config-interval=1 pt=96 ! udpsink host=192.168.5.63 port=9001
Destination: gst-launch-1.0 -v udpsrc port=9001 caps='application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264' ! rtph264depay ! avdec_h264 ! videoconvert ! autovideosink sync=false

 

Eclipse with avr eclipse plugin

Eclipse can be used for Arduino and avr embedded development with avr-gcc. There is a nice plugin for it: http://avr-eclipse.sourceforge.net/

The plugin parses the output of some command line program to provide some properties and settings in eclipse. When the system local is not english, this cannot be parsed correctly. The simple fix is to run eclipse with the english locale.

Just create a script with:

#!/bin/bash
LC_MESSAGES=C eclipse

valgrind error – profiling timer expired

Nothing new and nothing surprising, but it still was painful to find out:
Do not use valgrind or helgrind in combination with the c++ compiler options -p and -pg for profiling.

This gave me some strange behavior of my app with sleeps not sleeping. I only had a crashing application, no clue what might be wrong with my code and the error message “Profiling timer expired”.

Just switch off the profiling options and everything was find, except the errors that I wanted valgrind to find for me.