Re: How copy /usr contents to a new partition?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 2006-01-13 at 01:50, Parameshwara Bhat wrote:

> 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.

I usually cd into the directory to be copied and use "." as
the source:
cd /usr
cp -a . /mnt/mntpoint/usr
since that eliminates the question of whether it will create
a new directory under what you specify.
Cp -a will take all the normal unix attributes (owner, modes, etc.)
but not acls or the extended attributes for SELinux.  If you need
those, I think the current version of dump |restore is supposed
to get them, at least on ext3 filesystems.

> Also, is there a command which compares each file under two directory  
> trees for difference.(I want to verify after the above operation)

Rsync will work - and it can be used for the copy as well although
it consumes a bit more memory than cp.
cd /usr
rsync -av . /mnt/mntpoint/usr
if you repeat the rsync command it will check and update anything
that doesn't match.  If you add -n it won't actually do the copy
but because of the -v it will report the filenames that would
be changed if you hadn't used -n.

-- 
  Les Mikesell
   lesmikesell@xxxxxxxxx



[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux