![]() |
tar won't extract my archive properly?
Hi all,
i am simply trying to copy about 6Gb files/directories from an EXT3 USB drive, onto an EXT4 NAS. Because I am copying dovecot mail directories, it is important that the permissions are retained. After lots of trial and error, I managed to use tar to create a complete permissions-inclusive archive without any errors: tar -cvf /myarchive.tar -C / ext3USBmount but now when I attempt to extract the archive with: tar -xpvkf /myarchive.tar I am getting lots of errors that read: Cannot change ownership to uid <original uid>, gid 0: No such file or directory an example of the full error with a filename might be: home/j.bloggs/mail/.INBOX.subfoldername/cur/12345678.M64612314134.mydomain.com.au,S=1241,W=1285\:2,ST: Cannot change ownership to uid 576, gid 0: No such file or directory Some other simple info: - nothing's changed from source to destination, in terms of system setup/users/groups - yes i'm logged in as root - obviously i've stopped my mail processes before this tar command was exected, i would like to start my mail server again soon if at all possible :) Thanks again, Scott |
I am not sure about /C option in the tar command. It should have been simple as
Quote:
|
thanks, i am trying that now ad it is recreating the archive as we speak.
Just to be clear, what would the extract command be? my guess is tar -xvfp /myarchive.tar -C / |
hi again,
this is still not happy. Using: tar cvfp /myarchive.tar <folder-name> tar -xvpf /myarchive.tar -C / is still giving me: Cannot change ownership to uid <original uid>, gid 0: No such file or directory funny how some files are OK but others generate this error. At first glance, it seems to be files with "." in their name (like, the contents of "/.INBOX". Which makes me think I haven't done something properly with permissions. As an aside, does chgrp -R 0 <foldername> change group permissions of hidden files? I ran this command on my source folder before copying... (because i was trying to use cp instead of tar, and had even more permissions-related errors). |
Quote:
should have been something like this Code:
#tar -cpvf /myarchive.tar -C / ext3USBmount |
I just confirmed with another attempt:
#tar -cpvf /myarchive.tar -C / ext3USBmount #tar -xpvf /myarchive.tar -C / also isn't working. Upon closer inspection of the verbose output, each file has two relevant lines: it looks like the file extracts OK, but the permissions aren't being set on it. eg: home/user/mail/.INBOX.subfolder/cur/12345678.mydomain.com.au,S=788,W=811:2,ST home/user/mail/.INBOX.subfolder/cur/12345678.mydomain.com.au,S=788,W=811\:2,ST: Cannot change ownership to uid 576, gid =: No such file or directory. The difference between these two seems to be an inserted "\" character at the end of the W= .... |
Quote:
|
I spent another few hours today trying to facilitate this copy, but so far still can't get the directory to replicate properly.
I gave up on tar because in spite of a couple more repeated tar attempts, the extracting of my tar archive was not only riddled with the above errors, but the extraction was also slowing gradually to a halt after only extracting about 25% of stuff. So I've moved onto rsync: rsync -avzH /source/ /destination/ but this also isn't working. The rsync seems to start confidently enough, copying files and folders without error... but after a while the rync routine doesn't end, it just stops with a flashing cursor for seeming eternity. (I left it sit for 2 hours today and it's certainly a 'crash' scenario, it's not processing anything and there's no hdd or network lights during this time.. nothing). I hit Ctrl+C to quit, and upon further investigation, it looked like rsync created the directory structure oK, but only seemed to copy about 4Gb of my desired ~7Gb worth of data. Again, all the directories are there, and some of them are full.. but the others are empty. I've tried a few times and keep getting the same result. Is there a simple gnome rsync front end or something that I could try? something similar to Carbon Copy Cloner for REHL would be nice? I thought about sharing both folders via smb and doing the copy on a host machine, but it seems ridiculous especially considering that I will need to script and automate this copy regularly using cron. Any more ideas? I never thought such a simple, small copy could take more than 6 hours to troubleshoot... :( |
To extract the files and retain ownership, you need to extract the files as root (if you aren't the owner). If the destination share was exported with root squash, chown won't work. You also can't use "cp -a" and retain ownership either.
You can transfer large backups by piping the tar archive. tar -C /path/to/basedir -cf - . | tar -C /path/to/destdir -xvkf - If the destination is another host, you can do the same through an ssh tunnel, however ssh root access isn't the best idea. |
| All times are GMT -5. The time now is 08:30 AM. |