LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   SUSE / openSUSE (https://www.linuxquestions.org/questions/suse-opensuse-60/)
-   -   cannot delete folder (https://www.linuxquestions.org/questions/suse-opensuse-60/cannot-delete-folder-573992/)

douart 08-01-2007 02:27 PM

cannot delete folder
 
I copied root folder onto an external fat32 drive to back it up before changing partitions.
I can't get rid of the /dev folder.
I whittled /dev down to /dev/fd/6.
/fd is a link and all the files in it are links.
I have found out that checking Properties of /media/disk starts some sort of loop that continues beyond what the actual system file gives. Deleting /media/disk/dev starts some sort of loop.
rm -rfd /media/disk/dev as root, even though I am the owner, starts a loop until I "ctrl z" to stop the process.

I also tried a live cd. I also tried with the drive connected to XP.

ls -l gives the following.
/media/disk # ls -l /media/disk/dev
total 16
drwxr-xr-x 3 don root 16384 Jul 29 08:50 fd

The 3 is different than the other files. What does that mean?

ilikejam 08-01-2007 02:42 PM

Why do you need to delete the /dev directory? If it's a reasonably recent Linux distro this directory will be generated at boot by udev.

Also, *all* the file ownerships and permissions will be gone if you've backed up onto fat32, so doing a restore of the root partition will be a major headache.

Dave

douart 08-02-2007 07:23 AM

Right Dave

I did not need any of the files after copying them.
Now I am trying to remove them from my backup drive.
All have been deleted except media/dev/fd/6/fd/6/fd/6/fd/6/fd/6/fd/6........and on it goes!

(I am using suse 10.2_64)

auxsvr 08-02-2007 08:01 AM

Try
Code:

rm media/dev/fd/6/
, then delete everything else. There's a recursive loop there.

douart 08-03-2007 12:48 PM

Tried

rm media/disk/dev/fd/6/
rm media/disk/dev/fd/6
rm media/disk/dev/fd/
rm media/disk/dev/
pilgrim2x:/media/disk/dev # rm *

and other variations. They did not work.

(error message) rm: cannot remove `(whatever)': Is a directory

The loop is to directories.

auxsvr 08-03-2007 05:47 PM

Yes, of course, it's a directory, you need to type
Code:

rm media/disk/dev/fd/6
omitting the slash in the end (it's a symbolic link, right?).

douart 08-04-2007 08:19 AM

Quote:

Originally Posted by auxsvr
Yes, of course, it's a directory,
you need to type
Code:

rm media/disk/dev/fd/6
omitting the slash in the end (it's a symbolic link, right?).

I don't know what 6 is except that it is a directory.
My system folder /dev/fd, like the folder that was originally copied, is a link to /proc/self/fd and
has no folders in it and no 6 now of any kind.
There are files 1 through 5 in it that are links to different things or files.

The following is what I received:

pilgrim2x:~ # rm /media/disk/dev/fd/6
rm: cannot remove `/media/disk/dev/fd/6': Is a directory
pilgrim2x:~ #

dxqcanada 08-04-2007 08:26 AM

Quote:

Originally Posted by douart
pilgrim2x:~ # rm /media/disk/dev/fd/6
rm: cannot remove `/media/disk/dev/fd/6': Is a directory

Have you tried:
Code:

pilgrim2x:~ # rm -rf /media/disk/dev/fd/6
or
use mc ?

auxsvr 08-04-2007 10:46 AM

What about
Code:

rmdir /media/disk/dev/fd/6
?

douart 08-05-2007 09:04 AM

Quote:

Originally Posted by dxqcanada
Have you tried:
Code:

pilgrim2x:~ # rm -rf /media/disk/dev/fd/6

Yes

Code:

pilgrim2x:~ # rm -rfd /media/disk/dev/
is the first command I tried. That or against any of the subfolders starts a seemingly unending loop, with or without a slash at the end.

[QUOTE=dxqcanada]
Quote:

Originally Posted by dxqcanada
or use mc ?

I don't know what mc is. I will look into it after church or tomorrow morning.

Quote:

Originally Posted by auxsvr
What about
Code:

rmdir /media/disk/dev/fd/6
?

rmdir complains about the directory not being empty.

I noticed what may be a clue this morning. I tried again to delete /media/disk/dev with konqueror file manager. In the delete dialog box, as the number of deleted folders was skyrocketing into the thousands, there were also hundreds of files building up.

No files are ever displayed when clicking on /media/disk/dev, just folders: /media/disk/dev/fd/6/fd/6/fd/6/fd/6/fd/6/fd/6........and on it goes!

Reminder: 500GB external drive, fat32 file system, have not been able to delete /media/disk/dev/ that I copied from /dev/.

I appreciate the help.

auxsvr 08-05-2007 10:14 AM

Since /media/disk/dev/fd/6 is not a symbolic link, you either have thousands of directories with the names you show above (maybe you created them by mistake) or the filesystem is corrupted (do a fsck or scandisk on it). I cannot think of another possibility at the moment. Did any error message appear when you were copying the files?

douart 08-08-2007 12:58 PM

Quote:

Originally Posted by auxsvr
Since /media/disk/dev/fd/6 is not a symbolic link, you either have thousands of directories with the names you show above (maybe you created them by mistake) or the filesystem is corrupted (do a fsck or scandisk on it). I cannot think of another possibility at the moment.

Good thinking auxsvr.
If I had not jumped to conclusions I would have deleted /media/disk/dev/ long ago.

Quote:

Originally Posted by auxsvr
or the filesystem is corrupted (do a fsck or scandisk on it)

filesystem checked OK

I was checking the drive again in XP. I notice that the folder was read only. On a lark I set to change the attributes to archive.
Off it went on a seeming endless process. I was watching the path fly by in the dialogue box when in the blur at the end there seemed to be a 9!
I stopped the process and opened /media/disk/dev/ in a fiemanager.
Again, /media/disk/dev/fd/6/fd/6/fd/6.....
23 folders down, was /6 with folders named 9, 10, 11, 12, 13, 14, and 15 within. Within these folders were folders of folders with different numbers of folders with numerical names up to the low thirty's.
On and on the branches (or roots) of the tree went.
Every once in a while there would be two files together, sometimes named stderr and stdout or named 1 and 2 all with the same message. Something about icon paths if I remember correctly. Also, occasionally there were about 5 or 6 empty folders with the same names as some of the folders in the system folder /dev.

Since, as you point out, these did not show to be linked, there must be an end to it and
"rm -rfd /media/disk/dev/" should work.

Out of curiosity I checked the properties of /media/disk/dev/ again using konqueror. This time I let it run.
2 3/4 hours later when konqueror locked up it showed 17290 files and 392261 sub-folders using 6+GB of space.

Tiring of /media/disk/dev/ I then ran
"rm -rfd /media/disk/dev/" and about 29 minutes later it was gone.

I could have copied everything except /media/disk/dev/ and reformatted quicker, but it has been fun.

Thanks again for the help.
don


All times are GMT -5. The time now is 02:36 AM.