tar and symbolic links
I'm backing up my whole system to an external hard drive using tar and for the most part it works like a charm. However, I'm having trouble extracting symbolic links from the tarball, they are restored as empty files without any permissions or original ownership:
Code:
$ ls -l /home/jim/mysymlink |
Well if you exclude the symlink destination, what else is supposed to happen ?
|
If the target of the symbolic link is under the base directory being archived and is also archived, then the symbolic link will be restored correctly. Look at the tar info file and search for "symbolic".
|
Actually GNU tar preserves symbolic links, even if the target file does not exist anymore. Which version of tar are you running?
Code:
tar --version |
@smoker - the exclusion was for my external hard disk when creating the archive, the symlinks are on my computer. They were included in the archive but it's when I try to extract them I'm having the problem.
@jschiwal - these requirements are all met and it's still not working properly :( @colucix - I'm running Tar 1.22 on Ubuntu 10.10 (lucid) |
If the symlinks were in the archive, then when you extracted the archive, presumably as root, it merely copied the archive contents over the existing symlinks. But the links in the archive were broken when you excluded /media/Maxtor - hence the current situation. Tar can follow symlinks if you tell it to, but you didn't and you excluded the destination anyway.
IMHO anyway ... Have you tried testing with a symlink that points at a file that does get archived ? |
Ahh yes that makes perfect sense now you've explained it and you're correct, other symlinks on the filesystem are extracting properly. Thanks so much!
|
All times are GMT -5. The time now is 12:50 AM. |