How copy /usr contents to a new partition?

Jeff Vian jvian10 at charter.net
Sat Jan 14 13:52:30 UTC 2006


On Sat, 2006-01-14 at 17:16 +0800, John Summerfied wrote:
> Parameshwara Bhat wrote:
> > Hello List,
> > 
> > I want to copy /usr to a new partition and then attach that at /usr. I  
> > issued a command
> > 
> >     cp -options(recursive included) /usr /mnt/"mountpoint
> > 
> > This resulted in the creation of a new "usr" directory under  
> > /mnt/"mountpoint"/usr and contents of /usr went into sub-directories. 
> > What  I want is to copy all the subdirectories and files directly under 
> > /usr to  go at /mnt/"mountpoint" for obvious reasons. How do I do that? 
> > "Man cp"  did not give me any clue.
try a simpler command
    cp -a /usr/* /mnt/mountpoint

What you did was copy /usr and all its contents to the new location.
What you wanted was to copy all the contents of /usr to the new
location.

The -a option does the recursive/permissions/preserve link.
       -a, --archive
              same as -dpR

Note, that if the source has any hidden files (names beginning with
a . ) you will have to account for that and cannot use /usr/* by itself.
However, AFAIK there are no .files in /usr so the command I gave above
would work for you.

> cp never seems to do what I want, so I'd
> sudo -s
> tar clC / usr | tar xpC /mnt/mountpoint
> 
> which has the great merit of being easily extended to copy between machines:
> tar clC / usr | \ssh otherbox tar xpC /mnt/mountpoint[1]
> 
> and of course one can compress or not.
> 
> > 
> > Also, is there a command which compares each file under two directory  
> > trees for difference.(I want to verify after the above operation)
> 
> diff
> 
> 
> 1
> I got caught one or twice: I have set ssh to an alias:
> alias ssh='ssh -t'
> and that breaks piping stuff across the network. Use of the backslash 
> prevents use of the alias.
> 
> 
> 
> -- 
> 
> Cheers
> John
> 
> -- spambait
> 1aaaaaaa at computerdatasafe.com.au  Z1aaaaaaa at computerdatasafe.com.au
> Tourist pics http://portgeographe.environmentaldisasters.cds.merseine.nu/
> 
> do not reply off-list
> 




More information about the fedora-list mailing list