Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 9 Jun 2012 08:57:33 -0700
From:      Tim Kientzle <tim@kientzle.com>
To:        Matthias Apitz <guru@unixarea.de>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: cleaning /usr/obj before copying it to USB key
Message-ID:  <79C2B8B9-9A7E-4793-AE03-FE387BB1694B@kientzle.com>
In-Reply-To: <20120609143521.GA3940@tinyCurrent>
References:  <20120609143521.GA3940@tinyCurrent>

next in thread | previous in thread | raw e-mail | index | archive | help
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.




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?79C2B8B9-9A7E-4793-AE03-FE387BB1694B>