cpio command and schg flags

Fbsd8 fbsd8 at a1poweruser.com
Tue Sep 6 23:58:45 UTC 2011


> 
>> I am trying to use this code sequence to clone a directory tree.
>> mkdir /usr/test1
>> cd /var
>> find . | cpio -dmp  /usr/test1
>>
>> The result is  /usr/test1 gets populated with the directory tree but
>> all the schg flags get stripped off.
>>
>> How can I keep the schg flags in the cloned directory?
> 
> Did you copy under root? BSD cpio unlike GNU cpio does preserve file flags.
> 
>   $ cpio --version
>   bsdcpio 2.8.4 -- libarchive 2.8.4
> 
>   $ find /lib | sudo cpio -dmp test
>   56525 blocks
> 
>   $ ls -lo test/lib | awk '$5 != "-"'
>   total 15595
>   -r--r--r--  1 root  wheel  schg 4440677 Sep  5 22:24 libc.so.7
>   -r--r--r--  1 root  wheel  schg  131655 Sep  5 22:24 libcrypt.so.5
>   -r--r--r--  1 root  wheel  schg  592241 Sep  5 22:24 libthr.so.3
> 

I am running release 8.2 and
    $ cpio --version  returns
    bsdcpio 2.7.0 -- libarchive 2.7.0

This version seems not to copy the schg flag

maybe cpio got upgraded in release 9.0 which you must be running.



More information about the freebsd-questions mailing list