Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have noticed when using the Transmission WebUI on my Debian server that when a download begins, Transmission downloads about 5MB, and then stalls for a few minutes before continuing. On closer inspection, I realised that during this stall time is 'grows' the download file in my downloads directory. Once this file reaches the size of the download, the transmission download continues where it left off.

I am just wondering why it does this? Why does it expand the file to full size when the download begins rather than expanding it during the download? I had thought it could be something relating to free space, but it surely uses du or something to check for free space in the downloads directory before downloading begins.

share|improve this question

2 Answers 2

up vote 1 down vote accepted

Pre-allocating space for the complete file ensures that the torrent client won't end up in a situation where it has downloaded part of the file and then has to stop since it ran out of free space. After all, there might be adequate free space available when the download begins, but without reserving it what's the guarantee it will still be available till the download is complete?

Depending on the client this might be a configurable option. The client might even allow the usage of sparse files on file systems that support them.

share|improve this answer

It is due to the way a torrent transmission is performed and implementation of the Transmission. As you might know it utilizes the p2p communication to get pieces of the files from many peers. The protocol attempts to balance the upload bandwidth across the peers. To achieve this peers regularly exchange the information on segments of the torrent they already downloaded, the current bandwidth and allowed (or measured) maximum upload bandwidth, so ideally your client picks up the peer that currently has lowest load and has a segment not loaded by your client yet. This leads to out of order loading of the segments. Thus, the client may first load the segment that is not at the beginning of the particular file. The Transmission client pre-allocates all necessary space before the segment it is going to receive if this is not done already. This takes some time as Transmisson also needs to update all checksums for newly allocated segments.

share|improve this answer
    
Yes, but out of order piece downloading doesn't require pre-allocation, does it? There are torrent clients that allow you to turn off pre-allocation, and this does not mean they then start downloading sequentially. –  Karan Feb 23 '13 at 15:10
    
As I mentioned, it is implementation dependent. The Transmission client writes each segment into its exact location in the file(s). I suppose this is done to simplify the tracking of the stuff and to avoid later reordering of segments. Also, it simplifies the restart of the transmission when you stop the client and start it again later (for example, you switched off your PC as it is to noisy to let you sleep :) –  Serge Feb 23 '13 at 15:14
    
Ah ok, haven't used Transmission all that much. So it has no option to turn pre-allocation off? –  Karan Feb 23 '13 at 15:18
    
Just checked with its man page - there is no such option. –  Serge Feb 23 '13 at 15:21
    
Actually, I found when the option was added, and also how it can be disabled if required. There's even a "full" option as well apparently (default is "fast"). –  Karan Feb 23 '13 at 15:25

Your Answer

 
discard

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.