Downloading with Torrents

J

Jarret W. Buse

Guest
Downloading with Torrents

Many people scour the Internet looking for files they need. Sometimes it is not easy finding a download link for a specific distro or version of Linux. Because of the vastness of the Internet, many people have files on their systems and are sharing them with others. Some files can be very new while others can be very old. Older files allow for you to find those outdated programs you are wanting, such as old DOS games. Newer files are also handy when a new release of a distro is on a server, but the server is being bombarded with downloaders and the bandwidth is horrible. To help you, Torrent applications can be extremely handy.

All Torrent clients have many similarities and can be easily explained using only one Torrent program. Most Linux systems use Transmission, so this is the application I will use for examples and screenshots.

NOTE: Again, most of this is applicable to all applications and you can use this information to better understand your Torrent program.

Let's start by going over some basic information. Torrents are not the application you are downloading. The web servers which store the Torrents most likely do not have the actual programs you are downloading. For example, if you are downloading a new version of Fedora, the torrent file is not the Fedora Operating System (OS). The server from which you download the torrent file most likely does not have the Fedora OS file you need. The torrent file contains metadata information about the files you are wanting to download. It also contains a list of servers from which you are able to connect to other systems which are sharing the file you want. Other information contained in the torrent file such as file sizes, folder structure, encrypted hash values for the files, etc.

NOTE: Because you are not downloading the program from the server, but from other peer systems, this system known as a peer-to-peer file sharing network.

The actual layout of the bencoded dictionary torrent file is:

  • announce – URL of trackers
  • info – maps to a dictionary
  • name – file or folder name
  • piece length – the bytes per piece (usually 256 KB)
  • pieces – hash list
  • length – file size in bytes
  • files – list of dictionaries corresponding to a file
    • path – folder structure and file name
    • length – size of file in bytes
NOTE: Torrent file must be UTF-8 encoded.

Let's look at a few terms used in a Torrent program:

  • Availability – number of seeders sharing the torrent. Every peer sharing 100% of the files will increase the availability by 1.0. If a peer has only 71.2% of the torrent, then the availability is increased by .712. The higher the availability number the better chance you have of getting the complete torrent as well as getting it quickly
  • Choked – a peer is choked when a client refuses to send pieces to them
  • Client – program used to enable peer-to-peer sharing
  • Downloader – a client which does not have the full download and is still downloading the file
  • Endgame – when the last few pieces are being downloaded. Since files are downloaded in pieces, the more available pieces are downloaded first. The last few pieces may not be as highly available as others and they download slower
  • Fake – a torrent which does not contain the files specified (these do exist)
  • FreeLeech – the downloaded size does not count toward the sharing ratio
  • Grab – when the torrent file of the metadata is downloaded
  • Hash – string of characters which are used to check the validity of the downloaded files
  • Health – the numeric value of the number of available completed shared files. High availablity provides a higher health
  • Hit-and-Run – download a file (leeching) and sharing little or none with others
  • Index – a list of torrents on a web site
  • Interested – when a client wants a piece of the torrent from another peer
  • Leech – a downloader who often has a low share ratio or does not share the file they are downloading
  • Lurker – a client who downloads but does not share new content
  • Magnet – a link mechanism similar to a torrent file. Most torrent clients can use Magnet links as well as Torrent links
  • Overseeded – when there are so many seeders that a client has difficulty finding peers
  • Peer – a system using client software to share files on the Internet
  • Piece – a portion of the downloaded files within the torrent. The files are separated into equal pieces which each piece can be verified by the Hash. If a piece fails the Hash check, it is removed and downloaded again
  • Scraping – When a client requests information from a tracker about the torrent statistics
  • Seed – a seed is a piece of the downloaded file which the peer can share with others. Pieces must be completed and verified before they can seeded
  • Share Ratio – ratio of downloaded data to seeded data. Ratios over 1.0 show that the client has uploaded more data than it downloaded
  • Snatch – when the files within the torrent have been downloaded
  • Snub – when a downloading client has not received data for 60 seconds or more from a seeder
  • Super Seeding – when a file is new and certain pieces have not been shared. This mode causes the low ratio shared pieces to be “pushed” out so there are more seeders for the pieces
  • Swarm – all seeders sharing a file
  • Torrent – the file of metadata or the file described in the torrent file to be downloaded
  • Tracker – server keeping a list of peers and seeders. When a client needs a list of peers to share with, the list comes from the Tracker

Once you have a torrent file, it can be loaded into a torrent client such as Transmission. Once loaded, you are given options for the files to be downloaded.

Figure 1.jpg

FIGURE 1

As you can see from Figure 1, the name of my Torrent file is listed at the top. The Torrent is for a DVD of the 64-bit version of Fedora 19. My destination folder is 'Data' which has 8.24 GB free.

The next section under this shows I am downloading a folder called 'Fedora-19-x86_64-DVD' which has a total size of 4.44 GB. Since the torrent file has just been added and not started, I have 0% completed. The folder is selected to be downloaded with 'Normal' priority.

Within the folder, there are two files. The first is named 'Fedora-19-x86_64-Checksum' which is 1.12 KB. It is also selected to download at 'Normal' priority. The second file is 'Fedora-19-x86_64-DVD.iso' which is 4.44 GB in size and also selected to download at 'Normal' priority.

Towards the bottom, the overall Torrent priority is set at 'Normal'. The Torrent is set automatically to start downloading when added and the option is not selected to 'Move .torrent file to the trash'. Once the Torrent file is loaded into your client, the torrent file is moved to the trash.

You can now select 'Open' to load the Torrent file into the client, once all options are set, or 'Cancel' to not load the Torrent.

The options here to be changed include the location of the download, files to download and the priority of the downloaded files.

To start, the location of the download will be dependent on your preference. The files to download can be selected or unselected by the checkbox under 'Download'. The Priority of each file can be set so certain files will finish before others. The three options are: High, Normal and Low. I could place the whole folder at a High priority which would change all the files within it to a High priority. Each individual file can be placed at different priorities depending on their importance to being downloaded.

NOTE: Be aware that the Highest priority files will be allotted more time and bandwidth to finish first. Small files with a Low Priority may still finish first because of size. Since the files within the Torrent are in 'Pieces', a small file may be part of a tail piece of a bigger file. When the tail piece is downloaded for the bigger file, the smaller file is part of that piece and it is downloaded as well.

After you have selected to 'Open' the Torrent, it is added to the client and started if the option was selected to 'Start when added'. Once added or started, these options can be changed as needed.The started torrent can be seen in Figure 2.

Figure 2.jpg

FIGURE 2

In Figure 2, you can see that the file is downloading from 44 of 47 peers. This means that 47 peers were found and of those 44 are actively sending me parts of the torrent. The total download speed from the 44 peers is 1.12 MB/s. Currently, my client is not uploading to anyone since my upload speed is 0 KB/s. My ratio of downloads to uploads is .01. I have downloaded more data than I have uploaded.

When you right-click on a Torrent, you have the options as shown in Figure 3.

Figure 3.jpg

FIGURE 3

In Figure 3, you can see in the background that the Torrent is paused. Torrents can be paused, started and queued.

Starting a Torrent makes it active in the list to be downloaded. A started Torrent may be set to be queued, or may automatically be queued depending on settings (covered later). Other options are as follows:

  • Start Now - the Torrent is started no matter the settings and it bypasses the queue
  • Open Folder - will open your default File Manager to the directory in which the Torrent contents are being saved
  • Ask tracker for more peers - will contact the Trackers in the list to query for any peers it may have that have connected since you last made a query to the Tracker
  • Set Location - allows you to change the target folder where the Torrent contents are saved
  • Verify Local Data - checks the downloaded pieces to the hash to verify they are not corrupted
  • Copy Magnet link to clipboard - if the download is a Magnet link and not an actual Torrent, it is copied to the clipboard
  • Remove - unloads the Torrent from the client leaving the Torrent file and downloaded data (unless Torrent was set to delete after adding to client)
  • Delete files and remove – Torrent is removed from client, files are deleted as is the .torrent file

When a Torrent is added, you can determine more information by selecting Properties or even double-clicking the Torrent. Figure 4 shows the first screen which appears when the Properties option is selected. The 'Activity' section shows file information as well as download and upload statistics for the Torrent. The 'Details' section shows more information on the Torrent itself.

Figure 4.jpg

FIGURE 4

The next tab is 'Peers', shown in Figure 5, which lists the current peers to which you are connected. The tab shows peers to which you are uploading and downloading the selected Torrent. The little locks on the far left column shows if a peer is using an encrypted connection. The 'Up' column shows how much data you have sent to the peer. The 'Down' column shows how much data you have received from the peer. The '%' column shows how much of the total Torrent that the peer has to share. It is best to see a lot of '100%'. The Flags column specifies quite a bit of information which is signified by each letter as follows:

  • O - optimistic unchoke
  • D - currently downloading from peer
  • d - peer not currently allowing you to download from them
  • U - you are uploading to peer
  • u - you can upload to peer if they request it
  • K - connection is unchoked, but you have not requested to download
  • ? - you unchoked this peer, but they've made no requests
  • E - connection to peer is encrypted
  • H - peer was found through Distributed Hash Table (DHT)
  • X - peer was found through Peer Exchange (PEX)
  • I - connection with peer is incoming
  • T - connection with peer is via UTP

NOTE: The DHT is a Hash Table gathered from the Trackers. The PEX is when each peer sends a list of all of its peers to you so your client can find new peers to connect with for sharing.

Figure 5.jpg

FIGURE 5

NOTE: A setting to allow encrypted connection is preferred. If you enforce the option, you cannot download from peers who do not enable encryption on their side. Some ISP's actually block Torrent traffic, so it is best to encrypt your connections.

The next tab is the 'Trackers' tab. In Figure 6, you can see the tab from the Fedora download. A list of trackers are listed showing whether a connection to the Tracker is currently open or not.The Address column shows the IP address of the peer. The Client column shows which client software the peer is using. The next tab, Figure 6, is the Trackers tab. Here, are the list of connected Trackers as well as those which are not available. Looking at Figure 6, you can see that the last tracker is not available. It is easy to select the tracker and then select 'Remove'. You can select 'Add' to add a new tracker to the list. The 'Edit' button shows all the trackers and allows you to remove or add in the box it displays. When editing the list of trackers, be aware that there is a blank line between each tracker.

NOTE: Trackers which are not available will occasionally try to be connected to and determine if it is online. It is usually best to remove offline Trackers to help bandwidth. If all trackers are unavailble, do not delete them all.

Figure 6.jpg

FIGURE 6

The next tab is the 'Files' tab, as shown in Figure 7. This is where you see each folder and file in the torrent and you can modify the priorities for all of the items in the list. You are also shown the percentage downloaded of each folder and file. If a file is not needed, you can unselect the 'Download' box for the specific folder or file.

Figure 7.jpg

FIGURE 7

The last tab is the 'Options' tab, as shown in Figure 8. This is where download and upload settings can be overridden from those set as default or defined here as 'Global Limits'. These options work when you have multiple Torrents downloading and you want to keep the priorities, but limit bandwidth for a specific Torrent.

For example, if you are downloading Fedora and Bodhi, both at 'High' priority. However, you want Bodhi to complete first. To do this, change the priority for Fedora or change the options for Fedora. By leaving Fedora at High priority, you will let it have less bandwidth than Bodhi, but more than any torrent at Normal or Low priority.

Figure 8.jpg

FIGURE 8

In the Options tab, we can limit our download speed. My default is 2000 KB/s while my upload speed is 100 KB/s. My overall Torrent priority is set to Normal and can be changed to High, Normal or Low. Seeding Limits are set to 'Use global settings', but can be changed. You can choose 'Seed regardless of ratio' which will seed until you stop it. You can also set it to 'Stop seeding at ratio:' and specify the ratio you wish. To stop seeding completely, choose 'Stop seeding at ratio:' and specify '0'.

The next options is 'Idle:' which lets the torrent stop seeding if no one is downloading from you. You can leave the Global settings or change it to 'Seed regardless of activity' to seed until you stop it. You can also choose 'Stop seeding of idle for more than N minutes:' and specify the number of minutes.

A very important setting here is the 'Maximum number of peers'. Mine is set to 200, but for torrents with a large number of peers, you can download it faster by increasing the number of peers.

NOTE: Global settings are set under Edit → Preferences.

Sometimes your system repository does not include the latest version of Transmission. To get the latest version, you need to add a ppa by doing the following:

sudo add-apt-repository ppa:transmissionbt/ppa
sudo apt-get update
sudo apt-get install transmission

To help maximize bandwidth, go to Edit and select Preferences. Go to the Network tab and enable 'Use UPnP or NAT-PMP port forwarding from my router'. On the 'Download' tab, set the Download speed to about 75-80% of your total download speed. This will leave you some room to do other things on the Internet. You can always increase the bandwidth for special Torrents. Set all Torrents to High Priority and all files and folders to High priority.

NOTE: A good torrent site is Torrentz.eu to find all kinds of Linux distros and other files.
 

Attachments

  • slide.jpg
    slide.jpg
    53.5 KB · Views: 172,665


I like to use the command line tool Aria2c

http://aria2.sourceforge.net/

It does some cool tricks. You can try to speed up downloads using multiple mirrors of the file. More relevent to this topic though, you can use Aria2c with Torrents.

Aria2 is available in most repos.
 

Members online


Top