[lug] cruft from an fsck'ed partition

Hugh Brown hugh at vecna.com
Thu Jun 21 15:03:33 MDT 2001


The point is that it is no longer a directory.  It has morphed into a block
special file. 

How do I remove a block special file when I am told "permission denied"
when I am root?

Hugh


"D. Stimits"
> 
> Hugh Brown wrote:
> > 
> > Let me add more detail.  On fileserver I have a partition that is mounted
> > on /home it has an appropriate lost+found directory.  Once a week, I do a
> > backup of fileserver:/home to backupserver:/backups/fileserver/home
> > 
> > On backupserver I have a large partition that is mounted at /backups
> > 
> > I do the backup by doing a tar cf - /home  | (cd /backups/fileserver; tar
> > xf -)   all over an ssh session.
> > 
> > I was looking at the backup (a user typed rm * in her home directory, oops)
> > and noticed  the block file where a directory should have been.
> > 
> > I tried to delete it and got all of what I noted below.
> > 
> > I think it ended up that way as a result of fsck trying to fix things after
> > a system crash.
> > 
> > How can I remove the block special file?
> 
> You probably need to do an rm -Rf (forced recursive, rather than just
> rm) in case there is anything in the directory. If that fails, find out
> what is making it "busy", via "fuser", and kill whatever is holding it.
> Then try delete again.
> 
> D. Stimits, stimits at idcomm.com
> 
> > 
> > Hugh
> > 
> > "D. Stimits"
> > >
> > > Hugh Brown wrote:
> > > >
> > > > I have been doing a tar over ssh backup of a filesystem to a disk.  Too
> > > > often it dies and complains about a corrupted MAC on input.  Too many times
> > > > I have had to go through lengthy fsck's the next time it comes up.
> > > >
> > > > Today on that disk I found a copy of the lost+found folder from the
> > > > original system but it was magically a block special device instead of a
> > > > regular folder.
> > > >
> > > > br-xr---wx    2 26723    19443     69,  49 Sep 20  2005 lost+found
> > >
> > > Definitely it should be a directory.
> > >
> > > >
> > > > Here's what I have tried while su -'ed to root:
> > > >
> > > > $ rm lost\+found
> > > > rm: remove `lost+found'? y
> > > > rm: cannot unlink `lost+found': Operation not permitted
> > >
> > > I think removing lost+found might be a bad idea anyway. You should try
> > > the command "mklost+found" (see man page).
> > >
> > > >
> > > > $ chown root lost+found
> > > > chown: lost+found: Operation not permitted
> > > >
> > > > $ lsattr lost+found
> > > > lsattr: No such device While reading flags on lost+found
> > > >
> > > > $ mv lost+found /tmp
> > > > mv: cannot unlink `lost+found': Operation not permitted
> > > > mv: cannot remove `lost+found': Operation not permitted
> > > >
> > > > I was able to remove the copy in /tmp though
> > > >
> > > > I tried adding a user with uid 26723 and then repeated the same commands
> > > > and got nowhere.  In /var/log/messages I have
> > > >
> > > > Jun 21 15:38:09 localhost modprobe: modprobe: Can't locate module block-major-69
> > >
> > > This appears to be scsi devices starting with "sdc", owner root, group
> > > disk. Check out /dev/MAKEDEV for recreation.



More information about the LUG mailing list