Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I desperately need some help regarding problem I am facing now. While creating a softlink for a very important file I gave the reverse command by mistake. Instead of giving it "ln target linkname" I have given it 'ln linkname target'. This has resulted in references pointing to target files are now pointing to links and the actual refernces to target files are lost. How can I recover the files back.

"/home/user/data1" was original file location. "/home/user/db2" was the desired softlink for this data.

I haveto give "ln data1 db2" but I have given 'ln db2 data1'.

This has resulted in 'data1' being now pointing towards 'db2' and the actual data in 'data1' can not be retrieved.

Some one please help.

Thanks in advance.

share|improve this question

migrated from Feb 5 '10 at 11:10

This question came from our site for professional and enthusiast programmers.

Whatever you do, remount that partition read-only, right now. Other writes to the disk might well overwrite your precious file.

After that, try some recovery tools from the other answers.

share|improve this answer
furthermore: make first a backup copy of that partition. and then a backup of that backup. and then only work on that backup and let the original data alone. – akira Feb 5 '10 at 11:55
I wish I could upvote this more than once – Nifle Feb 5 '10 at 23:18

You might try using TestDisk:

TestDisk can

  • Undelete files from FAT, NTFS and ext2 filesystem
  • Copy files from deleted FAT, NTFS and ext2/ext3 partitions.

and maybe you will be in luck...

share|improve this answer

What filesystem are you using? if EXT3 or EXT4 there is no way (at least i have this info) to restore those files.

share|improve this answer
Yes I am using Ext 3 – Ashine Feb 5 '10 at 9:59

Get SystemRescueCd live CD and do the rescue using this live linux. It contains most of the useful tools.

"Magic Rescue" is another tool.

share|improve this answer

You must log in to answer this question.