- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- HELP?! :-/ Accidentally created symlink over exis...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2006 09:32 AM
11-20-2006 09:32 AM
HELP?! :-/ Accidentally created symlink over existing dir
Before you ask, no, I don't know the inode of the original directory entry.
Is there a recovery tool that can pull that inode info out of the raw filesystem? Is there some simple, magical, "no, I didn't really mean to ln -s a b, I meant ln -s a c" command that I simply haven't run into yet in my unix career? :-)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2006 09:38 AM
11-20-2006 09:38 AM
Re: HELP?! :-/ Accidentally created symlink over existing dir
Removing a symbolic link (with 'rm') only removes the link, not the object pointed to by the link.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2006 12:39 PM
11-20-2006 12:39 PM
Re: HELP?! :-/ Accidentally created symlink over existing dir
The name of the link was an existing file. The link took the place of that file in the directory. I need to get back the original file.
Perhaps this will explain better. The DBA did the equivalent of:
# cd /u01
# ls -CF
Oracle/ IAS/ foo/
# ln -s IAS Oracle
# ls -CF
Oracle@ IAS/ foo/
D'OH!
So in the steps above, "Oracle" was originally a directory, but now it's a symbolic link to the IAS directory.
And the problem is he didn't mean to get rid of the Oracle directory, so I need to get it back, if possible. As luck would have it,the machine was very recently rebuilt and the backups haven't started yet, so I can't even restore from tape for him.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2006 12:53 PM
11-20-2006 12:53 PM
Re: HELP?! :-/ Accidentally created symlink over existing dir
ll -d Oracle
... Oracle@ -> Oracle
mv Oracle Oracle1
ll -d Oracle*
... Oracle@ -> Oracle
... Oracle1/
rm Oracle
mv Oracle1 Oracle
ll -d Oracle
... Oracle/
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2006 02:55 PM
11-20-2006 02:55 PM
Re: HELP?! :-/ Accidentally created symlink over existing dir
Oops, if you try to do it over a directory, the symlink is added to the existing directory:
$ ls
DUMMY/ full_path.c
$ ln -s full_path.c DUMMY
$ ll
drwxrwxr-x 2 96 Nov 20 19:48 DUMMY/
$ ll DUMMY/
lrwxrwxr-x 1 11 Nov 20 19:48 full_path.c@ -> full_path.c
>Bill: Just rename the Oracle symlink. The symlink itself is unaffected but the underlying Oracle directory will be renamed.
Huh?? What type of filesystem, command and/or shell allows that?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2006 03:36 PM
11-20-2006 03:36 PM
Re: HELP?! :-/ Accidentally created symlink over existing dir
I have tried to reproduce the same, but no luck!
# mkdir dir1
# mkdir dir2
# ln -s file1 dir1
# ll
total 0
drwxrwxrwx 2 root sys 96 Nov 21 08:41 dir1
drwxrwxrwx 2 root sys 96 Nov 21 08:41 dir2
-rw-rw-rw- 1 root sys 0 Nov 21 08:40 file1
-rw-rw-rw- 1 root sys 0 Nov 21 08:40 file2
# ln -s dir1 file1
ln: file1 exists
# ln -s file1 file2
ln: file2 exists
#
Please post a listing of the file system and more information about your OS so that we can have a better insight on the problem
kind regards
yogeeraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2006 11:33 PM
11-20-2006 11:33 PM
Re: HELP?! :-/ Accidentally created symlink over existing dir
cd /tmp
mkdir Oracle
touch Oracle/someOLDfile
Now create the symlink as if it was replacing the directory:
ln -s Oracle Oracle
It works. But not like you would think:
ll Oracle
total 0
lrwx------ 1 root sys 6 Nov 21 07:23 Oracle@ -> Oracle
-rw------- 1 root sys 0 Nov 21 07:23 someOLDfile
As you can see, the symlink was actually created under the Oracle directory and is pointing to something called Oracle. However, if you cd to /tmp/Oracle and type two commands:
ll Oracle
lrwx------ 1 root sys 6 Nov 21 07:23 Oracle@ -> Oracle
ll Oracle/*
Oracle/* not found
Symlinks are tricky because they don't point to an object (directory, file, etc), they are actually an alias string. So the symlink was created UNDER the Oracle directory and now is meaningless because in the Oracle directory as there is no Oracle object for the symlink's alias. Be sure to use ll -Fd when looking at objects to make sure you aren't seeing the contents but the actual element.
Bill Hassell, sysadmin