svn - svn - Is it possible to analyze the size of a SubVersion repository? - answerstu - answerstu.com answerstu

svn - Is it possible to analyze the size of a SubVersion repository?

Is it possible to know how much disk space each project in a SubVersion repository is using?

I can check out a working copy of each project and look at the size each project takes up, but I don't think that encompasses the total size of the project (all revisions).

I can look under the "db" directory of the repository, but none of the files in there make sense - I don't think it is possible to use them to figure out how much space each project occupies.

I tried the svn ls --verbose command, but the size that it gives me is just the size of the actual files in the head revision, I don't think it includes all revisions.

Maybe this isn't possible, but I thought I would ask.

Thanks in advance!

5 Answers

  1. Henry- Reply

    2019-11-15

    The only thing that comes into my mind is this:

    • create a temporary new empty repository

    • svnadmin dump the old repository, filter it to retain just a single project with svndumpfilter, and import it into the new repository

    • look at the size of the new repository, then delete it

  2. Ivan- Reply

    2019-11-15

    I used this recently but changed it slightly to be more accurate

    svn list -vR svn://server/repo/somedir | awk '{tmp=match($3,/[0-9]/);if(tmp){sum+=$3; i++}} END {print "\ntotal size= " sum/1024000" MB" "\nnumber of files= " i/1000 " K"}'
    

    I used

    {tmp=match($3,/[0-9]/) 
    

    instead of if

    ($3 !="")
    

    as it gives a more accurate file count

  3. Isaac- Reply

    2019-11-15

    If you use the -r option, you can specify a revision.

    For example, revision 1000:

    svn ls -vR -r 1000
    
  4. Jack- Reply

    2019-11-15

    Size of the repository can be found using the following command ..

    Though this doesn't produce the exact results all the time, I found this to be helpful most of the times.

    svn list -vR svn://server/repo/somedir | awk '{if ($3 !="") sum+=$3; i++} END {print "\ntotal size= " sum/1024000" MB" "\nnumber of files= " i/1000 " K"}'.
    
  5. Jackson- Reply

    2019-11-15

    If you have access to the server terminal you can use du (disk used):

    du -sh /var/svn-repos/project-doomsday
    

    that gives you the total amount of space used by that repo on the server, including the usually small database.

Leave a Reply

Your email address will not be published. Required fields are marked *

You can use these HTML tags and attributes <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>