Why is /var/lib/mlocate.db almost 800 MB?












15















Can I do something about it? I'm running out of disk space.










share|improve this question

























  • May look as a strange question, but: How do you find the file's size?

    – ulidtko
    Jan 28 '11 at 22:58











  • The database could be stored as a sparse file, and hence real disk usage may differ significantly from that reported by ls and du.

    – ulidtko
    Jan 28 '11 at 23:07
















15















Can I do something about it? I'm running out of disk space.










share|improve this question

























  • May look as a strange question, but: How do you find the file's size?

    – ulidtko
    Jan 28 '11 at 22:58











  • The database could be stored as a sparse file, and hence real disk usage may differ significantly from that reported by ls and du.

    – ulidtko
    Jan 28 '11 at 23:07














15












15








15


3






Can I do something about it? I'm running out of disk space.










share|improve this question
















Can I do something about it? I'm running out of disk space.







disk-usage locate






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 4 '18 at 7:17









muru

1




1










asked Jan 28 '11 at 13:29









evencoilevencoil

4071514




4071514













  • May look as a strange question, but: How do you find the file's size?

    – ulidtko
    Jan 28 '11 at 22:58











  • The database could be stored as a sparse file, and hence real disk usage may differ significantly from that reported by ls and du.

    – ulidtko
    Jan 28 '11 at 23:07



















  • May look as a strange question, but: How do you find the file's size?

    – ulidtko
    Jan 28 '11 at 22:58











  • The database could be stored as a sparse file, and hence real disk usage may differ significantly from that reported by ls and du.

    – ulidtko
    Jan 28 '11 at 23:07

















May look as a strange question, but: How do you find the file's size?

– ulidtko
Jan 28 '11 at 22:58





May look as a strange question, but: How do you find the file's size?

– ulidtko
Jan 28 '11 at 22:58













The database could be stored as a sparse file, and hence real disk usage may differ significantly from that reported by ls and du.

– ulidtko
Jan 28 '11 at 23:07





The database could be stored as a sparse file, and hence real disk usage may differ significantly from that reported by ls and du.

– ulidtko
Jan 28 '11 at 23:07










4 Answers
4






active

oldest

votes


















24














On one of my systems that acts as a backup server, mlocate.db hit 9GB. The solution was to exclude the backup directories from locate, since I had no need to search them.



I did this by adding the backup directory to PRUNEPATHS in /etc/updatedb.conf.



Running sudo updatedb then reduced it to 1.6MB (and saves a huge amount of time indexing all of those files).






share|improve this answer
























  • Perfect, thank you. Just went from 800MB to 100MB, but more importantly, the updatedb command can complete very quickly now, whereas before it was taking days. (Note, however, that it only runs when the computer is not on battery, and it uses low priority IO, according to the script at /etc/cron.daily/mlocate.)

    – mlissner
    Apr 19 '18 at 18:06











  • Wow 9 GB down to 1.6 MB!

    – WinEunuuchs2Unix
    May 23 '18 at 2:17



















9














If you have lots and lots of files on your machine, you may want to consider pruning some paths from the database. You can do this in /etc/updatedb.conf under PRUNEPATHS. You can also prune file systems (like nfs, if you so desire).






share|improve this answer































    3














    800MB sounds pretty much. My /var/lib/mlocate/mlocate.db is about 8MB only (fresh install on 10.04 release date). You can safely delete it, if you run sudo updatedb, it'll be recreated.






    share|improve this answer


























    • thanks, that worked. After running sudo updatedb it is now 620MB. edit: oops I read that wrong. 620MB would mean it didn't work (I thought I read KB on my file output).

      – evencoil
      Jan 28 '11 at 15:17













    • How many files do you have? What is your disk size?

      – Lekensteyn
      Jan 28 '11 at 20:57






    • 1





      Is it really that big? Size in MB: 'du -m /var/lib/mlocate/mlocate.db'

      – user8290
      Jan 28 '11 at 21:12











    • Also both du and ls have an -h flag ` : -h, --human-readable` print sizes in human readable format (e.g., 1K 234M 2G)

      – belacqua
      Jan 28 '11 at 22:02













    • It is really that big...I do have a lot of very small files (related to some data work) across several hard drives, so maybe that is why. edit: I also keep many backups...Is there a way to exclude directories from the indexer? Probably indexing these backups is the big problem.

      – evencoil
      Jan 30 '11 at 12:28





















    -1














    Its a database of all files in your root directory. It is used by locate utility. if you delete this file locate will no longer work.






    share|improve this answer
























    • is it really supposed to be that large?

      – evencoil
      Jan 28 '11 at 14:04











    • It should not be that big. Most probably you have lots of files in your home directory. You can erase it and then let the update run again.

      – user4124
      Jan 28 '11 at 14:43













    • if I erase it will it be recreated automatically at some point?

      – evencoil
      Jan 28 '11 at 15:20











    • it will be recreated when you run "updatedb" command

      – binW
      Jan 28 '11 at 16:45











    • it seems to also be recreated as a daily task?

      – evencoil
      Jan 30 '11 at 12:28











    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "89"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f23692%2fwhy-is-var-lib-mlocate-db-almost-800-mb%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    4 Answers
    4






    active

    oldest

    votes








    4 Answers
    4






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    24














    On one of my systems that acts as a backup server, mlocate.db hit 9GB. The solution was to exclude the backup directories from locate, since I had no need to search them.



    I did this by adding the backup directory to PRUNEPATHS in /etc/updatedb.conf.



    Running sudo updatedb then reduced it to 1.6MB (and saves a huge amount of time indexing all of those files).






    share|improve this answer
























    • Perfect, thank you. Just went from 800MB to 100MB, but more importantly, the updatedb command can complete very quickly now, whereas before it was taking days. (Note, however, that it only runs when the computer is not on battery, and it uses low priority IO, according to the script at /etc/cron.daily/mlocate.)

      – mlissner
      Apr 19 '18 at 18:06











    • Wow 9 GB down to 1.6 MB!

      – WinEunuuchs2Unix
      May 23 '18 at 2:17
















    24














    On one of my systems that acts as a backup server, mlocate.db hit 9GB. The solution was to exclude the backup directories from locate, since I had no need to search them.



    I did this by adding the backup directory to PRUNEPATHS in /etc/updatedb.conf.



    Running sudo updatedb then reduced it to 1.6MB (and saves a huge amount of time indexing all of those files).






    share|improve this answer
























    • Perfect, thank you. Just went from 800MB to 100MB, but more importantly, the updatedb command can complete very quickly now, whereas before it was taking days. (Note, however, that it only runs when the computer is not on battery, and it uses low priority IO, according to the script at /etc/cron.daily/mlocate.)

      – mlissner
      Apr 19 '18 at 18:06











    • Wow 9 GB down to 1.6 MB!

      – WinEunuuchs2Unix
      May 23 '18 at 2:17














    24












    24








    24







    On one of my systems that acts as a backup server, mlocate.db hit 9GB. The solution was to exclude the backup directories from locate, since I had no need to search them.



    I did this by adding the backup directory to PRUNEPATHS in /etc/updatedb.conf.



    Running sudo updatedb then reduced it to 1.6MB (and saves a huge amount of time indexing all of those files).






    share|improve this answer













    On one of my systems that acts as a backup server, mlocate.db hit 9GB. The solution was to exclude the backup directories from locate, since I had no need to search them.



    I did this by adding the backup directory to PRUNEPATHS in /etc/updatedb.conf.



    Running sudo updatedb then reduced it to 1.6MB (and saves a huge amount of time indexing all of those files).







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Jul 10 '12 at 19:37









    user76225user76225

    24122




    24122













    • Perfect, thank you. Just went from 800MB to 100MB, but more importantly, the updatedb command can complete very quickly now, whereas before it was taking days. (Note, however, that it only runs when the computer is not on battery, and it uses low priority IO, according to the script at /etc/cron.daily/mlocate.)

      – mlissner
      Apr 19 '18 at 18:06











    • Wow 9 GB down to 1.6 MB!

      – WinEunuuchs2Unix
      May 23 '18 at 2:17



















    • Perfect, thank you. Just went from 800MB to 100MB, but more importantly, the updatedb command can complete very quickly now, whereas before it was taking days. (Note, however, that it only runs when the computer is not on battery, and it uses low priority IO, according to the script at /etc/cron.daily/mlocate.)

      – mlissner
      Apr 19 '18 at 18:06











    • Wow 9 GB down to 1.6 MB!

      – WinEunuuchs2Unix
      May 23 '18 at 2:17

















    Perfect, thank you. Just went from 800MB to 100MB, but more importantly, the updatedb command can complete very quickly now, whereas before it was taking days. (Note, however, that it only runs when the computer is not on battery, and it uses low priority IO, according to the script at /etc/cron.daily/mlocate.)

    – mlissner
    Apr 19 '18 at 18:06





    Perfect, thank you. Just went from 800MB to 100MB, but more importantly, the updatedb command can complete very quickly now, whereas before it was taking days. (Note, however, that it only runs when the computer is not on battery, and it uses low priority IO, according to the script at /etc/cron.daily/mlocate.)

    – mlissner
    Apr 19 '18 at 18:06













    Wow 9 GB down to 1.6 MB!

    – WinEunuuchs2Unix
    May 23 '18 at 2:17





    Wow 9 GB down to 1.6 MB!

    – WinEunuuchs2Unix
    May 23 '18 at 2:17













    9














    If you have lots and lots of files on your machine, you may want to consider pruning some paths from the database. You can do this in /etc/updatedb.conf under PRUNEPATHS. You can also prune file systems (like nfs, if you so desire).






    share|improve this answer




























      9














      If you have lots and lots of files on your machine, you may want to consider pruning some paths from the database. You can do this in /etc/updatedb.conf under PRUNEPATHS. You can also prune file systems (like nfs, if you so desire).






      share|improve this answer


























        9












        9








        9







        If you have lots and lots of files on your machine, you may want to consider pruning some paths from the database. You can do this in /etc/updatedb.conf under PRUNEPATHS. You can also prune file systems (like nfs, if you so desire).






        share|improve this answer













        If you have lots and lots of files on your machine, you may want to consider pruning some paths from the database. You can do this in /etc/updatedb.conf under PRUNEPATHS. You can also prune file systems (like nfs, if you so desire).







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Aug 3 '11 at 12:50









        Zach BethelZach Bethel

        9112




        9112























            3














            800MB sounds pretty much. My /var/lib/mlocate/mlocate.db is about 8MB only (fresh install on 10.04 release date). You can safely delete it, if you run sudo updatedb, it'll be recreated.






            share|improve this answer


























            • thanks, that worked. After running sudo updatedb it is now 620MB. edit: oops I read that wrong. 620MB would mean it didn't work (I thought I read KB on my file output).

              – evencoil
              Jan 28 '11 at 15:17













            • How many files do you have? What is your disk size?

              – Lekensteyn
              Jan 28 '11 at 20:57






            • 1





              Is it really that big? Size in MB: 'du -m /var/lib/mlocate/mlocate.db'

              – user8290
              Jan 28 '11 at 21:12











            • Also both du and ls have an -h flag ` : -h, --human-readable` print sizes in human readable format (e.g., 1K 234M 2G)

              – belacqua
              Jan 28 '11 at 22:02













            • It is really that big...I do have a lot of very small files (related to some data work) across several hard drives, so maybe that is why. edit: I also keep many backups...Is there a way to exclude directories from the indexer? Probably indexing these backups is the big problem.

              – evencoil
              Jan 30 '11 at 12:28


















            3














            800MB sounds pretty much. My /var/lib/mlocate/mlocate.db is about 8MB only (fresh install on 10.04 release date). You can safely delete it, if you run sudo updatedb, it'll be recreated.






            share|improve this answer


























            • thanks, that worked. After running sudo updatedb it is now 620MB. edit: oops I read that wrong. 620MB would mean it didn't work (I thought I read KB on my file output).

              – evencoil
              Jan 28 '11 at 15:17













            • How many files do you have? What is your disk size?

              – Lekensteyn
              Jan 28 '11 at 20:57






            • 1





              Is it really that big? Size in MB: 'du -m /var/lib/mlocate/mlocate.db'

              – user8290
              Jan 28 '11 at 21:12











            • Also both du and ls have an -h flag ` : -h, --human-readable` print sizes in human readable format (e.g., 1K 234M 2G)

              – belacqua
              Jan 28 '11 at 22:02













            • It is really that big...I do have a lot of very small files (related to some data work) across several hard drives, so maybe that is why. edit: I also keep many backups...Is there a way to exclude directories from the indexer? Probably indexing these backups is the big problem.

              – evencoil
              Jan 30 '11 at 12:28
















            3












            3








            3







            800MB sounds pretty much. My /var/lib/mlocate/mlocate.db is about 8MB only (fresh install on 10.04 release date). You can safely delete it, if you run sudo updatedb, it'll be recreated.






            share|improve this answer















            800MB sounds pretty much. My /var/lib/mlocate/mlocate.db is about 8MB only (fresh install on 10.04 release date). You can safely delete it, if you run sudo updatedb, it'll be recreated.







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Jan 28 '11 at 21:17

























            answered Jan 28 '11 at 14:07









            LekensteynLekensteyn

            123k49269361




            123k49269361













            • thanks, that worked. After running sudo updatedb it is now 620MB. edit: oops I read that wrong. 620MB would mean it didn't work (I thought I read KB on my file output).

              – evencoil
              Jan 28 '11 at 15:17













            • How many files do you have? What is your disk size?

              – Lekensteyn
              Jan 28 '11 at 20:57






            • 1





              Is it really that big? Size in MB: 'du -m /var/lib/mlocate/mlocate.db'

              – user8290
              Jan 28 '11 at 21:12











            • Also both du and ls have an -h flag ` : -h, --human-readable` print sizes in human readable format (e.g., 1K 234M 2G)

              – belacqua
              Jan 28 '11 at 22:02













            • It is really that big...I do have a lot of very small files (related to some data work) across several hard drives, so maybe that is why. edit: I also keep many backups...Is there a way to exclude directories from the indexer? Probably indexing these backups is the big problem.

              – evencoil
              Jan 30 '11 at 12:28





















            • thanks, that worked. After running sudo updatedb it is now 620MB. edit: oops I read that wrong. 620MB would mean it didn't work (I thought I read KB on my file output).

              – evencoil
              Jan 28 '11 at 15:17













            • How many files do you have? What is your disk size?

              – Lekensteyn
              Jan 28 '11 at 20:57






            • 1





              Is it really that big? Size in MB: 'du -m /var/lib/mlocate/mlocate.db'

              – user8290
              Jan 28 '11 at 21:12











            • Also both du and ls have an -h flag ` : -h, --human-readable` print sizes in human readable format (e.g., 1K 234M 2G)

              – belacqua
              Jan 28 '11 at 22:02













            • It is really that big...I do have a lot of very small files (related to some data work) across several hard drives, so maybe that is why. edit: I also keep many backups...Is there a way to exclude directories from the indexer? Probably indexing these backups is the big problem.

              – evencoil
              Jan 30 '11 at 12:28



















            thanks, that worked. After running sudo updatedb it is now 620MB. edit: oops I read that wrong. 620MB would mean it didn't work (I thought I read KB on my file output).

            – evencoil
            Jan 28 '11 at 15:17







            thanks, that worked. After running sudo updatedb it is now 620MB. edit: oops I read that wrong. 620MB would mean it didn't work (I thought I read KB on my file output).

            – evencoil
            Jan 28 '11 at 15:17















            How many files do you have? What is your disk size?

            – Lekensteyn
            Jan 28 '11 at 20:57





            How many files do you have? What is your disk size?

            – Lekensteyn
            Jan 28 '11 at 20:57




            1




            1





            Is it really that big? Size in MB: 'du -m /var/lib/mlocate/mlocate.db'

            – user8290
            Jan 28 '11 at 21:12





            Is it really that big? Size in MB: 'du -m /var/lib/mlocate/mlocate.db'

            – user8290
            Jan 28 '11 at 21:12













            Also both du and ls have an -h flag ` : -h, --human-readable` print sizes in human readable format (e.g., 1K 234M 2G)

            – belacqua
            Jan 28 '11 at 22:02







            Also both du and ls have an -h flag ` : -h, --human-readable` print sizes in human readable format (e.g., 1K 234M 2G)

            – belacqua
            Jan 28 '11 at 22:02















            It is really that big...I do have a lot of very small files (related to some data work) across several hard drives, so maybe that is why. edit: I also keep many backups...Is there a way to exclude directories from the indexer? Probably indexing these backups is the big problem.

            – evencoil
            Jan 30 '11 at 12:28







            It is really that big...I do have a lot of very small files (related to some data work) across several hard drives, so maybe that is why. edit: I also keep many backups...Is there a way to exclude directories from the indexer? Probably indexing these backups is the big problem.

            – evencoil
            Jan 30 '11 at 12:28













            -1














            Its a database of all files in your root directory. It is used by locate utility. if you delete this file locate will no longer work.






            share|improve this answer
























            • is it really supposed to be that large?

              – evencoil
              Jan 28 '11 at 14:04











            • It should not be that big. Most probably you have lots of files in your home directory. You can erase it and then let the update run again.

              – user4124
              Jan 28 '11 at 14:43













            • if I erase it will it be recreated automatically at some point?

              – evencoil
              Jan 28 '11 at 15:20











            • it will be recreated when you run "updatedb" command

              – binW
              Jan 28 '11 at 16:45











            • it seems to also be recreated as a daily task?

              – evencoil
              Jan 30 '11 at 12:28
















            -1














            Its a database of all files in your root directory. It is used by locate utility. if you delete this file locate will no longer work.






            share|improve this answer
























            • is it really supposed to be that large?

              – evencoil
              Jan 28 '11 at 14:04











            • It should not be that big. Most probably you have lots of files in your home directory. You can erase it and then let the update run again.

              – user4124
              Jan 28 '11 at 14:43













            • if I erase it will it be recreated automatically at some point?

              – evencoil
              Jan 28 '11 at 15:20











            • it will be recreated when you run "updatedb" command

              – binW
              Jan 28 '11 at 16:45











            • it seems to also be recreated as a daily task?

              – evencoil
              Jan 30 '11 at 12:28














            -1












            -1








            -1







            Its a database of all files in your root directory. It is used by locate utility. if you delete this file locate will no longer work.






            share|improve this answer













            Its a database of all files in your root directory. It is used by locate utility. if you delete this file locate will no longer work.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Jan 28 '11 at 13:41









            binWbinW

            9,45863962




            9,45863962













            • is it really supposed to be that large?

              – evencoil
              Jan 28 '11 at 14:04











            • It should not be that big. Most probably you have lots of files in your home directory. You can erase it and then let the update run again.

              – user4124
              Jan 28 '11 at 14:43













            • if I erase it will it be recreated automatically at some point?

              – evencoil
              Jan 28 '11 at 15:20











            • it will be recreated when you run "updatedb" command

              – binW
              Jan 28 '11 at 16:45











            • it seems to also be recreated as a daily task?

              – evencoil
              Jan 30 '11 at 12:28



















            • is it really supposed to be that large?

              – evencoil
              Jan 28 '11 at 14:04











            • It should not be that big. Most probably you have lots of files in your home directory. You can erase it and then let the update run again.

              – user4124
              Jan 28 '11 at 14:43













            • if I erase it will it be recreated automatically at some point?

              – evencoil
              Jan 28 '11 at 15:20











            • it will be recreated when you run "updatedb" command

              – binW
              Jan 28 '11 at 16:45











            • it seems to also be recreated as a daily task?

              – evencoil
              Jan 30 '11 at 12:28

















            is it really supposed to be that large?

            – evencoil
            Jan 28 '11 at 14:04





            is it really supposed to be that large?

            – evencoil
            Jan 28 '11 at 14:04













            It should not be that big. Most probably you have lots of files in your home directory. You can erase it and then let the update run again.

            – user4124
            Jan 28 '11 at 14:43







            It should not be that big. Most probably you have lots of files in your home directory. You can erase it and then let the update run again.

            – user4124
            Jan 28 '11 at 14:43















            if I erase it will it be recreated automatically at some point?

            – evencoil
            Jan 28 '11 at 15:20





            if I erase it will it be recreated automatically at some point?

            – evencoil
            Jan 28 '11 at 15:20













            it will be recreated when you run "updatedb" command

            – binW
            Jan 28 '11 at 16:45





            it will be recreated when you run "updatedb" command

            – binW
            Jan 28 '11 at 16:45













            it seems to also be recreated as a daily task?

            – evencoil
            Jan 30 '11 at 12:28





            it seems to also be recreated as a daily task?

            – evencoil
            Jan 30 '11 at 12:28


















            draft saved

            draft discarded




















































            Thanks for contributing an answer to Ask Ubuntu!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f23692%2fwhy-is-var-lib-mlocate-db-almost-800-mb%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            GameSpot

            日野市

            Tu-95轟炸機