FW: [GOLUM] HD Question

Hershberger, Robert T Mr (CPF N63RTH) HershbRT at cpf.navy.mil
Mon Aug 20 19:07:24 PDT 2001


Charles,

  Alright I followed that mostly.  So I start out by changing into ../test
and kick the tar off using the PWD as source, and directing it to stdout.
Then I jump the net (follow the pipe), change into ../newHD/test and then
grab the stdIN and dump it to the hard drive, now using the PWD of
../newHD/test.
  It also helped that I ran the command against a test HD and saw it in
action and what it was doing.  Hands on is always good.  Ok Thanks for the
help also, and have a good day.

Robert Hershberger




-----Original Message-----
From: epsas at inflicted.net [mailto:epsas at inflicted.net]
Sent: Friday, August 17, 2001 01:14 PM
To: Linux & Unix Advocates & Users
Subject: [luau] Re: FW: [GOLUM] HD Question


Rob, 

I'll spare you the 2x4 - since I've been laid off, I've found it's harder to
pay for injury claims caused by the more conventional information packing
tools. - I'll give you a textual rundown on how that command line works
instead:

	$ cd /home/rob/test; tar -cvpf - ./ | (cd /mnt/newHD/test; tar -xvpf
-)

'Okay, what is happening here?'  

    The basic idea behind this tar command is to: first, Create an archive
and output it to stdout ('tar -cf - '); and then to eXtract the archive
piped through stdin (`tar -xf -`).   The hyphen used in the place of a
filename (foo.tar) orders tar to process an archive as either a stream from
stdin, or to stdout.

	$ tar -xf - ./ | tar -cf -

    Using tar to archive and extract files through a pipe is not very useful
unless you find a way to move your Present Working Directory (PWD) to a new
location in your filesystem; `tar -cf - ./|tar -xf -` is one way to get
yourself nowhere, (not so) quick...  One way to change your PWD is by using
the `cd` command to change your location in the filesystem BEFORE you begin
the archive eXtraction process.  This can be done by creating a Compound
Command by using parentheses (list); where 'list' is the sequence of
commands that you wish to execute.     
    


I hope that this helps you out a little bit.  Tar is the best way to copy
heinous amounts of data between filesystems, and compound shell commands are
always good party tricks to have in your Unix repertoire.

Also, I'll be looking for a good FAQ or HOWTO on using `dd` to duplicate
partition information on heterogenous hard drives.  I know how to do it, but
I do not want to give you advice that I cannot first test on my own
hardware- and I do not have a spare drive installed on my machines.

Adidas,
Charles



More information about the LUAU mailing list