Best way to copy /usr to different partition?

Daniel B. Thurman dant at cdkkt.com
Fri Dec 7 20:35:08 UTC 2007


Tony Nelson wrote:
>Sent: Friday, December 07, 2007 8:43 AM
>To: fedora-list at redhat.com
>Subject: Re: Best way to copy /usr to different partition?
>
>
>At 10:43 PM -0500 12/6/07, Kevin J. Cummings wrote:
>>Daniel B. Thurman wrote:
>>> I was getting dangerously close to running out of disk space
>>> since /usr was filling up fast.
>>>
>>> I thought it was simple to tar-copy /usr to a different 
>drive/partiton
>>> using tar copy such as:
>>>
>>> (cd /usr; tar cpf - .) | (cd /newpartition; tar xpf -)
>>
>>using tar doesn't copy the extended attributes used by SELinux. ...
> ...
>
>`man tar` shows the --xattrs and --no-xattrs options (though 
>`man tar` and
>`info tar` don't say what the default is), so tar should work 
>for EAs if
>used with --xattrs.
>-- 
>____________________________________________________________________
>TonyN.:'                       <mailto:tonynelson at georgeanelson.com>
>      '                              <http://www.georgeanelson.com/>
>
>-- 

I have discovered that using:

(cd /usr-b; tar -cp -xattrs -f - .) | (cd /usr; tar -xp --xattrs -f -)
OR
(cd /usr; cp -pR /usr-b/. .)

did not preserve the selinux attributes.

I have checked the attributes in /usr-b/lib/libsysfs* and
it has lib_t assigned to these files against the copied files
/usr/lib/libsysfs* and it shows default_t instead of lib_t.

This may mean that my entire /usr filesystem has improper
selinux attributes.

Can someone tell me how to copy the files from my original
/usr-b filesystem to /usr filesystem with the selinux attributes
intact?

No virus found in this outgoing message.
Checked by AVG Free Edition. 
Version: 7.5.503 / Virus Database: 269.16.17/1176 - Release Date: 12/6/2007 11:15 PM
 




More information about the users mailing list