Linux - Directory with zero link count (Rancher container)












1














I have a permission error in a Rancher container's shell when accessing certain directory, but the permissions are correctly set. Then I noticed that the link count for said directory is zero, as shown:
enter image description here



But for any directory, the minimum amount of links is 2, self . and parent ... So why would it show a 0 here? I don't get it. Right now I don't have access to this shell to check which inode it's pointing to (ls -i), but I guess it would be empty (I don't really know, TBH).



I'll try removing and then mkdiring it again to see if that solves it, but I'd really like to understand why this is happening.



Thanks!!



PS: I don't know if it being a Rancher container affects in any way.










share|improve this question






















  • "For any directory, the minimum amount of links is 2" This isn't universally true. Some filesystems neither include nor count . or .. links (I believe btrfs is one such filesystem). So, what was the command, and what was the error?
    – Fox
    Mar 1 at 22:07






  • 1




    @Fox In this case it applies. On a fresh container, this very same image has the two hard links for that folder. Tried removing it with rm -rf /backup but didn't work. It says that "the resource is busy".
    – Christian Rodriguez
    Mar 2 at 14:53
















1














I have a permission error in a Rancher container's shell when accessing certain directory, but the permissions are correctly set. Then I noticed that the link count for said directory is zero, as shown:
enter image description here



But for any directory, the minimum amount of links is 2, self . and parent ... So why would it show a 0 here? I don't get it. Right now I don't have access to this shell to check which inode it's pointing to (ls -i), but I guess it would be empty (I don't really know, TBH).



I'll try removing and then mkdiring it again to see if that solves it, but I'd really like to understand why this is happening.



Thanks!!



PS: I don't know if it being a Rancher container affects in any way.










share|improve this question






















  • "For any directory, the minimum amount of links is 2" This isn't universally true. Some filesystems neither include nor count . or .. links (I believe btrfs is one such filesystem). So, what was the command, and what was the error?
    – Fox
    Mar 1 at 22:07






  • 1




    @Fox In this case it applies. On a fresh container, this very same image has the two hard links for that folder. Tried removing it with rm -rf /backup but didn't work. It says that "the resource is busy".
    – Christian Rodriguez
    Mar 2 at 14:53














1












1








1







I have a permission error in a Rancher container's shell when accessing certain directory, but the permissions are correctly set. Then I noticed that the link count for said directory is zero, as shown:
enter image description here



But for any directory, the minimum amount of links is 2, self . and parent ... So why would it show a 0 here? I don't get it. Right now I don't have access to this shell to check which inode it's pointing to (ls -i), but I guess it would be empty (I don't really know, TBH).



I'll try removing and then mkdiring it again to see if that solves it, but I'd really like to understand why this is happening.



Thanks!!



PS: I don't know if it being a Rancher container affects in any way.










share|improve this question













I have a permission error in a Rancher container's shell when accessing certain directory, but the permissions are correctly set. Then I noticed that the link count for said directory is zero, as shown:
enter image description here



But for any directory, the minimum amount of links is 2, self . and parent ... So why would it show a 0 here? I don't get it. Right now I don't have access to this shell to check which inode it's pointing to (ls -i), but I guess it would be empty (I don't really know, TBH).



I'll try removing and then mkdiring it again to see if that solves it, but I'd really like to understand why this is happening.



Thanks!!



PS: I don't know if it being a Rancher container affects in any way.







filesystems hard-link






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 1 at 20:38









Christian Rodriguez

1061




1061












  • "For any directory, the minimum amount of links is 2" This isn't universally true. Some filesystems neither include nor count . or .. links (I believe btrfs is one such filesystem). So, what was the command, and what was the error?
    – Fox
    Mar 1 at 22:07






  • 1




    @Fox In this case it applies. On a fresh container, this very same image has the two hard links for that folder. Tried removing it with rm -rf /backup but didn't work. It says that "the resource is busy".
    – Christian Rodriguez
    Mar 2 at 14:53


















  • "For any directory, the minimum amount of links is 2" This isn't universally true. Some filesystems neither include nor count . or .. links (I believe btrfs is one such filesystem). So, what was the command, and what was the error?
    – Fox
    Mar 1 at 22:07






  • 1




    @Fox In this case it applies. On a fresh container, this very same image has the two hard links for that folder. Tried removing it with rm -rf /backup but didn't work. It says that "the resource is busy".
    – Christian Rodriguez
    Mar 2 at 14:53
















"For any directory, the minimum amount of links is 2" This isn't universally true. Some filesystems neither include nor count . or .. links (I believe btrfs is one such filesystem). So, what was the command, and what was the error?
– Fox
Mar 1 at 22:07




"For any directory, the minimum amount of links is 2" This isn't universally true. Some filesystems neither include nor count . or .. links (I believe btrfs is one such filesystem). So, what was the command, and what was the error?
– Fox
Mar 1 at 22:07




1




1




@Fox In this case it applies. On a fresh container, this very same image has the two hard links for that folder. Tried removing it with rm -rf /backup but didn't work. It says that "the resource is busy".
– Christian Rodriguez
Mar 2 at 14:53




@Fox In this case it applies. On a fresh container, this very same image has the two hard links for that folder. Tried removing it with rm -rf /backup but didn't work. It says that "the resource is busy".
– Christian Rodriguez
Mar 2 at 14:53










1 Answer
1






active

oldest

votes


















0














POSIX requires the link count to be at least 2, and in general, 2 + the number of subdirs, as long as the directory isn't rmdir'd. If the directory is deleted, then the link count is generally 0.



Not all filesystems are POSIX, however. While generally filesystems usable as root filesystem on UNIX generally are, btrfs is the lone exception, as it works mostly fine as root fs, but is non-POSIX.



On GNU/Linux (and many, but not all other POSIX systems), when a filesystem does not follow POSIX semantics, it usually uses a link count of 1, which does not occur during normal operations (0, 2 and higher are possible, but not 1). Utilities such as GNU find will adapt to this by special-casing directories with link count of 1 as being non-POSIX, resulting in potentially slower operation.



In your case, a link count of 1 would indi9cate that this is a non-POISIX filesystem, while a link count 0 zero smells more like a bug in the filesystem implementation, as it is not a sensible value.






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',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    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%2funix.stackexchange.com%2fquestions%2f427551%2flinux-directory-with-zero-link-count-rancher-container%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    POSIX requires the link count to be at least 2, and in general, 2 + the number of subdirs, as long as the directory isn't rmdir'd. If the directory is deleted, then the link count is generally 0.



    Not all filesystems are POSIX, however. While generally filesystems usable as root filesystem on UNIX generally are, btrfs is the lone exception, as it works mostly fine as root fs, but is non-POSIX.



    On GNU/Linux (and many, but not all other POSIX systems), when a filesystem does not follow POSIX semantics, it usually uses a link count of 1, which does not occur during normal operations (0, 2 and higher are possible, but not 1). Utilities such as GNU find will adapt to this by special-casing directories with link count of 1 as being non-POSIX, resulting in potentially slower operation.



    In your case, a link count of 1 would indi9cate that this is a non-POISIX filesystem, while a link count 0 zero smells more like a bug in the filesystem implementation, as it is not a sensible value.






    share|improve this answer


























      0














      POSIX requires the link count to be at least 2, and in general, 2 + the number of subdirs, as long as the directory isn't rmdir'd. If the directory is deleted, then the link count is generally 0.



      Not all filesystems are POSIX, however. While generally filesystems usable as root filesystem on UNIX generally are, btrfs is the lone exception, as it works mostly fine as root fs, but is non-POSIX.



      On GNU/Linux (and many, but not all other POSIX systems), when a filesystem does not follow POSIX semantics, it usually uses a link count of 1, which does not occur during normal operations (0, 2 and higher are possible, but not 1). Utilities such as GNU find will adapt to this by special-casing directories with link count of 1 as being non-POSIX, resulting in potentially slower operation.



      In your case, a link count of 1 would indi9cate that this is a non-POISIX filesystem, while a link count 0 zero smells more like a bug in the filesystem implementation, as it is not a sensible value.






      share|improve this answer
























        0












        0








        0






        POSIX requires the link count to be at least 2, and in general, 2 + the number of subdirs, as long as the directory isn't rmdir'd. If the directory is deleted, then the link count is generally 0.



        Not all filesystems are POSIX, however. While generally filesystems usable as root filesystem on UNIX generally are, btrfs is the lone exception, as it works mostly fine as root fs, but is non-POSIX.



        On GNU/Linux (and many, but not all other POSIX systems), when a filesystem does not follow POSIX semantics, it usually uses a link count of 1, which does not occur during normal operations (0, 2 and higher are possible, but not 1). Utilities such as GNU find will adapt to this by special-casing directories with link count of 1 as being non-POSIX, resulting in potentially slower operation.



        In your case, a link count of 1 would indi9cate that this is a non-POISIX filesystem, while a link count 0 zero smells more like a bug in the filesystem implementation, as it is not a sensible value.






        share|improve this answer












        POSIX requires the link count to be at least 2, and in general, 2 + the number of subdirs, as long as the directory isn't rmdir'd. If the directory is deleted, then the link count is generally 0.



        Not all filesystems are POSIX, however. While generally filesystems usable as root filesystem on UNIX generally are, btrfs is the lone exception, as it works mostly fine as root fs, but is non-POSIX.



        On GNU/Linux (and many, but not all other POSIX systems), when a filesystem does not follow POSIX semantics, it usually uses a link count of 1, which does not occur during normal operations (0, 2 and higher are possible, but not 1). Utilities such as GNU find will adapt to this by special-casing directories with link count of 1 as being non-POSIX, resulting in potentially slower operation.



        In your case, a link count of 1 would indi9cate that this is a non-POISIX filesystem, while a link count 0 zero smells more like a bug in the filesystem implementation, as it is not a sensible value.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered 40 mins ago









        Marc Lehmann

        1112




        1112






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Unix & Linux Stack Exchange!


            • 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.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • 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%2funix.stackexchange.com%2fquestions%2f427551%2flinux-directory-with-zero-link-count-rancher-container%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

            Accessing regular linux commands in Huawei's Dopra Linux

            Can't connect RFCOMM socket: Host is down

            Kernel panic - not syncing: Fatal Exception in Interrupt