LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Tar gives error when creating a tar file archive (http://www.linuxquestions.org/questions/linux-newbie-8/tar-gives-error-when-creating-a-tar-file-archive-169040/)

davidas 04-12-2004 02:25 AM

Tar gives error when creating a tar file archive
 
As root, I executed the following command in the / directory:
Code:

tar cvf /bkroot/backup.tar .
{Alot of files scrolling down}
./proc/1118/root
./proc/1118/exe
./proc/1118/mounts
./opt/
./floppy/
./cdrom/
./initrd/
./vmlinuz.old
./sys/
./bkroot/
./bkroot/lost+found/
tar: ./bkroot/backup.tar: file is the archive; not dumped
tar: Error exit delayed from previous errors

Then it ended with the above error.

What is the right command (apparently mine is wrong since it ended with an error) to backup everything from / down to all subdirectories to /bkroot/backup.tar ?

Thanks :)

mrcheeks 04-12-2004 02:46 AM

keep it simple
tar cvf backup.tar *

davidas 04-12-2004 02:58 AM

I'm only have sufficient disk space on /bkroot, which is on another physical harddisk. So, to use your command, I'll have to do
Code:

cd /bkroot
What does the asterisk mean? Will your command tar all files under / directory into backup.tar?

Thanks again !

Quote:

Originally posted by mrcheeks
keep it simple
tar cvf backup.tar *


mrcheeks 04-12-2004 06:37 AM

i guess it would be for example
Code:

tar cvf - . | gzip >/bkroot/backup.tar.gz

davidas 04-12-2004 10:47 AM

I've the verbose output while it is archiving piped to grep ^tar with the following results:

tar: ./tmp/.X11-unix/X64: socket ignored
tar: ./tmp/.X11-unix/X0: socket ignored
tar: ./tmp/.font-unix/fs7100: socket ignored
tar: ./dev/log: socket ignored
tar: ./proc/kcore: File shrank by 545927168 bytes; padding with zeros
tar: ./proc/2/exe: Cannot readlink: No such file or directory
tar: ./proc/3/exe: Cannot readlink: No such file or directory
tar: ./proc/4/exe: Cannot readlink: No such file or directory
tar: ./proc/5/exe: Cannot readlink: No such file or directory
tar: ./proc/6/exe: Cannot readlink: No such file or directory
tar: ./proc/7/exe: Cannot readlink: No such file or directory
tar: ./proc/94/exe: Cannot readlink: No such file or directory
tar: ./proc/124/exe: Cannot readlink: No such file or directory
tar: ./proc/951/exe: Cannot readlink: No such file or directory
tar: ./proc/1432/fd/4: Cannot stat: No such file or directory
tar: ./bkroot/backup.tar: file is the archive; not dumped
tar: Error exit delayed from previous errors

Any advice?

Thanks :)

michaelk 04-12-2004 11:49 AM

Quote:

tar: ./bkroot/backup.tar: file is the archive; not dumped
You are attempting to tar your backup file.

What distro are you running? You do not need to backup all directories. Like lost+found, /tmp and even /proc. See man pages for tar on excluding directories.

davidas 04-12-2004 12:37 PM

I'm trying to transfer my entire system to a new harddisk. If I exclude /proc, /dev, lost+found, can my new harddisk boot up without those directories? Will they be created on the new harddisk's first boot-up?

Thanks !
Running Debian 'Sarge'

Quote:

Originally posted by michaelk
You are attempting to tar your backup file.

What distro are you running? You do not need to backup all directories. Like lost+found, /tmp and even /proc. See man pages for tar on excluding directories.


michaelk 04-12-2004 12:45 PM

Why not mount the drive and copy the files using the cp command. You can preserve permissions as well as copy subdirectories.

davidas 04-12-2004 07:07 PM

Assuming /dev/hdb2 is my new harddisk, is the following command correct to copy the entire system(everything from / directory onwards) ?

Code:

mount /dev/hdb2 /bkroot && cp -pR / /bkroot
Thanks :)

Quote:

Originally posted by michaelk
Why not mount the drive and copy the files using the cp command. You can preserve permissions as well as copy subdirectories.

michaelk 04-12-2004 08:03 PM

Make it commands and it should work
mount /dev/hdb2 /bkroot
cp -pR /* /bkroot/

davidas 04-13-2004 12:35 AM

The system seems to be in a indefinite loop during the copy process. I'm not sure, but I suspect it is because /bkroot is a sub directory of /, so by coping recursively, it will fall into a indefinitely loop? Just a guess...

Is there any arguement that can be used to exclude /bkroot in the copy process?

Thanks :)

Quote:

Originally posted by michaelk
Make it commands and it should work
mount /dev/hdb2 /bkroot
cp -pR /* /bkroot/



All times are GMT -5. The time now is 05:44 PM.