On Thu, Dec 19, 2013 at 02:40:43PM -0800, John Jason Jordan 
Quoting someone:
> >I doubt Clonezilla cares about the presence (or absence) of a
> >bootloader, but I could be wrong.  I've always used tar to migrate
> >from one hard drive to another:
> >
> >1. Boot from the installer disc (rescue mode, again!).
> >2. Create a file system on the new partition.
> >3. Mount both the old and new file systems.
> >4. Copy the contents of the old file system to the new file system
> >   with tar::
> >
> >    cd /path/to/new/filesystem
> >    tar -cC /path/to/old/filesystem . | tar x

And then wrote:
> I don't understand this tar command. I tried to figure it out from man
> tar, but I still don't understand it:

So make a couple of temporary directories to learn what this does:

    mkdir old
    mkdir new

copy some files to old, just a handful of small files, this is a learning 
excercise

    cp <STUFF> old

cd to "new"

    cd new

run the tar command and see what happens

    tar -cC ../old . | tar x

On my system, what I created as an example to double, triple check I was not 
about to lead you astray:
Right before I did the cd new and tar command:


    michael@bivy ~/sql_school % ls -R
    .:
    exercise_threejoin2  facility_hours_max  facility_revenue_2  
further_reading  new/  old/  sub_query_example

    ./new:

    ./old:
    exercise_threejoin2  facility_hours_max  facility_revenue_2  
further_reading  sub_query_example

And then I ran the tar command line and the contents of old were replicated 
into new.


> 1) What should I use for /path/to/new/filesystem

The directory where you want the files to end up

> and /path/to/old/filesystem? 

The directory where you want to copy the files from.

> 2) Create a file system means using mkfs, right? More reading man pages?

You're not making a new filesystem, ignore this.

> 3) The -cC means create an archive, right? I just want to copy files.

the -c means create an archive
the -C means before you start to make that archive cd to specified path 
the (IMHO badly named example) /path/to/old/filesystem.

When you untar an archive into a new place you have effectively copied the 
files, hence the suggestion.


> 4) What do the . | tar x do? I couldn't find these in the man page.

The . in the context of `tar -c `  means make an archive of the current 
directory.
tar will recurse into all the subdirectories. 

But where will it make the archive?  Well, since you didn't specify it will 
make it on STDOUT

which brings us to `| tar x`

| - pipe the STDOUT of the previous stuff into whatever comes next
tar x - extract a tar archive, but default STDIN - what it receives from the 
pipe


So piece by piece with comments:

   tar -c                     # creat a new archive
   tar -cC                    # cd somewhere before starting to make the archive
   tar -cC /path              # where to cd to (shortened)
   tar -cC /path  .           # what to tar up, the "current" directory, the 
one you just cd'd into
   tar -cC /path . |          # send the command output to ... (tar will output 
the archive to STDOUT)
   tar -cC /path . | tar      # another tar command 
   tar -cD /path . | tar x    # that will extract the archive being fed to it 
by the pipe.

So it's a place to place copy.  


> I am leery of using commands I don't understand, especially considering
> what a disaster I could create if I do it wrong.

So, as I demoed above create a couple of test directory trees and play with it 
until you do understand.

 
-- 
            Michael Rasmussen, Portland Oregon  
          Be Appropriate && Follow Your Curiosity
  Other Adventures: http://www.jamhome.us/ or http://gplus.to/MichaelRpdx
A special random fortune cookie fortune:
You don't have to be fast if you are fiercely persistent.
        ~  Kent Peterson
_______________________________________________
PLUG mailing list
[email protected]
http://lists.pdxlinux.org/mailman/listinfo/plug

Reply via email to