Operating System - HP-UX
1819548 Members
2667 Online
109603 Solutions
New Discussion юеВ

Re: Soft link removal.HPUX 11.11

 
SOLVED
Go to solution
itreyger
Frequent Advisor

Soft link removal.HPUX 11.11

I have soft link created from one of our directories. I would like to remove it but when I try rm -r /adacs_data/lib/test I am getting "it is a directory".I also tryed unlink but it did not work.I think I need to know the name of that link but all I know is the directory it links to.Please help.Thanks
17 REPLIES 17
Marco A.
Esteemed Contributor

Re: Soft link removal.HPUX 11.11

Hello,

Which are the file permissions ?

use ll to determine that ..

Have you tried to use only rm .

Rgds,

Marco
Just unplug and plug in again ....
itreyger
Frequent Advisor

Re: Soft link removal.HPUX 11.11

when I try rm -r /adacs_data/lib/test I am getting "it is a directory". The permissions are lrwxr-xr-x
Steven E. Protter
Exalted Contributor

Re: Soft link removal.HPUX 11.11

Shalom,

DANGEROUS !!!

rm -rf will work.

It will however wipe out all the data that is soft linked.

Please do an ll on the softlink, post it and someone will try and help.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Marco A.
Esteemed Contributor

Re: Soft link removal.HPUX 11.11

What is the ll-i of that link ?!

Please post the output ...

rgds,

Marco
Just unplug and plug in again ....
Sandman!
Honored Contributor

Re: Soft link removal.HPUX 11.11

Not sure if /adacs_data/lib/test is a directory or a file and whether it's soft linked to another file or if it is the soft link? please clarify...
itreyger
Frequent Advisor

Re: Soft link removal.HPUX 11.11

It looks like this test(directory) -> /adacs_data/lib/test.Test directory links to /adacs_data/lib/test. /adacs_data/lib/test ia a directory.
Sandman!
Honored Contributor

Re: Soft link removal.HPUX 11.11

So "test" (which itself is a dir?)is a soft link to the "/adacs_data/lib/test" directory. And which one are you trying to remove...the soft link or the actual directory itself?
Peter Nikitka
Honored Contributor

Re: Soft link removal.HPUX 11.11

Hi,

adapt the names to your needs:

Creation of a sysmlink:
mkdir -p /tmp/a/b /tmp/c
ln -s /tmp/a/b /tmp/c

Check:
ls -l /tmp/c/b
lrwxrwxrwx 1 ef3nip00 nsd 8 May 8 17:27 /tmp/c/b -> /tmp/a/b

Removal:
rm /tmp/c/b

mfG Peter
The Universe is a pretty big place, it's bigger than anything anyone has ever dreamed of before. So if it's just us, seems like an awful waste of space, right? Jodie Foster in "Contact"
itreyger
Frequent Advisor

Re: Soft link removal.HPUX 11.11

To sendman:
I am trying to remove link to /adacs_data/lib/test.This link goes from Test dir /adacs_data/lib/test.
When I try rm /adacs_data/lib/test - rm: /adacs_data/lib/test directory
Dennis Handly
Acclaimed Contributor

Re: Soft link removal.HPUX 11.11

We don't seem to be getting anywhere.

You need to say what shell you are using and do the following commands:
$ ll -i your-symlink
$ ll -Ldi your-symlink
$ ll -di your-link-target

>I am trying to remove link to /adacs_data/lib/test.

We need to know where the link is, not where it points.

>This link goes from Test dir /adacs_data/lib/test.

You said this is the target of the link?

>When I try rm /adacs_data/lib/test - rm: /adacs_data/lib/test directory

Please do:
$ ll -di /adacs_data/lib/test
itreyger
Frequent Advisor

Re: Soft link removal.HPUX 11.11

result of ll -d dacs/lib/test: 808 drwxrwxrwx 75 adacs adacs 4096 Jan 25 18:15 /adacs/lib/test.Here is the a little bit more info - Since /opt/adacs/lib/test mount point was getting full (92% of utilization)decission was made to create a soft link to the following dir.(adacs_data/lib/test) to save the data there because only 15% of /adacs_data was utilized.I do not know if its going to help but I tryed...
Peter Nikitka
Honored Contributor

Re: Soft link removal.HPUX 11.11

Hi,

it is clear that the data you gave to the ls command (whatever the name was) is NOT a link but definitly a directory:
- no simple rm will work
- a 'rm -rf' will destroy the data

Concerning your primary intent, I would look into /opt/adacs/... - this place may be the place, where you created a link:
find /opt/adacs -type l

mfG Peter
The Universe is a pretty big place, it's bigger than anything anyone has ever dreamed of before. So if it's just us, seems like an awful waste of space, right? Jodie Foster in "Contact"
itreyger
Frequent Advisor

Re: Soft link removal.HPUX 11.11

Output of find /opt/adacs -type l:
/opt/adacs/views/TEST
/opt/adacs/views/TEST_views/view
/opt/adacs/views/test
/opt/adacs/bin.17Jan07
/opt/adacs/data/merged
/opt/adacs/lib/test
/opt/adacs/setup.sav
/opt/adacs/setup.17Jan07
/opt/adacs//views.18Jan07
Peter Nikitka
Honored Contributor

Re: Soft link removal.HPUX 11.11

Hi,

having several links named test (different spelling however), check where they point to:
ls -l /opt/adacs/views/test

These pointing to your real directory data are your candidates. You have to decide, whether
- a simple remove
- remove, copying the 'real data' back
- leave as it is
is the action.

mfG Peter
The Universe is a pretty big place, it's bigger than anything anyone has ever dreamed of before. So if it's just us, seems like an awful waste of space, right? Jodie Foster in "Contact"
itreyger
Frequent Advisor

Re: Soft link removal.HPUX 11.11

Here is what I have got:
ls -l /opt/adacs/test
/opt/adacs/test -> /adacs_data/test

ls -l /opt/adacs/lib/test
/opt/adacs/lib/test -> /adacs_data/lib/test

I just want simply to remove the link without deleting the data

Thanks
Patrick Wallek
Honored Contributor
Solution

Re: Soft link removal.HPUX 11.11

The link "/opt/adacs/test" points to "/adacs_data/test" and "/opt/adacs/lib/test" points to "/adacs_data/lib/test".

So to remove the links you just need to do:

rm /opt/adacs/test

rm /opt/adacs/lib/test

No data will be removed.
itreyger
Frequent Advisor

Re: Soft link removal.HPUX 11.11

Patrick, it worked just fine. Thank you!

I just wanted to thanks everybody that contributed!