rm -rf does not work: 'Device or resource busy'











up vote
1
down vote

favorite












I'm using OpenVZ to create containers and it creates a folder for each container to store its files. I stopped the creation of a container before it gets completed, so it created a folder for that container, but when I try to remove that folder using rm -rf, I get the 'Device or resource busy' error, but when I do 'lsof <container folder>' or 'fuser <container folder>', it returns nothing, even when I do umount <container folder> nothing happens. So I'm not sure which process or device is using it. How can I remove this folder?










share|improve this question
























  • Add sudo and see if it removes it!
    – George Udosen
    Sep 24 at 12:41










  • Please replace TheFilename with the folder name (keep the surrounding quotes) in env DIR="TheFilename" fgrep "$( df --output=source "$DIR" | tail -1 )" /etc/mtab, run that in a terminal, and edit your question to include the output.
    – Chai T. Rex
    Sep 24 at 12:49

















up vote
1
down vote

favorite












I'm using OpenVZ to create containers and it creates a folder for each container to store its files. I stopped the creation of a container before it gets completed, so it created a folder for that container, but when I try to remove that folder using rm -rf, I get the 'Device or resource busy' error, but when I do 'lsof <container folder>' or 'fuser <container folder>', it returns nothing, even when I do umount <container folder> nothing happens. So I'm not sure which process or device is using it. How can I remove this folder?










share|improve this question
























  • Add sudo and see if it removes it!
    – George Udosen
    Sep 24 at 12:41










  • Please replace TheFilename with the folder name (keep the surrounding quotes) in env DIR="TheFilename" fgrep "$( df --output=source "$DIR" | tail -1 )" /etc/mtab, run that in a terminal, and edit your question to include the output.
    – Chai T. Rex
    Sep 24 at 12:49















up vote
1
down vote

favorite









up vote
1
down vote

favorite











I'm using OpenVZ to create containers and it creates a folder for each container to store its files. I stopped the creation of a container before it gets completed, so it created a folder for that container, but when I try to remove that folder using rm -rf, I get the 'Device or resource busy' error, but when I do 'lsof <container folder>' or 'fuser <container folder>', it returns nothing, even when I do umount <container folder> nothing happens. So I'm not sure which process or device is using it. How can I remove this folder?










share|improve this question















I'm using OpenVZ to create containers and it creates a folder for each container to store its files. I stopped the creation of a container before it gets completed, so it created a folder for that container, but when I try to remove that folder using rm -rf, I get the 'Device or resource busy' error, but when I do 'lsof <container folder>' or 'fuser <container folder>', it returns nothing, even when I do umount <container folder> nothing happens. So I'm not sure which process or device is using it. How can I remove this folder?







rm container openvz






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Sep 24 at 12:39









muclux

2,2181524




2,2181524










asked Sep 24 at 12:23









Alex

1417




1417












  • Add sudo and see if it removes it!
    – George Udosen
    Sep 24 at 12:41










  • Please replace TheFilename with the folder name (keep the surrounding quotes) in env DIR="TheFilename" fgrep "$( df --output=source "$DIR" | tail -1 )" /etc/mtab, run that in a terminal, and edit your question to include the output.
    – Chai T. Rex
    Sep 24 at 12:49




















  • Add sudo and see if it removes it!
    – George Udosen
    Sep 24 at 12:41










  • Please replace TheFilename with the folder name (keep the surrounding quotes) in env DIR="TheFilename" fgrep "$( df --output=source "$DIR" | tail -1 )" /etc/mtab, run that in a terminal, and edit your question to include the output.
    – Chai T. Rex
    Sep 24 at 12:49


















Add sudo and see if it removes it!
– George Udosen
Sep 24 at 12:41




Add sudo and see if it removes it!
– George Udosen
Sep 24 at 12:41












Please replace TheFilename with the folder name (keep the surrounding quotes) in env DIR="TheFilename" fgrep "$( df --output=source "$DIR" | tail -1 )" /etc/mtab, run that in a terminal, and edit your question to include the output.
– Chai T. Rex
Sep 24 at 12:49






Please replace TheFilename with the folder name (keep the surrounding quotes) in env DIR="TheFilename" fgrep "$( df --output=source "$DIR" | tail -1 )" /etc/mtab, run that in a terminal, and edit your question to include the output.
– Chai T. Rex
Sep 24 at 12:49












2 Answers
2






active

oldest

votes

















up vote
1
down vote













I did several umount commands and it worked well for me. For some reason, the folder has been mounted several times by openvz, so I had to umount it several times to be able to remove it.






share|improve this answer





















  • where do you mean to put the comment?
    – Alex
    Sep 24 at 16:19










  • Sorry, my fault. You can also mark this post as answer.
    – abu_bua
    Sep 24 at 16:21




















up vote
0
down vote













$ umount /directory/

=> umount(/directory/): Resource busy -- try 'diskutil unmount'


So I tried with



diskutil unmount /directory/


and it works for me.






share|improve this answer










New contributor




Steve Tuo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.


















    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',
    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%2f1077999%2frm-rf-does-not-work-device-or-resource-busy%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    1
    down vote













    I did several umount commands and it worked well for me. For some reason, the folder has been mounted several times by openvz, so I had to umount it several times to be able to remove it.






    share|improve this answer





















    • where do you mean to put the comment?
      – Alex
      Sep 24 at 16:19










    • Sorry, my fault. You can also mark this post as answer.
      – abu_bua
      Sep 24 at 16:21

















    up vote
    1
    down vote













    I did several umount commands and it worked well for me. For some reason, the folder has been mounted several times by openvz, so I had to umount it several times to be able to remove it.






    share|improve this answer





















    • where do you mean to put the comment?
      – Alex
      Sep 24 at 16:19










    • Sorry, my fault. You can also mark this post as answer.
      – abu_bua
      Sep 24 at 16:21















    up vote
    1
    down vote










    up vote
    1
    down vote









    I did several umount commands and it worked well for me. For some reason, the folder has been mounted several times by openvz, so I had to umount it several times to be able to remove it.






    share|improve this answer












    I did several umount commands and it worked well for me. For some reason, the folder has been mounted several times by openvz, so I had to umount it several times to be able to remove it.







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Sep 24 at 15:28









    Alex

    1417




    1417












    • where do you mean to put the comment?
      – Alex
      Sep 24 at 16:19










    • Sorry, my fault. You can also mark this post as answer.
      – abu_bua
      Sep 24 at 16:21




















    • where do you mean to put the comment?
      – Alex
      Sep 24 at 16:19










    • Sorry, my fault. You can also mark this post as answer.
      – abu_bua
      Sep 24 at 16:21


















    where do you mean to put the comment?
    – Alex
    Sep 24 at 16:19




    where do you mean to put the comment?
    – Alex
    Sep 24 at 16:19












    Sorry, my fault. You can also mark this post as answer.
    – abu_bua
    Sep 24 at 16:21






    Sorry, my fault. You can also mark this post as answer.
    – abu_bua
    Sep 24 at 16:21














    up vote
    0
    down vote













    $ umount /directory/

    => umount(/directory/): Resource busy -- try 'diskutil unmount'


    So I tried with



    diskutil unmount /directory/


    and it works for me.






    share|improve this answer










    New contributor




    Steve Tuo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.






















      up vote
      0
      down vote













      $ umount /directory/

      => umount(/directory/): Resource busy -- try 'diskutil unmount'


      So I tried with



      diskutil unmount /directory/


      and it works for me.






      share|improve this answer










      New contributor




      Steve Tuo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.




















        up vote
        0
        down vote










        up vote
        0
        down vote









        $ umount /directory/

        => umount(/directory/): Resource busy -- try 'diskutil unmount'


        So I tried with



        diskutil unmount /directory/


        and it works for me.






        share|improve this answer










        New contributor




        Steve Tuo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.









        $ umount /directory/

        => umount(/directory/): Resource busy -- try 'diskutil unmount'


        So I tried with



        diskutil unmount /directory/


        and it works for me.







        share|improve this answer










        New contributor




        Steve Tuo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.









        share|improve this answer



        share|improve this answer








        edited Nov 22 at 16:51









        abu_bua

        3,05381023




        3,05381023






        New contributor




        Steve Tuo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.









        answered Nov 22 at 16:37









        Steve Tuo

        1




        1




        New contributor




        Steve Tuo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.





        New contributor





        Steve Tuo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.






        Steve Tuo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.






























             

            draft saved


            draft discarded



















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1077999%2frm-rf-does-not-work-device-or-resource-busy%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

            flock() on closed filehandle LOCK_FILE at /usr/bin/apt-mirror

            Mangá

             ⁒  ․,‪⁊‑⁙ ⁖, ⁇‒※‌, †,⁖‗‌⁝    ‾‸⁘,‖⁔⁣,⁂‾
”‑,‥–,‬ ,⁀‹⁋‴⁑ ‒ ,‴⁋”‼ ⁨,‷⁔„ ‰′,‐‚ ‥‡‎“‷⁃⁨⁅⁣,⁔
⁇‘⁔⁡⁏⁌⁡‿‶‏⁨ ⁣⁕⁖⁨⁩⁥‽⁀  ‴‬⁜‟ ⁃‣‧⁕‮ …‍⁨‴ ⁩,⁚⁖‫ ,‵ ⁀,‮⁝‣‣ ⁑  ⁂– ․, ‾‽ ‏⁁“⁗‸ ‾… ‹‡⁌⁎‸‘ ‡⁏⁌‪ ‵⁛ ‎⁨ ―⁦⁤⁄⁕