Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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
lrwxrwxrwx 1 jim jim 22 2010-08-19 00:18 /home/jim/mysymlink -> /media/Maxtor/mysymlink
$ sudo tar cfpz /media/Maxtor/backup1.tgz --exclude=/media/Maxtor /
$ sudo tar xfpz /media/Maxtor/backup1.tgz home/jim/mysymlink
$ ls -l /home/jim/mysymlink
---------- 1 root root 0 2010-08-19 00:19 /home/jim/mysymlink
All other files can be extracted properly with correct ownership/permissions, it's only symbolic links I'm having the problem with. Any ideas?
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".
@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 ?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.