NixOS: No space left on /nix/store during nixos-rebuild or nixops deploy

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
1
down vote

favorite












When doing upgrades (especially large ones) on NixOS with a relatively small root partition, I sometimes run out of space after a bunch of new packages are installed in /nix/store. Eg:



error: preallocating file of 716320 bytes: No space left on device


My usual approach has been to run



nix-collect-garbage


or even



nix-collect-garbage -d


which frees up space by deleting not only the old generations but also the new packages I'm installing.



The next download attempt will download the new packages all over again, and -- if enough space was freed -- may succeed.



Is there a way to delete only the older derivations?







share|improve this question
















  • 3




    How about cleaning before starting the update?
    – MariusMatutiae
    Mar 24 at 12:09










  • @MariusMatutiae Deleting old generations (particularly the last one booted from) is a little risky, and of course still doesn't guarantee that enough space will be freed to avoid downloading repeatedly. Sometimes you have to GC, do a partial update, GC again, and then finally finish the update. It can be pretty annoying without a way to tell whether enough space is available.
    – aij
    Mar 26 at 14:44














up vote
1
down vote

favorite












When doing upgrades (especially large ones) on NixOS with a relatively small root partition, I sometimes run out of space after a bunch of new packages are installed in /nix/store. Eg:



error: preallocating file of 716320 bytes: No space left on device


My usual approach has been to run



nix-collect-garbage


or even



nix-collect-garbage -d


which frees up space by deleting not only the old generations but also the new packages I'm installing.



The next download attempt will download the new packages all over again, and -- if enough space was freed -- may succeed.



Is there a way to delete only the older derivations?







share|improve this question
















  • 3




    How about cleaning before starting the update?
    – MariusMatutiae
    Mar 24 at 12:09










  • @MariusMatutiae Deleting old generations (particularly the last one booted from) is a little risky, and of course still doesn't guarantee that enough space will be freed to avoid downloading repeatedly. Sometimes you have to GC, do a partial update, GC again, and then finally finish the update. It can be pretty annoying without a way to tell whether enough space is available.
    – aij
    Mar 26 at 14:44












up vote
1
down vote

favorite









up vote
1
down vote

favorite











When doing upgrades (especially large ones) on NixOS with a relatively small root partition, I sometimes run out of space after a bunch of new packages are installed in /nix/store. Eg:



error: preallocating file of 716320 bytes: No space left on device


My usual approach has been to run



nix-collect-garbage


or even



nix-collect-garbage -d


which frees up space by deleting not only the old generations but also the new packages I'm installing.



The next download attempt will download the new packages all over again, and -- if enough space was freed -- may succeed.



Is there a way to delete only the older derivations?







share|improve this question












When doing upgrades (especially large ones) on NixOS with a relatively small root partition, I sometimes run out of space after a bunch of new packages are installed in /nix/store. Eg:



error: preallocating file of 716320 bytes: No space left on device


My usual approach has been to run



nix-collect-garbage


or even



nix-collect-garbage -d


which frees up space by deleting not only the old generations but also the new packages I'm installing.



The next download attempt will download the new packages all over again, and -- if enough space was freed -- may succeed.



Is there a way to delete only the older derivations?









share|improve this question











share|improve this question




share|improve this question










asked Mar 24 at 11:53









aij

1062




1062







  • 3




    How about cleaning before starting the update?
    – MariusMatutiae
    Mar 24 at 12:09










  • @MariusMatutiae Deleting old generations (particularly the last one booted from) is a little risky, and of course still doesn't guarantee that enough space will be freed to avoid downloading repeatedly. Sometimes you have to GC, do a partial update, GC again, and then finally finish the update. It can be pretty annoying without a way to tell whether enough space is available.
    – aij
    Mar 26 at 14:44












  • 3




    How about cleaning before starting the update?
    – MariusMatutiae
    Mar 24 at 12:09










  • @MariusMatutiae Deleting old generations (particularly the last one booted from) is a little risky, and of course still doesn't guarantee that enough space will be freed to avoid downloading repeatedly. Sometimes you have to GC, do a partial update, GC again, and then finally finish the update. It can be pretty annoying without a way to tell whether enough space is available.
    – aij
    Mar 26 at 14:44







3




3




How about cleaning before starting the update?
– MariusMatutiae
Mar 24 at 12:09




How about cleaning before starting the update?
– MariusMatutiae
Mar 24 at 12:09












@MariusMatutiae Deleting old generations (particularly the last one booted from) is a little risky, and of course still doesn't guarantee that enough space will be freed to avoid downloading repeatedly. Sometimes you have to GC, do a partial update, GC again, and then finally finish the update. It can be pretty annoying without a way to tell whether enough space is available.
– aij
Mar 26 at 14:44




@MariusMatutiae Deleting old generations (particularly the last one booted from) is a little risky, and of course still doesn't guarantee that enough space will be freed to avoid downloading repeatedly. Sometimes you have to GC, do a partial update, GC again, and then finally finish the update. It can be pretty annoying without a way to tell whether enough space is available.
– aij
Mar 26 at 14:44










1 Answer
1






active

oldest

votes

















up vote
0
down vote













I think you have 2 possible solutions here. Firstly rather than delete all old generations you can instead specify those for deletion. See the manual entry for the nix-env --delete-generations operation. Secondly the nix-store --optimise operation (ref) may be useful for you also.






share|improve this answer




















    Your Answer







    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "106"
    ;
    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',
    convertImagesToLinks: false,
    noModals: false,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );








     

    draft saved


    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f433255%2fnixos-no-space-left-on-nix-store-during-nixos-rebuild-or-nixops-deploy%23new-answer', 'question_page');

    );

    Post as a guest






























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    0
    down vote













    I think you have 2 possible solutions here. Firstly rather than delete all old generations you can instead specify those for deletion. See the manual entry for the nix-env --delete-generations operation. Secondly the nix-store --optimise operation (ref) may be useful for you also.






    share|improve this answer
























      up vote
      0
      down vote













      I think you have 2 possible solutions here. Firstly rather than delete all old generations you can instead specify those for deletion. See the manual entry for the nix-env --delete-generations operation. Secondly the nix-store --optimise operation (ref) may be useful for you also.






      share|improve this answer






















        up vote
        0
        down vote










        up vote
        0
        down vote









        I think you have 2 possible solutions here. Firstly rather than delete all old generations you can instead specify those for deletion. See the manual entry for the nix-env --delete-generations operation. Secondly the nix-store --optimise operation (ref) may be useful for you also.






        share|improve this answer












        I think you have 2 possible solutions here. Firstly rather than delete all old generations you can instead specify those for deletion. See the manual entry for the nix-env --delete-generations operation. Secondly the nix-store --optimise operation (ref) may be useful for you also.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 27 at 12:04









        brocking

        1484




        1484






















             

            draft saved


            draft discarded


























             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f433255%2fnixos-no-space-left-on-nix-store-during-nixos-rebuild-or-nixops-deploy%23new-answer', 'question_page');

            );

            Post as a guest













































































            Popular posts from this blog

            How to check contact read email or not when send email to Individual?

            Displaying single band from multi-band raster using QGIS

            How many registers does an x86_64 CPU actually have?