Monthly Archives: June 2016

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

Send incremental snapshots:

zfs send -i tank/data@snapshot1 tank/data@snapshot2  | zfs recv anothertank/data

In case there are changes on the destination filesystem, the snapshot cannot be added and need to be rolled back. This can be done automatically using the -F flag:

zfs send -i tank/data@snapshot1 tank/data@snapshot2  | zfs recv -F anothertank/data

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