From the howto: http://www.faqs.org/docs/securing/chap29sec305.html
I got some ideas to help me to tar up the OS. I had already been shown how to wrap it into SSH to deposit the tar file on another system, so I tried the following:
tar cpvzf - -C / --exclude home --exclude media --exclude mnt --exclude proc --exclude */lost+found | ssh root@10.0.0.2 "cat>backup-060907.tgz"
But, whereas the howto is talking about --exclude dealing with files, the Centos Man on tar is saying that it applies to files.
So what is wrong? I know the SSH stuff is correct as when I put in something like ls I get a file with result of the ls. Also I had done this without the excludes and of course it died slowing when it got to /media/cdrom :(
Robert Moskowitz wrote:
From the howto: http://www.faqs.org/docs/securing/chap29sec305.html
I got some ideas to help me to tar up the OS. I had already been shown how to wrap it into SSH to deposit the tar file on another system, so I tried the following:
tar cpvzf - -C / --exclude home --exclude media --exclude mnt --exclude proc --exclude */lost+found | ssh root@10.0.0.2 "cat>backup-060907.tgz"
But, whereas the howto is talking about --exclude dealing with files, the Centos Man on tar is saying that it applies to files.
So what is wrong? I know the SSH stuff is correct as when I put in something like ls I get a file with result of the ls. Also I had done this without the excludes and of course it died slowing when it got to /media/cdrom :(
I recall that before USB2, when tape backup made sense, I used an "exclude file" rather than doing it on the command line. I also remember that "/"s most definitely affect the outcome. I believe that if you'll look at the info pages (not man) for tar, you'll find a few examples buried in the document that will make the tar part of your puzzle crystal clear.
Robert wrote:
Robert Moskowitz wrote:
From the howto: http://www.faqs.org/docs/securing/chap29sec305.html
I got some ideas to help me to tar up the OS. I had already been shown how to wrap it into SSH to deposit the tar file on another system, so I tried the following:
tar cpvzf - -C / --exclude home --exclude media --exclude mnt --exclude proc --exclude */lost+found | ssh root@10.0.0.2 "cat>backup-060907.tgz"
But, whereas the howto is talking about --exclude dealing with files, the Centos Man on tar is saying that it applies to files.
So what is wrong? I know the SSH stuff is correct as when I put in something like ls I get a file with result of the ls. Also I had done this without the excludes and of course it died slowing when it got to /media/cdrom :(
I recall that before USB2, when tape backup made sense, I used an "exclude file" rather than doing it on the command line. I also remember that "/"s most definitely affect the outcome. I believe that if you'll look at the info pages (not man) for tar, you'll find a few examples buried in the document that will make the tar part of your puzzle crystal clear.
At the very end of info tar, it talks a LITTLE bit about -- exclude PATTERN.
I guess you have to know what pattern means. So should I be using entries like:
--exclude '/home' ?
Robert Moskowitz wrote:
Robert wrote:
Robert Moskowitz wrote:
From the howto: http://www.faqs.org/docs/securing/chap29sec305.html
I got some ideas to help me to tar up the OS. I had already been shown how to wrap it into SSH to deposit the tar file on another system, so I tried the following:
tar cpvzf - -C / --exclude home --exclude media --exclude mnt --exclude proc --exclude */lost+found | ssh root@10.0.0.2 "cat>backup-060907.tgz"
But, whereas the howto is talking about --exclude dealing with files, the Centos Man on tar is saying that it applies to files.
So what is wrong? I know the SSH stuff is correct as when I put in something like ls I get a file with result of the ls. Also I had done this without the excludes and of course it died slowing when it got to /media/cdrom :(
I recall that before USB2, when tape backup made sense, I used an "exclude file" rather than doing it on the command line. I also remember that "/"s most definitely affect the outcome. I believe that if you'll look at the info pages (not man) for tar, you'll find a few examples buried in the document that will make the tar part of your puzzle crystal clear.
At the very end of info tar, it talks a LITTLE bit about -- exclude PATTERN.
I guess you have to know what pattern means. So should I be using entries like:
--exclude '/home' ?
O.K., I mounted my USB drive, went back in my archived stuff and found this "exclude" file: ----------------------------- [root@mavis ~]# cat /media/OT*/extra/FC1*/home/rj/nobackup /mnt /dev /proc /home/rj/mnt /media [root@mavis ~]# ------------------------ You can use this rather than several --exclude entries on the command by using the option -X <exclude-file-name>. Whatever suits you just tickles me plumb to death.
Robert wrote:
Robert Moskowitz wrote:
Robert wrote:
Robert Moskowitz wrote:
From the howto: http://www.faqs.org/docs/securing/chap29sec305.html
I got some ideas to help me to tar up the OS. I had already been shown how to wrap it into SSH to deposit the tar file on another system, so I tried the following:
tar cpvzf - -C / --exclude home --exclude media --exclude mnt --exclude proc --exclude */lost+found | ssh root@10.0.0.2 "cat>backup-060907.tgz"
But, whereas the howto is talking about --exclude dealing with files, the Centos Man on tar is saying that it applies to files.
So what is wrong? I know the SSH stuff is correct as when I put in something like ls I get a file with result of the ls. Also I had done this without the excludes and of course it died slowing when it got to /media/cdrom :(
I recall that before USB2, when tape backup made sense, I used an "exclude file" rather than doing it on the command line. I also remember that "/"s most definitely affect the outcome. I believe that if you'll look at the info pages (not man) for tar, you'll find a few examples buried in the document that will make the tar part of your puzzle crystal clear.
At the very end of info tar, it talks a LITTLE bit about -- exclude PATTERN.
I guess you have to know what pattern means. So should I be using entries like:
--exclude '/home' ?
O.K., I mounted my USB drive, went back in my archived stuff and found this "exclude" file:
[root@mavis ~]# cat /media/OT*/extra/FC1*/home/rj/nobackup /mnt /dev /proc /home/rj/mnt /media [root@mavis ~]#
You can use this rather than several --exclude entries on the command by using the option -X <exclude-file-name>. Whatever suits you just tickles me plumb to death.
Thanks. I could not find any clear reference to the entries in the --exclude-from file. And I figured out that the reason I was getting an empty archive was that -C option. I was telling tar to switch to directory / but not telling it what to tar! Actually, in this case, there was no reason for the -C. Taking it out got things working. One question I have is that every so often the -v is showing things like the following:
tar: Removing leading '/' from member names / /sbin /sbin/dump_cis /sbin/request-key /sbin/agetty
Well those were the first ones, and the reason I could catch those is at that point SSH prompted my for the remote user password.
If I watch the screen (without getting sick with the fast scrolling), I see other '/' being removed comments.
On Fri, 2006-09-08 at 14:28 -0400, Robert Moskowitz wrote:
Robert wrote:
Robert Moskowitz wrote:
Robert wrote:
Robert Moskowitz wrote:
<snip>
there was no reason for the -C. Taking it out got things working. One question I have is that every so often the -v is showing things like the following:
tar: Removing leading '/' from member names / /sbin /sbin/dump_cis /sbin/request-key /sbin/agetty
Well those were the first ones, and the reason I could catch those is at that point SSH prompted my for the remote user password.
If I watch the screen (without getting sick with the fast scrolling), I see other '/' being removed comments.
That is really what you want anyway. With a '/', you have absolute pathname and can't as easily recover into a "working" directory. With it removed, you have a "relative" path and can easily restore to a working or to the original directory.
As to your "seasickness", redirect stdout and stderr into a file. Then you can examine the file later, or tail it as it runs. Like so
tar <some junk> &>/tmp/tar.out # Puts norm and errors together or tar <some junk> >/tmp/normal.out 2>/tmp/error.out
as examples.
-- Bill
On Fri, 2006-09-08 at 14:28 -0400, Robert Moskowitz wrote:
Robert wrote:
Robert Moskowitz wrote:
Robert wrote:
Robert Moskowitz wrote:
<snip>
tar: Removing leading '/' from member names / /sbin /sbin/dump_cis /sbin/request-key /sbin/agetty
Well those were the first ones, and the reason I could catch those is at that point SSH prompted my for the remote user password.
If I watch the screen (without getting sick with the fast scrolling), I see other '/' being removed comments.
BTW, that means you really didn't do it "right". What you really wanted to do was cd to / (or use the C) and then tar up "." (no quotes). Then your file names would be like "./sbin/abc', './sbin,123', ... giving a relative pathname again. You could also do a tar with the -C and backup "*" (no quotes) but that would miss "hidden" files unless you took special steps.
As another step, tar and compress (if you have fast CPU and slow I/O, this helps) in "one step" or pipe tar output into bzip2 and get max compress. But this can get quite slow. Like Fridays on the CentOS lists (TG after that crap from yesterday).
<snip>
HTH -- Bill
William L. Maltby wrote:
As another step, tar and compress (if you have fast CPU and slow I/O,
tut tut:-) That's what the zed does in his original command.
Robert Moskowitz wrote:
If I watch the screen (without getting sick with the fast scrolling), I see other '/' being removed comments.
Try this. Note the trailing dot:-)
tar cpvzf - -C / --exclude home --exclude media --exclude mnt --exclude proc --exclude */lost+found .
On Fri, 2006-09-08 at 12:38 -0400, Robert Moskowitz wrote:
Robert Moskowitz wrote:
From the howto: http://www.faqs.org/docs/securing/chap29sec305.html
I got some ideas to help me to tar up the OS. I had already been shown how to wrap it into SSH to deposit the tar file on another system, so I tried the following:
tar cpvzf - -C / --exclude home --exclude media --exclude mnt --exclude proc --exclude */lost+found | ssh root@10.0.0.2 "cat>backup-060907.tgz"
But, whereas the howto is talking about --exclude dealing with files, the Centos Man on tar is saying that it applies to files.
So what is wrong? I know the SSH stuff is correct as when I put in something like ls I get a file with result of the ls. Also I had done this without the excludes and of course it died slowing when it got to /media/cdrom :(
I recall that before USB2, when tape backup made sense, I used an "exclude file" rather than doing it on the command line. I also remember that "/"s most definitely affect the outcome. I believe that if you'll look at the info pages (not man) for tar, you'll find a few examples buried in the document that will make the tar part of your puzzle crystal clear.
At the very end of info tar, it talks a LITTLE bit about -- exclude PATTERN.
I guess you have to know what pattern means. So should I be using entries like:
--exclude '/home' ?
I've always thought it was a lot more straightforward to make separate archives of each filesystem you want by cd'ing to the mount point and doing a 'tar --one-file-system -cvf /some/path/filesystem.tar . than to do it in one run trying to exclude any possible mount points you don't want.
Robert Moskowitz wrote:
From the howto: http://www.faqs.org/docs/securing/chap29sec305.html
I got some ideas to help me to tar up the OS. I had already been shown how to wrap it into SSH to deposit the tar file on another system, so I tried the following:
tar cpvzf - -C / --exclude home --exclude media --exclude mnt --exclude proc --exclude */lost+found | ssh root@10.0.0.2 "cat>backup-060907.tgz"
But, whereas the howto is talking about --exclude dealing with files, the Centos Man on tar is saying that it applies to files.
So what is wrong? I know the SSH stuff is correct as when I put in something like ls I get a file with result of the ls. Also I had done this without the excludes and of course it died slowing when it got to /media/cdrom :(
I know this works for me: tar clf homes.tar --exclude=scripts --exclude=conf --exclude=bin \ --exclude=incoming -C ${BASEDIR} .
but I had a completely garbage backup of my firewall, taken just before the disk died (I thought, briefly, how fortuitous my timing was!) using ssh that way.
The problem is, I have this alias: alias ssh='ssh -t' and the result of that is the shell (or something) injects the occasional screen control sequence, and my backup was cactus. Absolute junk.
The way to be sure is: tar cpvzf - -C / <more tar stuff> | \ssh <ssh stuff>
btw unless you have a very fast CPU and/or a slow link, it's faster without the compression.
You might also find it simpler to use the "l" switch as I do to avoid crossing filesystem boundaries; in your case it would automatically exclude /proc, /sys and anything mounted anywhere, such as /media, /home, /mnt. I do this: tar clC / / /boot /home /var \ | tar xpC /mnt/backup || { df -h ; exit ; }
I do have a list of exclusions (eg --exclude=/var/spool/postfix/), enough to cloud the issue:-)
This example's on Debian, and the buffer command's there in hopes of reducing head movement and so accelerating the process.