Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

CentOS 5.6

NFS is mounted on the server for backup disk space. When the backup job started, it could reach 80MB/s and we really do not expect it took so much bandwidth. So i need to find a way to limit the speed of writing to NFS.

I tried rsync with --bwlimit=5000. However, it did limit the reading speed, but the accumulated data still was written at 80MB/s, and no writing activities for seconds.

Is there any way to limit the writing speed of NFS?

share|improve this question
up vote 2 down vote accepted

Sorry for opening such an old thread, but I wrote a little script to limit speed tranfer using the pv command, it works over NFS as well. The only thing I haven't gotten over yet is a drop of speed, it happens only when I use NFS over sshfs everything is fine.

My server NFS configuration (the exports):


And the client configuration (mount options):


Here's my script:


 # Simple Script to mv files OR folders at $3 BPS  

tor_dir="$(basename "$tor_path")"  

[[ "$mv_dir" != *"/" ]] && mv_dir=""$mv_dir"/"  

if [[ -f "$tor_path" ]] && [[ -d "$mv_dir" ]]  
  pv -L "$speed" "$tor_path" > "$mv_dir""$tor_dir"  
elif [[ -d "$tor_path" ]] && [[ -d "$mv_dir" ]]  
    tor_files="$(mktemp --tmpdir tor_files.XXXXXX)"  
    [[ "$tor_path" != *"/" ]] && tor_path=""$tor_path"/"  

    find "$tor_path" -type d > "$tor_files"  
    sed 's#'"$tor_path"'#'"$tor_dir"'/#g; s###g' -i "$tor_files"  

    tlines="$(wc -l < "$tor_files")"   
    while [ "$cnt" -lt "$tlines" ]  
        let cnt++  
        file="$(head -n $cnt $tor_files | tail -1)"  
        mkdir "$mv_dir""$file"  

    find "$tor_path" -type f > "$tor_files"  
    sed 's#'"$tor_path"'#'"$tor_dir"'/#g' -i "$tor_files"  

    tlines="$(wc -l < "$tor_files")"  
    while [ "$cnt" -lt "$tlines" ]  
        let cnt++  
        file="$(head -n $cnt $tor_files | tail -1)"  
        pv -L "$speed" "$tor_path""$(basename "$file")" > "$mv_dir""$file"  

    rm "$tor_files"  
    exit 1    
share|improve this answer

NFS does not supply a method to limit the bandwidth used by the client.

The behaviour you're seeing where data accumulates and is then written out at full speed is the dirty pages growing on the client and then being flushed out to the NFS server. This is the expected way that IO works.

On a Linux NFS client, you can use tc to match and control traffic. This would be as simple as making a class with the NFS server's IP address as the destination, and ratelimiting that class.

This is covered in the Linux Advanced Routing & Traffic Control HOWTO, specifically in Chapter 9 Queueing Disciplines for Bandwidth Management and within man tc.

Here is an example of the exact commands to use:

share|improve this answer

Your Answer


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.