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

            Mobil Contents History Mobil brands Former Mobil brands Lukoil transaction Mobil UK Mobil Australia Mobil New Zealand Mobil Greece Mobil in Japan Mobil in Canada Mobil Egypt See also References External links Navigation menuwww.mobil.com"Mobil Corporation"the original"Our Houston campus""Business & Finance: Socony-Vacuum Corp.""Popular Mechanics""Lubrite Technologies""Exxon Mobil campus 'clearly happening'""Toledo Blade - Google News Archive Search""The Lion and the Moose - How 2 Executives Pulled off the Biggest Merger Ever""ExxonMobil Press Release""Lubricants""Archived copy"the original"Mobil 1™ and Mobil Super™ motor oil and synthetic motor oil - Mobil™ Motor Oils""Mobil Delvac""Mobil Industrial website""The State of Competition in Gasoline Marketing: The Effects of Refiner Operations at Retail""Mobil Travel Guide to become Forbes Travel Guide""Hotel Rankings: Forbes Merges with Mobil"the original"Jamieson oil industry history""Mobil news""Caltex pumps for control""Watchdog blocks Caltex bid""Exxon Mobil sells service station network""Mobil Oil New Zealand Limited is New Zealand's oldest oil company, with predecessor companies having first established a presence in the country in 1896""ExxonMobil subsidiaries have a business history in New Zealand stretching back more than 120 years. We are involved in petroleum refining and distribution and the marketing of fuels, lubricants and chemical products""Archived copy"the original"Exxon Mobil to Sell Its Japanese Arm for $3.9 Billion""Gas station merger will end Esso and Mobil's long run in Japan""Esso moves to affiliate itself with PC Optimum, no longer Aeroplan, in loyalty point switch""Mobil brand of gas stations to launch in Canada after deal for 213 Loblaws-owned locations""Mobil Nears Completion of Rebranding 200 Loblaw Gas Stations""Learn about ExxonMobil's operations in Egypt""Petrol and Diesel Service Stations in Egypt - Mobil"Official websiteExxon Mobil corporate websiteMobil Industrial official websiteeeeeeeeDA04275022275790-40000 0001 0860 5061n82045453134887257134887257

            My Life (Mary J. Blige album) Contents Background Critical reception Accolades Commercial performance Track listing Personnel Charts Certifications See also References External links Navigation menu"1. Mary J Blige, My Life - The 50 Best R&B albums of the '90s""American album certifications – Mary J. Blige – My Life""Mary J. Blige's My Life LP (1994) revisited with co-producer Chucky Thompson | Return To The Classics"the original"Key Tracks: Mary J. Blige's My Life""My Life – Mary J. Blige""Worth The Wait""My Life""Forget '411,' Mary J., Better Call 911""Spins"My Life AccoladesThe 500 Greatest Albums of All TimeTime's All-TIME 100 Albums"Top RPM Albums: Issue chartid""Dutchcharts.nl – Mary J. Blige – My Life""Mary J. Blige | Artist | Official Charts""Mary J. Blige Chart History (Billboard 200)""Mary J. Blige Chart History (Top R&B/Hip-Hop Albums)""Canadian album certifications – Mary J Blige – My Life""British album certifications – Mary J Blige – My Life""American album certifications – Mary J Blige – My Life"My LifeMy Life accoladesee

            Frič See also Navigation menuinternal link