Best way to copy /usr to different partition?

Karl Larsen k5di at zianet.com
Fri Dec 7 22:44:03 UTC 2007


Daniel B. Thurman wrote:
> 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
>  
>
>   
    I think the best thing from the selinux point of view is to turn off 
selinux while doing the copy and then when done and checked out turn it 
back on and wait while selinux re-inserts it's stuff.



-- 

	Karl F. Larsen, AKA K5DI
	Linux User
	#450462   http://counter.li.org.




More information about the fedora-list mailing list