Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to use mbuffer to do ZFS replication with, but in order to do that, I have to start it in listening mode on the target host. That I would do from the master host by

ssh mbuffer -s 128k -m 1G -I 9090 | zfs receive tank3/pro4

mbuffer will never timeout, but exit with success when a replication have completed.


It is possible to timeout mbuffer if it haven't returned success within e.g. 2 minutes?

share|improve this question
up vote 2 down vote accepted

There is timelimit utility in FreeBSD ports to limit execution time of any command. If timeout fired, command will be killed.

share|improve this answer
timeout is a similar utility for linux (at least debian and the like) – ndemou Aug 30 '14 at 12:11

Yes, use a wrapper script to start the mbuffer process, record the PID associated with mbuffer, have the script sleep for 2 minutes then if the PID is still in existence, TERM kill the PID.

share|improve this answer

You could also initiate mbuffer through an all-in-one command that uses SSH as a transport. Not an issue if the destination is remote... more of a performance penalty if it's local...

zfs send tank3/pro4@snapshot | mbuffer -q -v 0 -s 128k -m 1G | ssh root@ 'mbuffer -s 128k -m 1G | zfs receive tank3/pro4'

If performance is an issue, you may be bound by CPU and SSH encryption. There are a couple of workarounds for that...

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.