[mythtv-users] Symbolic Links (complete n00b question)
esper at sherohman.org
Tue Mar 14 17:36:32 UTC 2006
On Tue, Mar 14, 2006 at 11:51:49AM -0500, Chris Clarke wrote:
> This is probably a simple question, but I couldn't figure the right
> combination of keywords to get google to give me the answer :) I've
> got 2 hard drives I'd like to use for Myth, one mounted at
> /myth/recordings, the other at /myth/backups. How do I link
> everything in the /myth/backups folder with the /myth/recordings
To symlink every file in /myth/recordings to /myth/backups, you would do:
ln -s /myth/recordings/* .
It's possible that this may fail if you have too many files in
/myth/recordings, in which case you could use the more verbose
for i in /myth/recordings/* ; do ln -s $i . ; done
However... I don't think this is what you really want to do. A symlink
is *not* a backup, it's just a pointer to a file in another location.
(Similar to what Windows calls a "shortcut".) If the original file is
deleted, the symlink stops working and if the original becomes corrupted,
the link still points to the corrupted file, not a good copy.
If your intention really is to create a backup, you need to do it the long
way, by actually copying the files over. For a one-shot deal, replacing
the "ln -s" in the commands I gave you above with "cp" will do this.
As an ongoing backup, you wouldn't want to copy every file every time,
so you'd be better off either using "cp -u" (copies only new/changed
files) or looking at rsync (copies new files and changed sections of
changed files, can also delete files at the destination which are no
longer present at the source).
Depending on your reasons for wanting a backup, you may also want to
consider setting up a RAID1 mirror instead of a separate backup directory,
but that's a bit more complex to implement...
The freedoms that we enjoy presently are the most important victories of the
White Hats over the past several millennia, and it is vitally important that
we don't give them up now, only because we are frightened.
- Eolake Stobblehouse (http://stobblehouse.com/text/battle.html)
More information about the mythtv-users