Deleting a hard link to a directory?
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Unix and Linux reviews > Free Unix support > Unix administration > Deleting a hard link to a directory?




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    Deleting a hard link to a directory?  
Philip White


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
11-24-07 12:20 AM

Hi, all;

I don't know how, but a long time ago I made a hard link to a home
directory, like so:

$ ls -1i /
...
1224001 etc
2121601 home
2121601 hometest
767041 lib
...

Now I would really like to get rid of /hometest, but I have no idea how!
'rmdir' returns "rmdir: /hometest: Device or resource busy" (even though
'lsof' shows nothing as having any part of /hometest open), 'rm' tells me
that it's a directory, and 'rm -rf /homedir' is unacceptable for obvious
reasons.

Help!

--
PGP key: http://www.qnan.org/~pmw/pgp/public.asc





[ Post a follow-up to this message ]



    Re: Deleting a hard link to a directory?  
Barry Margolin


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
11-24-07 12:20 AM

In article <fi7a18$ccv$1@registered.motzarella.org>,
Philip White <pmw+news@qnan.org> wrote:

> Hi, all;
>
> I don't know how, but a long time ago I made a hard link to a home
> directory, like so:
>
> $ ls -1i /
> ...
> 1224001 etc
> 2121601 home
> 2121601 hometest
>  767041 lib
> ...
>
> Now I would really like to get rid of /hometest, but I have no idea how!
> 'rmdir' returns "rmdir: /hometest: Device or resource busy" (even though
> 'lsof' shows nothing as having any part of /hometest open), 'rm' tells me
> that it's a directory, and 'rm -rf /homedir' is unacceptable for obvious
> reasons.

Do you have an "unlink" command?  This typically bypasses all the checks
and simply removes the link.

If not, try: PERL -e 'unlink "/hometest"'

--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***





[ Post a follow-up to this message ]



    Re: Deleting a hard link to a directory?  
Philip White


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
11-24-07 12:20 AM

On Fri, 23 Nov 2007 15:58:39 -0500, Barry Margolin wrote:
> Do you have an "unlink" command?  This typically bypasses all the checks
> and simply removes the link.
>
> If not, try: PERL -e 'unlink "/hometest"'

I forgot to mention that I've tried that too. :/

# unlink hometest
unlink: cannot unlink `hometest': Is a directory

--
PGP key: http://www.qnan.org/~pmw/pgp/public.asc





[ Post a follow-up to this message ]



    Re: Deleting a hard link to a directory?  
Edward C. Otto III


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
11-24-07 12:20 AM

Philip White wrote:
> On Fri, 23 Nov 2007 15:58:39 -0500, Barry Margolin wrote: 
>
> I forgot to mention that I've tried that too. :/
>
> # unlink hometest
> unlink: cannot unlink `hometest': Is a directory
>

Have you tried the following steps?

1) Take susyem down to console prompt;
2) umount /home
3) rm -rf /hometest

Ed





[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 03:08 AM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register