From owner-freebsd-questions@FreeBSD.ORG Tue Sep 6 14:59:06 2011 Return-Path: Delivered-To: questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 04742106566C for ; Tue, 6 Sep 2011 14:59:06 +0000 (UTC) (envelope-from joeb1@a1poweruser.com) Received: from mail-03.name-services.com (mail-03.name-services.com [69.64.155.195]) by mx1.freebsd.org (Postfix) with ESMTP id DDBF28FC1F for ; Tue, 6 Sep 2011 14:59:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; q=dns/txt; s=DKIM-NAME-SERVICES; d=a1poweruser.com; h=From:To:Cc:Subject:Message-ID:X-Sender:X-Envelope-From; l=500; bh=ChCJrYjaO2L8EgEFxWVOJJCnjOSYRMR8MqOthxx0IQw=; b=aaJEiT/u4e+07tVg2qqSq1zgtsqEYhPJNzkcD2XLOX6BJifSaIiWbA665r9784stW+o/ZCEm6U8WLPgKEyHhH98VLZC68x71GjV0c+xJPIfeEENEsKe2BkYqSyY0fLFf488CRFrGwgso+3wP0Vn3ypN76j7rgZS1XdG/gK3gp5U= Received: from laptop ([76.240.47.196]) by mail-03.name-services.com with Microsoft SMTPSVC(6.0.3790.4675); Tue, 6 Sep 2011 07:59:01 -0700 From: "joeb1" To: "Questions@Freebsd. Org" Date: Tue, 6 Sep 2011 10:59:05 -0400 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.6604 (9.0.2911.0) X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6090 Importance: Normal X-OriginalArrivalTime: 06 Sep 2011 14:59:01.0773 (UTC) FILETIME=[83741BD0:01CC6CA5] X-Sender: joeb1@a1poweruser.com X-Envelope-From: joeb1*a1poweruser.com Cc: Subject: FW: cpio command and schg flags X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: joeb1@a1poweruser.com List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Sep 2011 14:59:06 -0000 > 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