Wiki > Creating Torrents
It is possible to create torrents on your Whatbox slot. The files for which you want to create the torrent need to be located on the box.
Torrent creation may take a while. Please be patient. If you believe that torrent creation is taking too long, please check that you are using an appropriate piece size.
ruTorrent
ruTorrent provides an easy graphical interface for creating torrents.
- Open ruTorrent
- Click the Create Torrent button on the toolbar. It is displayed as a star.
- Fill in the fields in the Create New Torrent dialog.
- Select Source - the base directory or file from which to create the torrent - You can browse for the directory or file by using the "..." button to the right of the field.
- Trackers - the trackers you want to add
- Comment - optional
- Piece size:
Use at least a 256KiB piece size unless your torrent's data is less than 10MiB
Files up to 700MiB: 512KiB or 1MiB piece size
Files 700MiB to 4.0GiB: 2MiB or 4MiB piece size
Files 4.0GiB to 10.0GiB: 4MiB or 8MiB piece size
Files 10.0GiB to 30.0GiB: 8MiB or 16MiB piece size
Files 30.0GiB to 100GiB: 16 MiB or 32MiB piece size
Files 100GiB+: 32 MiB or 64MiB piece size. Very old clients or very slow networks may not work with this piece size.
- Click Create, wait for the torrent to finish creating, and click Save.
If all goes well, you will be presented with your browser's standard file download dialog, giving you the option to save the .torrent to your computer.
mktorrent (SSH)
Mktorrent can be used by connecting to your server through SSH. Mktorrent is installed on all Whatbox servers and can be accessed using the command mktorrent
.
View all of mktorrent's switches/help with
mktorrent -help
The general command is in the form of:
mktorrent -l 21 -p -a http://torrent.tracker/announce ~/"files/Torrent Data" -o "Torrent File Name.torrent"
An explanation of the above command is as follows:
mktorrent
- runs mktorrent
-l 21
- Piece length (or size) for the torrent. It's 2^n bytes, so '-l 21' would create a 2^21 = 2MB piece size.
-p
- Sets the private flag on the torrent. This should be set when it will be seeded on private trackers.
-a http://[..]
- Tracker announce url for the torrent.
~/"files/[..]"
- Path to folder or file that the torrent is being created from.
-o file.torrent
- Filename for the .torrent file.
Once the .torrent file is created, simply copy it to the watch directory, and your torrent client will start seeding it.
mktorrent (SSH) with piece length selection
This is a small shell script which takes a file or folder as input, checks the size, and then chooses the appropriate piece length for the mktorrent command.
folder="$1"
output="$folder.torrent"
fsize="$(du -sm $1 | awk '{print $1}')"
announce="https://tracker.com/announce" # Edit this
## Calculate folder/file size
if [ "$fsize" -le 100 ];
then psize="19";
elif [ "$fsize" -le 700 ];
then psize="20";
elif [ "$fsize" -le 2000 ];
then psize="21";
elif [ "$fsize" -le 5000 ];
then psize="22";
elif [ "$fsize" -le 10000 ];
then psize="23";
elif [ "$fsize" -le 30000 ];
then psize="24";
elif [ "$fsize" -le 60000 ];
then psize="25";
elif [ "$fsize" -le 100000 ];
then psize="26";
else echo "Please split your files and create a torrent for each part separately" && exit 1;
fi
## Create .torrent
mktorrent -v -p -l "$psize" -a "$announce" -o "$output" "$folder"
The original script as posted here will make the torrent private -p
. The script can be easily modified, just change the announce variable and remove the -p
option.