Page 1 of 2 12 LastLast
Results 1 to 10 of 19

Thread: Can't delete some empty and very nested directories.

  1. #1

    Default Can't delete some empty and very nested directories.

    I can't delete some very nested and empty directories on an external Hard Disk.

    I've used the following command on the undeletable folder (this is a sample the problem is present for some more too):

    Code:
    ~> sudo rm -Rdf 20180209-194301-109/
    rm: cannot remove '20180209-194301-109/backup/home/shared/icons/la-capitaine-mymod/places/16x16': Directory not empty
    rm: cannot remove '20180209-194301-109/backup/home/shared/settings/.atom/.apm/async': Directory not empty
    rm: cannot remove '20180209-194301-109/backup/home/stefano/.config': Directory not empty
    
    Here are the details:

    - we are talking about a depth of about 15 / 20 directories, and about 150 characters;
    - the external HD is formatted with a NTFS filesystem;
    - this structure is used by a backup program (Back in time), that uses hardlinks to reference the same unmodified file across snapshots (the directory structure pertain to these backups);
    - I've checked the HD's SMART attributes, and there is nothing out of order, no errors or unusual values are reported, so I can (hopefully) rule out hardware issues.
    - I've tried to perform a chkdsk from a Windows system to try to fix possible NTFS problems, without solving anything.
    - Also, trying to delete them from Windows gives me no results.

    Any clues about this? How can I delete them?

  2. #2
    Join Date
    Aug 2010
    Location
    Chicago suburbs
    Posts
    12,624
    Blog Entries
    3

    Default Re: Can't delete some empty and very nested directories.

    Quote Originally Posted by sekhemty View Post
    we are talking about a depth of about 15 / 20 directories, and about 150 characters;
    Normally, that should not be a problem. So I'm guessing that this is an NTFS related problem.

    I'm not sure whether there are any NTFS experts around.
    openSUSE Leap 15.1; KDE Plasma 5;
    testing Leap 15.2Alpha

  3. #3

    Default Re: Can't delete some empty and very nested directories.

    In Linux go into 20180209-194301-109/backup/home/shared/icons/la-capitaine-mymod/places/16x16 and "ls -la" what's in there? What's "rm -rfv" say?

  4. #4
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    25,143

    Default Re: Can't delete some empty and very nested directories.

    Like xorbe, I would say that when the message says that /xxx/yyy/zzz/ is not empty, the logical first thing to do is to look what is there.

    BTW I get the idea that you make your regular backups to an NTFS file system. That does not look as being a good idea to me. No backup of any ownership/permissions, maybe restrictions on file names, etc. But it could of course be that you have your reasons for this and that you have thought about the implications.
    Henk van Velden

  5. #5

    Default Re: Can't delete some empty and very nested directories.

    Here it is

    Code:
    ls -la
    total 0
    drwxrwxrwx 1 sbweb users 0 Dec 24  2017 .
    drwxrwxrwx 1 sbweb users 0 Mar 10  2018 ..
    
    
    and

    Code:
    rm -rfv 16x16/
    rm: cannot remove '16x16/': Directory not empty
    
    

  6. #6
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    25,143

    Default Re: Can't delete some empty and very nested directories.

    I do believe you, but can you please always post including the prompts? Then we can see e.g. what your working directory is.
    It seems you have changed the working directory between those two statements, but we have to guess what you did. Please take into account that we can not look over your shoulder and have to rely on what you show.

    Like:
    Code:
    henk@boven:~/test/leeg> ls -la
    totaal 8
    drwxr-xr-x  2 henk wij 4096 19 okt 11:02 .
    drwxr-xr-x 24 henk wij 4096 19 okt 11:02 ..
    henk@boven:~/test/leeg>
    Henk van Velden

  7. #7
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    25,143

    Default Re: Can't delete some empty and very nested directories.

    I repeat my concern about you using a non-Linux file system as if it is a full fledged Linux file system.

    You talk about hard links. I do not even know if that is supported on an NTFS file system.

    IMHO one should only use non-Linux file systems to exchange files with non-Linux systems. Not as if it is one of the Linux file systems.
    Henk van Velden

  8. #8
    Join Date
    Jun 2008
    Location
    Auckland, NZ
    Posts
    20,381
    Blog Entries
    1

    Default Re: Can't delete some empty and very nested directories.

    It's likely that the NTFS filesystem is in an inconsistent state, and this may need a Windows environment to restore it. However, you may get lucky with using the 'ntfsfix' utility. For example, if the external device is sdb1....
    Code:
    sudo ntfsfix -b -d /dev/sdb1
    YMMV.
    Last edited by deano_ferrari; 19-Oct-2018 at 02:43.
    openSUSE Leap 15.0; KDE Plasma 5

  9. #9

    Default Re: Can't delete some empty and very nested directories.

    Quote Originally Posted by hcvv View Post
    I do believe you, but can you please always post including the prompts? Then we can see e.g. what your working directory is.
    It seems you have changed the working directory between those two statements, but we have to guess what you did. Please take into account that we can not look over your shoulder and have to rely on what you show.

    Like:
    Code:
    henk@boven:~/test/leeg> ls -la
    totaal 8
    drwxr-xr-x  2 henk wij 4096 19 okt 11:02 .
    drwxr-xr-x 24 henk wij 4096 19 okt 11:02 ..
    henk@boven:~/test/leeg>
    I'm sorry, I was in a hurry, here are the full info as you requested


    Code:
    sbweb@opensuse-kde:/run/media/sbweb/MyPassport/Backup/backintime/linux/stefano/Home/20180209-194301-109/backu
    p/home/shared/icons/la-capitaine-mymod/places/16x16> LANG=C ls -la                
    total 0
    drwxrwxrwx 1 sbweb users 0 Dec 24  2017 .
    drwxrwxrwx 1 sbweb users 0 Mar 10  2018 ..
    
    
    
    and

    Code:
    sbweb@opensuse-kde:/run/media/sbweb/MyPassport/Backup/backintime/linux/stefano/Home/20180209-194301-109/backu
    p/home/shared/icons/la-capitaine-mymod/places> LANG=C rm -rfv 16x16/
    rm: cannot remove '16x16/': Directory not empty
    
    
    About using a NTFS, I use that HD for a Windows machine backups too. I understand what you say and I'm switching to a different backup solution that uses compressed archives instead of plain files (that's why I'm in need of deleting these), but the fact is that this problems arised and now I'm trying to solve it.

    ---

    Also

    Code:
    sbweb@opensuse-kde:~> sudo ntfsfix -bd /dev/sdb1  
    Mounting volume... OK
    Processing of $MFT and $MFTMirr completed successfully.
    Checking the alternate boot sector... OK
    NTFS volume version is 3.1.
    Going to un-mark the bad clusters ($BadClus)... No bad clusters...OK
    NTFS partition /dev/sdb1 was processed successfully.
    
    

  10. #10
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    25,143

    Default Re: Can't delete some empty and very nested directories.

    Maybe others come with better advice/hint (I really do not know much about anything MS Windows), but you could check how the file system is mounted:
    Code:
    mount | grep media
    Henk van Velden

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •