Torrents

From kipiki
Jump to: navigation, search

Bittorrent

This document outlines how to make legal torrents for use for things like file distribution for linux and security materials.

Building torrents

Piece size is one of the most important things to consider when dealing with ultra large torrents (I'm dealing with ones on the order of multiple-terabyte). The piece size needs to get larger the larger the total size of the material becomes larger. From my research here is some handy information:

  • Piece count should be within around 1000 - 2000 pieces or so to reduce memory and cpu footprint, we may exceed that with as large torrents as we deal with but its better to have less
  • Piece size should be a multiple of 2
  • Piece size defaults to 262144 but goes up to 16777216 (16M) at least, its hard to find solid documentation on this, use the most efficient size possible

Creating a single large torrent on a linux system

# Grab the package that provides buildtorrent then create a torrent using the tool.

# example that would use an 8MB piece size (pretty big file):
buildtorrent -a "http://some.tracker.url:6969/announce" -l 8388608 --quiet directory/ name.torrent
  ^^^^^^     ^^^              ^^^^^                     ^^^^^      ^^^^^^^      ^^^^^       ^^^^^
# executable announce_flag announceurl           piece_length reduced_verbosity dir_to_read torrent_name

# check out the man file for buildtorrent, its helpful:
man buildtorrent

Creating torrents en-masse

# Say you has a directory structure such as this:
~/torrentbuild/  <- you are here

# and these are the directories you want to make into torrents:
dir1/
dir2/
dir3/
foo1/
foo2/

# you can create torrents of each of these directories by using find, while and read:
find . -maxdepth 1 -type d | grep ./ | while read i; do echo "doing $i"; time buildtorrent -a "http://some.tracker.url:6969/announce" -l 8388608 --quiet "${i}" "${i}_example.torrent"; done

# this will provide you with torrents like dir1_example.torrent that contains dir1
# if you would like to exclude directories like foo, just add a grep

find . -maxdepth 1 -type d | grep ./ | grep -v foo | while read i; do echo "doing $i"; time buildtorrent -a "http://some.tracker.url:6969/announce" -l 8388608 --quiet "${i}" "${i}_example.torrent"; done

Editing torrents

## to be enhanced later
transmission-edit -a new *
transmission-edit -d old *

Good links for info: