Backup a filesystem to a remote machine and use cstream to throttle bandwidth of the backup

nice -n19 dump -0af - /<filesystem> -z9|gpg -e -r <gpg key id>|cstream -v 1 -t 60k|ssh <user@host> "cat > backup.img"
This command will nicely dump a filesystem to STDOUT, compress it, encrypt it with the gpg key of your choice, throttle the the data stream to 60kb/s and finally use ssh to copy the contents to an image on a remote machine.
Sample Output
DUMP: Date of this level 0 dump: Thu Oct 29 12:39:05 2009
DUMP: Dumping /dev/mapper/backup (/backup) to standard output
DUMP: Label: none
DUMP: Writing 10 Kilobyte records
DUMP: Compressing output at compression level 9 (zlib)
DUMP: mapping (Pass I) [regular files]
DUMP: mapping (Pass II) [directories]
DUMP: estimated 568617 blocks.
DUMP: Volume 1 started with block 1 at: Thu Oct 29 12:39:10 2009
DUMP: dumping (Pass III) [directories]
DUMP: dumping (Pass IV) [regular files]
DUMP: 3.29% done at 62 kB/s, finished in 2:27
DUMP: 6.46% done at 61 kB/s, finished in 2:24
DUMP: 9.65% done at 60 kB/s, finished in 2:20
DUMP: 12.84% done at 60 kB/s, finished in 2:15
DUMP: 16.06% done at 60 kB/s, finished in 2:10
DUMP: 19.28% done at 60 kB/s, finished in 2:05

By: din7
2009-10-29 18:27:25

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this? is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands

Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.


Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: