Finally got our first email response to this blog. Not bad since it's still pretty much in it's beginning stages. I'll paraphrase the question below.
Q: I've got to move some huge .dbf files off of a 400gb partition (larger than other free slices) to make more space for the DBA's. Only problem is I've got 70% utilization on the partition. Tarring all of them at once doubles my disk space usage (which is impossible) and doing them one by one might not even be possible. How can I archive and move content under these sorts of conditions?
A: Since you're used to using tar already, here's a trick a lot folks don't know or just have never used. It'll work so you don't have to take up any extra space on your partition or any other.
What you'll want to do is use the "-" argument to tar and you'll be able to move the files to another partition or another machine without taking up any additional space.
To move a file from one location to another on the same machine, do this (I'm assuming you're in the directory the files are located. Just switch the absolute path and empty path (.) if you prefer to do it the other way. Also, of course, you could use * to tar up everything).
From partition to partition on a single host (if you like some output you can add v to the arguments for tar on either side of the pipe - if you do it on both you'll get a lot of output you probably don't want - up to you):
tar cpf - filea fileb filec|(cd /that/other/partition;tar xpf -)
From a partition on the local host to a remote host (again, you can reverse the path - in this case host:/directory/name - if you want or need to do it the other way):
tar cpf - filea fileb filec|ssh remotehost "cd /remote/partition;tar xpf -"
Basically you're creating your tar to standard output, and then passing it through a pipe (|) which converts the first command's standard output into the standard input of the next command. In this case, your untarring from standard input. Now, hopefully, your files are somewhere more manageable and you didn't need to take up any extra space to do the move.
Note that (on localhost to localhost) the parantheses are important around the second command, since they run them both in a subshell. If you were to remove the parantheses, your standard output would be fed to the "cd" command and tar would have nothing to extract. The same principle applies for using double-quotes with ssh (or rsh)
Hope this helped :)
linux unix internet technology
Thursday, October 4, 2007