LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 04-12-2004, 02:25 AM   #1
davidas
Member
 
Registered: Mar 2004
Distribution: Debian 'Sarge'
Posts: 168

Rep: Reputation: 30
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
 
Old 04-12-2004, 02:46 AM   #2
mrcheeks
Senior Member
 
Registered: Mar 2004
Location: far enough
Distribution: OS X 10.6.7
Posts: 1,690

Rep: Reputation: 50
keep it simple
tar cvf backup.tar *
 
Old 04-12-2004, 02:58 AM   #3
davidas
Member
 
Registered: Mar 2004
Distribution: Debian 'Sarge'
Posts: 168

Original Poster
Rep: Reputation: 30
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 *
 
Old 04-12-2004, 06:37 AM   #4
mrcheeks
Senior Member
 
Registered: Mar 2004
Location: far enough
Distribution: OS X 10.6.7
Posts: 1,690

Rep: Reputation: 50
i guess it would be for example
Code:
tar cvf - . | gzip >/bkroot/backup.tar.gz
 
Old 04-12-2004, 10:47 AM   #5
davidas
Member
 
Registered: Mar 2004
Distribution: Debian 'Sarge'
Posts: 168

Original Poster
Rep: Reputation: 30
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
 
Old 04-12-2004, 11:49 AM   #6
michaelk
Moderator
 
Registered: Aug 2002
Posts: 11,856

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
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.
 
Old 04-12-2004, 12:37 PM   #7
davidas
Member
 
Registered: Mar 2004
Distribution: Debian 'Sarge'
Posts: 168

Original Poster
Rep: Reputation: 30
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.
 
Old 04-12-2004, 12:45 PM   #8
michaelk
Moderator
 
Registered: Aug 2002
Posts: 11,856

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
Why not mount the drive and copy the files using the cp command. You can preserve permissions as well as copy subdirectories.
 
Old 04-12-2004, 07:07 PM   #9
davidas
Member
 
Registered: Mar 2004
Distribution: Debian 'Sarge'
Posts: 168

Original Poster
Rep: Reputation: 30
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.
 
Old 04-12-2004, 08:03 PM   #10
michaelk
Moderator
 
Registered: Aug 2002
Posts: 11,856

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
Make it commands and it should work
mount /dev/hdb2 /bkroot
cp -pR /* /bkroot/
 
Old 04-13-2004, 12:35 AM   #11
davidas
Member
 
Registered: Mar 2004
Distribution: Debian 'Sarge'
Posts: 168

Original Poster
Rep: Reputation: 30
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/
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how can i decompress this tar.tar file? hmmm sounds new.. tar.tar.. help ;) kublador Linux - Software 10 02-23-2008 05:40 AM
Creating a spanning archive with tar Phyrexicaid Linux - Software 4 01-27-2005 08:04 PM
Problem Creating Archive With Tar In Redhat!!! hamidrh Linux - Newbie 4 09-16-2004 12:37 PM
Problem with properly creating a tar archive FransE Linux - Software 5 02-28-2004 03:15 PM
Problem creating tar.gz archive - File changed as we read it doctorwebbox Linux - General 1 02-04-2004 05:59 PM


All times are GMT -5. The time now is 11:55 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration