Sudo rm -rf does not remove a non-empty folder Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) 2019 Community Moderator Election Results Why I closed the “Why is Kali so hard” questionLogin fails from Windows on NTFS-3G Samba ShareHow to delete a NTFS filesystem file whose name contains “:”?rm -rf: cannot remove `/opt/jetty': Directory not emptyWhere is the information about the file system format stored in External Hard DisksIs it possible to mount ~/.ipfs folder to an external drive?Cannot remove directory, operation not supported on NTFSUndeletable folders with random name keeps appearing in secondary driveWrong fs type, bad option, bad superblock on /dev/sdXHow to access external hard drive from Ubuntu Shell and Python codeWindows removed files copied from Linux and ext4 filesystem

Bonus calculation: Am I making a mountain out of a molehill?

What is the longest distance a 13th-level monk can jump while attacking on the same turn?

Should I discuss the type of campaign with my players?

Doubts about chords

What happens to sewage if there is no river near by?

Is the Standard Deduction better than Itemized when both are the same amount?

Stars Make Stars

Models of set theory where not every set can be linearly ordered

Check which numbers satisfy the condition [A*B*C = A! + B! + C!]

What is this single-engine low-wing propeller plane?

Is there a Spanish version of "dot your i's and cross your t's" that includes the letter 'ñ'?

Does accepting a pardon have any bearing on trying that person for the same crime in a sovereign jurisdiction?

How does a Death Domain cleric's Touch of Death feature work with Touch-range spells delivered by familiars?

Is it true that "carbohydrates are of no use for the basal metabolic need"?

Is 1 ppb equal to 1 μg/kg?

Did Kevin spill real chili?

How can players work together to take actions that are otherwise impossible?

Did Xerox really develop the first LAN?

How much radiation do nuclear physics experiments expose researchers to nowadays?

Why is black pepper both grey and black?

Is there a "higher Segal conjecture"?

Right-skewed distribution with mean equals to mode?

What do you call a phrase that's not an idiom yet?

Is the address of a local variable a constexpr?



Sudo rm -rf does not remove a non-empty folder



Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)
2019 Community Moderator Election Results
Why I closed the “Why is Kali so hard” questionLogin fails from Windows on NTFS-3G Samba ShareHow to delete a NTFS filesystem file whose name contains “:”?rm -rf: cannot remove `/opt/jetty': Directory not emptyWhere is the information about the file system format stored in External Hard DisksIs it possible to mount ~/.ipfs folder to an external drive?Cannot remove directory, operation not supported on NTFSUndeletable folders with random name keeps appearing in secondary driveWrong fs type, bad option, bad superblock on /dev/sdXHow to access external hard drive from Ubuntu Shell and Python codeWindows removed files copied from Linux and ext4 filesystem



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








1















I have a mounted an external hard disk on /media/pcmagas/Backup disk containing a folder dimitrios. When I try to remove it with the following comand:



/media/pcmagas/Backup disk
sudo rm -rf ./dimitrios


I get this error:



rm: cannot remove './dimitrios/Kwdikas/Javascript/data_map/node_modules/random-bytes': Directory not empty


The mounted disk is ntfs, and I have mounted it into an Ubuntu GNU/Linux system.



When I run ls -l ./dimitrios/Kwdikas/Javascript/data_map/node_modules/random-bytes I get the following error:



ls: reading directory './dimitrios/Kwdikas/Javascript/data_map/node_modules/random-bytes': Input/output error









share|improve this question



















  • 2





    This could indicate filesystem corruption or a hardware issue. What does dmesg output after getting the I/O error?

    – Torin
    11 hours ago











  • Well I reformated the disk after backed up the wanted data.

    – Dimitrios Desyllas
    10 hours ago











  • You may want to run badblocks on the device since it's possible the disk might have bad sectors

    – Torin
    10 hours ago







  • 1





    Two questions — (a) which filesystem does “Backup disk” use? (b) are there any error messages from the kernel in dmesg, /var/log/kern.log, the systemd journal, etc.?

    – derobert
    10 hours ago







  • 1





    @DimitriosDesyllas I'd guess you've hit a bug in the NTFS drivers for Linux. If this disk is just for backup from Linux, I'd strongly suggest using ext4, XFS, btrfs, etc. instead of NTFS. If you hadn't reformatted the disk, the next step would have been an fsck. Possibly from a Windows machine.

    – derobert
    10 hours ago


















1















I have a mounted an external hard disk on /media/pcmagas/Backup disk containing a folder dimitrios. When I try to remove it with the following comand:



/media/pcmagas/Backup disk
sudo rm -rf ./dimitrios


I get this error:



rm: cannot remove './dimitrios/Kwdikas/Javascript/data_map/node_modules/random-bytes': Directory not empty


The mounted disk is ntfs, and I have mounted it into an Ubuntu GNU/Linux system.



When I run ls -l ./dimitrios/Kwdikas/Javascript/data_map/node_modules/random-bytes I get the following error:



ls: reading directory './dimitrios/Kwdikas/Javascript/data_map/node_modules/random-bytes': Input/output error









share|improve this question



















  • 2





    This could indicate filesystem corruption or a hardware issue. What does dmesg output after getting the I/O error?

    – Torin
    11 hours ago











  • Well I reformated the disk after backed up the wanted data.

    – Dimitrios Desyllas
    10 hours ago











  • You may want to run badblocks on the device since it's possible the disk might have bad sectors

    – Torin
    10 hours ago







  • 1





    Two questions — (a) which filesystem does “Backup disk” use? (b) are there any error messages from the kernel in dmesg, /var/log/kern.log, the systemd journal, etc.?

    – derobert
    10 hours ago







  • 1





    @DimitriosDesyllas I'd guess you've hit a bug in the NTFS drivers for Linux. If this disk is just for backup from Linux, I'd strongly suggest using ext4, XFS, btrfs, etc. instead of NTFS. If you hadn't reformatted the disk, the next step would have been an fsck. Possibly from a Windows machine.

    – derobert
    10 hours ago














1












1








1








I have a mounted an external hard disk on /media/pcmagas/Backup disk containing a folder dimitrios. When I try to remove it with the following comand:



/media/pcmagas/Backup disk
sudo rm -rf ./dimitrios


I get this error:



rm: cannot remove './dimitrios/Kwdikas/Javascript/data_map/node_modules/random-bytes': Directory not empty


The mounted disk is ntfs, and I have mounted it into an Ubuntu GNU/Linux system.



When I run ls -l ./dimitrios/Kwdikas/Javascript/data_map/node_modules/random-bytes I get the following error:



ls: reading directory './dimitrios/Kwdikas/Javascript/data_map/node_modules/random-bytes': Input/output error









share|improve this question
















I have a mounted an external hard disk on /media/pcmagas/Backup disk containing a folder dimitrios. When I try to remove it with the following comand:



/media/pcmagas/Backup disk
sudo rm -rf ./dimitrios


I get this error:



rm: cannot remove './dimitrios/Kwdikas/Javascript/data_map/node_modules/random-bytes': Directory not empty


The mounted disk is ntfs, and I have mounted it into an Ubuntu GNU/Linux system.



When I run ls -l ./dimitrios/Kwdikas/Javascript/data_map/node_modules/random-bytes I get the following error:



ls: reading directory './dimitrios/Kwdikas/Javascript/data_map/node_modules/random-bytes': Input/output error






ubuntu mount rm ntfs






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 8 hours ago









0xSheepdog

1,74011025




1,74011025










asked 11 hours ago









Dimitrios DesyllasDimitrios Desyllas

223317




223317







  • 2





    This could indicate filesystem corruption or a hardware issue. What does dmesg output after getting the I/O error?

    – Torin
    11 hours ago











  • Well I reformated the disk after backed up the wanted data.

    – Dimitrios Desyllas
    10 hours ago











  • You may want to run badblocks on the device since it's possible the disk might have bad sectors

    – Torin
    10 hours ago







  • 1





    Two questions — (a) which filesystem does “Backup disk” use? (b) are there any error messages from the kernel in dmesg, /var/log/kern.log, the systemd journal, etc.?

    – derobert
    10 hours ago







  • 1





    @DimitriosDesyllas I'd guess you've hit a bug in the NTFS drivers for Linux. If this disk is just for backup from Linux, I'd strongly suggest using ext4, XFS, btrfs, etc. instead of NTFS. If you hadn't reformatted the disk, the next step would have been an fsck. Possibly from a Windows machine.

    – derobert
    10 hours ago













  • 2





    This could indicate filesystem corruption or a hardware issue. What does dmesg output after getting the I/O error?

    – Torin
    11 hours ago











  • Well I reformated the disk after backed up the wanted data.

    – Dimitrios Desyllas
    10 hours ago











  • You may want to run badblocks on the device since it's possible the disk might have bad sectors

    – Torin
    10 hours ago







  • 1





    Two questions — (a) which filesystem does “Backup disk” use? (b) are there any error messages from the kernel in dmesg, /var/log/kern.log, the systemd journal, etc.?

    – derobert
    10 hours ago







  • 1





    @DimitriosDesyllas I'd guess you've hit a bug in the NTFS drivers for Linux. If this disk is just for backup from Linux, I'd strongly suggest using ext4, XFS, btrfs, etc. instead of NTFS. If you hadn't reformatted the disk, the next step would have been an fsck. Possibly from a Windows machine.

    – derobert
    10 hours ago








2




2





This could indicate filesystem corruption or a hardware issue. What does dmesg output after getting the I/O error?

– Torin
11 hours ago





This could indicate filesystem corruption or a hardware issue. What does dmesg output after getting the I/O error?

– Torin
11 hours ago













Well I reformated the disk after backed up the wanted data.

– Dimitrios Desyllas
10 hours ago





Well I reformated the disk after backed up the wanted data.

– Dimitrios Desyllas
10 hours ago













You may want to run badblocks on the device since it's possible the disk might have bad sectors

– Torin
10 hours ago






You may want to run badblocks on the device since it's possible the disk might have bad sectors

– Torin
10 hours ago





1




1





Two questions — (a) which filesystem does “Backup disk” use? (b) are there any error messages from the kernel in dmesg, /var/log/kern.log, the systemd journal, etc.?

– derobert
10 hours ago






Two questions — (a) which filesystem does “Backup disk” use? (b) are there any error messages from the kernel in dmesg, /var/log/kern.log, the systemd journal, etc.?

– derobert
10 hours ago





1




1





@DimitriosDesyllas I'd guess you've hit a bug in the NTFS drivers for Linux. If this disk is just for backup from Linux, I'd strongly suggest using ext4, XFS, btrfs, etc. instead of NTFS. If you hadn't reformatted the disk, the next step would have been an fsck. Possibly from a Windows machine.

– derobert
10 hours ago






@DimitriosDesyllas I'd guess you've hit a bug in the NTFS drivers for Linux. If this disk is just for backup from Linux, I'd strongly suggest using ext4, XFS, btrfs, etc. instead of NTFS. If you hadn't reformatted the disk, the next step would have been an fsck. Possibly from a Windows machine.

– derobert
10 hours ago











2 Answers
2






active

oldest

votes


















1














In order to solve the problem you should do:




  1. rsync any folder that you want to keep in the hard disk back to your computer's hard disk.

  2. Then format it, you can use the gparted gui program to do so if you have an XOrg installed GNU/Linux system.

  3. Move back the folders you kept.

I know its a bit hacky but for desktop use did the job in my case.






share|improve this answer
































    -2














    'rm' command is used to remove files only and directories that are not empty



    use 'rmdir' to remove directories to remove dir's which are empty






    share|improve this answer


















    • 2





      The -r flag on rm removes empty directories too

      – Torin
      10 hours ago







    • 1





      The OP correctly used the rm command to remove non-empty directories. Your answer is incorrect.

      – 0xSheepdog
      9 hours ago











    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%2f512618%2fsudo-rm-rf-does-not-remove-a-non-empty-folder%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









    1














    In order to solve the problem you should do:




    1. rsync any folder that you want to keep in the hard disk back to your computer's hard disk.

    2. Then format it, you can use the gparted gui program to do so if you have an XOrg installed GNU/Linux system.

    3. Move back the folders you kept.

    I know its a bit hacky but for desktop use did the job in my case.






    share|improve this answer





























      1














      In order to solve the problem you should do:




      1. rsync any folder that you want to keep in the hard disk back to your computer's hard disk.

      2. Then format it, you can use the gparted gui program to do so if you have an XOrg installed GNU/Linux system.

      3. Move back the folders you kept.

      I know its a bit hacky but for desktop use did the job in my case.






      share|improve this answer



























        1












        1








        1







        In order to solve the problem you should do:




        1. rsync any folder that you want to keep in the hard disk back to your computer's hard disk.

        2. Then format it, you can use the gparted gui program to do so if you have an XOrg installed GNU/Linux system.

        3. Move back the folders you kept.

        I know its a bit hacky but for desktop use did the job in my case.






        share|improve this answer















        In order to solve the problem you should do:




        1. rsync any folder that you want to keep in the hard disk back to your computer's hard disk.

        2. Then format it, you can use the gparted gui program to do so if you have an XOrg installed GNU/Linux system.

        3. Move back the folders you kept.

        I know its a bit hacky but for desktop use did the job in my case.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited 3 hours ago

























        answered 10 hours ago









        Dimitrios DesyllasDimitrios Desyllas

        223317




        223317























            -2














            'rm' command is used to remove files only and directories that are not empty



            use 'rmdir' to remove directories to remove dir's which are empty






            share|improve this answer


















            • 2





              The -r flag on rm removes empty directories too

              – Torin
              10 hours ago







            • 1





              The OP correctly used the rm command to remove non-empty directories. Your answer is incorrect.

              – 0xSheepdog
              9 hours ago















            -2














            'rm' command is used to remove files only and directories that are not empty



            use 'rmdir' to remove directories to remove dir's which are empty






            share|improve this answer


















            • 2





              The -r flag on rm removes empty directories too

              – Torin
              10 hours ago







            • 1





              The OP correctly used the rm command to remove non-empty directories. Your answer is incorrect.

              – 0xSheepdog
              9 hours ago













            -2












            -2








            -2







            'rm' command is used to remove files only and directories that are not empty



            use 'rmdir' to remove directories to remove dir's which are empty






            share|improve this answer













            'rm' command is used to remove files only and directories that are not empty



            use 'rmdir' to remove directories to remove dir's which are empty







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered 10 hours ago









            QasimQasim

            3013




            3013







            • 2





              The -r flag on rm removes empty directories too

              – Torin
              10 hours ago







            • 1





              The OP correctly used the rm command to remove non-empty directories. Your answer is incorrect.

              – 0xSheepdog
              9 hours ago












            • 2





              The -r flag on rm removes empty directories too

              – Torin
              10 hours ago







            • 1





              The OP correctly used the rm command to remove non-empty directories. Your answer is incorrect.

              – 0xSheepdog
              9 hours ago







            2




            2





            The -r flag on rm removes empty directories too

            – Torin
            10 hours ago






            The -r flag on rm removes empty directories too

            – Torin
            10 hours ago





            1




            1





            The OP correctly used the rm command to remove non-empty directories. Your answer is incorrect.

            – 0xSheepdog
            9 hours ago





            The OP correctly used the rm command to remove non-empty directories. Your answer is incorrect.

            – 0xSheepdog
            9 hours ago

















            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.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f512618%2fsudo-rm-rf-does-not-remove-a-non-empty-folder%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







            -mount, ntfs, rm, ubuntu

            Popular posts from this blog

            Frič See also Navigation menuinternal link

            Identify plant with long narrow paired leaves and reddish stems Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?What is this plant with long sharp leaves? Is it a weed?What is this 3ft high, stalky plant, with mid sized narrow leaves?What is this young shrub with opposite ovate, crenate leaves and reddish stems?What is this plant with large broad serrated leaves?Identify this upright branching weed with long leaves and reddish stemsPlease help me identify this bulbous plant with long, broad leaves and white flowersWhat is this small annual with narrow gray/green leaves and rust colored daisy-type flowers?What is this chilli plant?Does anyone know what type of chilli plant this is?Help identify this plant

            fontconfig warning: “/etc/fonts/fonts.conf”, line 100: unknown “element blank” The 2019 Stack Overflow Developer Survey Results Are In“tar: unrecognized option --warning” during 'apt-get install'How to fix Fontconfig errorHow do I figure out which font file is chosen for a system generic font alias?Why are some apt-get-installed fonts being ignored by fc-list, xfontsel, etc?Reload settings in /etc/fonts/conf.dTaking 30 seconds longer to boot after upgrade from jessie to stretchHow to match multiple font names with a single <match> element?Adding a custom font to fontconfigRemoving fonts from fontconfig <match> resultsBroken fonts after upgrading Firefox ESR to latest Firefox