2

I have a mounted partition with a lot of data on it, much of it is useless, but I want to backup what is still used. I know that everything that is still in use has a symlink pointing to it, for example: /var/www -> /mnt/md1/var/www.

I'd like to get a list of symlinks pointing to something under /mnt/md1.

Everything I find from my searches are about finding the symlinks pointing to a known destination, the difference here is that I don't know their destinations, only that they are somewhere under /mnt/md1

Maybe it would be easier if I unmount it and somehow find a list of broken symlinks?

1 Answer 1

2

find's -lname predicate can be of use here:

find / -type l -lname '*/mnt/md1/*' 

(the first asterisk is to find relative links that reach up to the root)

1
  • This could be the answer, unfortunately I had to cancel it after a few hours because it took too long, I've tried to play with -prune to ignore some directories, but it is still taking too long. I'll accept your answer as it probably does what I asked even if I couldn't test it. Commented Nov 1, 2017 at 14:57

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.