From owner-freebsd-hackers@FreeBSD.ORG Sat Jun 9 16:24:52 2012 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 88E44106566C for ; Sat, 9 Jun 2012 16:24:52 +0000 (UTC) (envelope-from tim@kientzle.com) Received: from monday.kientzle.com (99-115-135-74.uvs.sntcca.sbcglobal.net [99.115.135.74]) by mx1.freebsd.org (Postfix) with ESMTP id 5A9728FC12 for ; Sat, 9 Jun 2012 16:24:52 +0000 (UTC) Received: (from root@localhost) by monday.kientzle.com (8.14.4/8.14.4) id q59FvYpc041748; Sat, 9 Jun 2012 15:57:34 GMT (envelope-from tim@kientzle.com) Received: from [192.168.2.143] (CiscoE3000 [192.168.1.65]) by kientzle.com with SMTP id 57k8rps854pk38vgqyuu6yks42; Sat, 09 Jun 2012 15:57:34 +0000 (UTC) (envelope-from tim@kientzle.com) Mime-Version: 1.0 (Apple Message framework v1278) Content-Type: text/plain; charset=windows-1252 From: Tim Kientzle In-Reply-To: <20120609143521.GA3940@tinyCurrent> Date: Sat, 9 Jun 2012 08:57:33 -0700 Content-Transfer-Encoding: quoted-printable Message-Id: <79C2B8B9-9A7E-4793-AE03-FE387BB1694B@kientzle.com> References: <20120609143521.GA3940@tinyCurrent> To: Matthias Apitz X-Mailer: Apple Mail (2.1278) Cc: freebsd-hackers@freebsd.org Subject: Re: cleaning /usr/obj before copying it to USB key X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Jun 2012 16:24:52 -0000 On Jun 9, 2012, at 7:35 AM, Matthias Apitz wrote: >=20 > To use the (booted) USB key later to install other laptops or netbooks = I > enrich the key with /usr/src and /usr/obj as: >=20 > # cd /usr > # cp -Rp src /mnt/usr > # cp -Rp obj /mnt/usr >=20 > my problem is that the both 'cp -Rp ...' commands takes many hours (12 > and six hours) because they are transferring a lot(!!!) of small = files; As someone else pointed out, flash drives are pretty slow when making a lot of small writes. You can speed things up a lot by creating the image locally then copying the image to USB. Here are parts of a shell script I've been using for something similar: # Create an empty file IMG_SIZE bytes dd if=3D/dev/zero of=3D${IMG} bs=3D1 seek=3D${IMG_SIZE} count=3D0 # Attach it as a virtual disk device MD=3D`mdconfig -a -t vnode -f ${IMG}` # Partition the virtual disk gpart create -s MBR ${MD} gpart add -t freebsd ${MD} gpart set -a active -i 1 ${MD} # Format and mount newfs ${MD}s1 >/dev/null mount /dev/${MD}s1 /mnt =85 copy stuff =85 # Unmount and detach the virtual disk umount /dev/${MD}s1 mdconfig -d -u ${MD} # Copy the disk image to your flash drive dd if=3D${IMG} of=3D${SDCARD} bs=3D8m > I have had a look into /usr/obj and it seems that after 'makeworld' = and > 'makekernel' there are left over a lot of temporary files from the = build > processes... >=20 > is there a clean way to remove those files before 'cp -Rp obj = /mnt/usr' > while the result is still useful for another make install with = DESTDIR=3D/mnt ? You can delete all of the '.o' files using a command like this: find /usr/obj -name '*.o' | xargs rm With a little experimenting, you should be able to extend this to remove most of the intermediate files.