Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I need to make a once off mirror of all the Ubuntu apt repository (for the record it's because I'm sending it to Kenya (see here and here).

I did it before and used apt-mirror, and that does exactly what I want. However now I want to do it slowly, so I want to limit the bandwidth it uses to download. Is there any easy way to do it? Any magic apt configuration setting?

share|improve this question

3 Answers 3

up vote 8 down vote accepted

After I looked at the source code for apt-mirror, I discovered that apt-mirror has inbuilt abilities to limit the bandwith rate.

Just put:

set limit_rate 50k

In your mirror.list file and it will pass that into wget. However that limit is per thread. So if you have 10 threads, this will be 50k * 10 = 500k. This feature is not documentated at all.

share|improve this answer
    
From the limited testing I have done (using nload), it appears that this sets in KiloBytes/s instead of KiloBits, so one may want to divide by 8. E.g if you want to limit to 1 mbit per thread, use a value of 125k –  Programster May 1 at 10:41

Dan Carley are right about perl wrapper. But smarter way - edit ~/.wgetrc (user specific config) or /etc/wgetrc (system-wide config) and add option

limit-rate = 50k # or your limit rate
share|improve this answer
    
Yep, good point. My only small reservation would be forgetting that you've put it at some later date. –  Dan Carley Nov 27 '09 at 14:08

Since apt-mirror is just a Perl wrapper for wget. You could edit the source code to utilise the wget flag --limit-rate which takes a download speed expressed in bytes, kilobytes or megabytes.

Depending upon your understanding of Perl, you could either do this the right way, by adding a new configuration option and ideally submitting a patch back to the author. Or you can just hardcode the value that you need for the moment.

share|improve this answer

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.