From nobody Tue Oct 03 16:24:36 2023 X-Original-To: freebsd-current@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4S0NSk4NRGz4wQvt for ; Tue, 3 Oct 2023 16:24:38 +0000 (UTC) (envelope-from des@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S0NSk3cWqz3cWB for ; Tue, 3 Oct 2023 16:24:38 +0000 (UTC) (envelope-from des@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696350278; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=b8SEGgTPl/mCXG/0WbMcpqbcejlUbbxZWNhVb5v2fKI=; b=bGuXeB9SsO3r7+ALMKbX77jZMZ00F46xh6VMiF8ydhw9vUkst9cSjT74hP06Ap/lvzFCAG /WzjMcZcFJH35e5uf5w/stYU9SbrVxjn0nxYNcdZrBCGSZ/0lbEEhWlEc/EUxFVunbKYLC YkWcA+/p3K4QsGlH7/La2x8K64XFFzgQjjEdtLocNqenNxeG/R8XVywWcLVedsRyZAglV9 FO9w53MuVyKcFPixasksENqQLkHo68+u3y4ciF+cwdr2kKE8xQn9bAhRz7HZfSMJfp+tUz ItCgJGYHr6J/fKWCmQDbGawdtZMn+YeHteVDK1mAET+N6bzGwCa/qFV0lO3KJQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696350278; a=rsa-sha256; cv=none; b=kuY7FX2bjEQiY7MfwGTCMaOlLSKi+PbKzzIgVMHpv2CCPUa3K4Bn50nJ2fSTPAra3Rodos ByltGVhX6Qhspeh8y0bY4CZDfIrNmQfB3be1OyxDTsaGxLDeVQyvGxK1LK6DiwbB+LTQnr eyPZV8ffnSTZlk0i6pwXlNMHzBuii3f2LZYXvq8KIfwDsBViajqSaXzdmUACxmiVE1ErF8 mBSfzq/jfZB79z6HyFVmH1m36bRUpQ4n1evm87cHliV/AVes4XkJ5kLLOHzA2tCMFeoc4G sCkW877FanXcejg14McbfHtFarA3pwypEsA5kkZMYRxMq3Dgu1zUToFCudrI7Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696350278; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=b8SEGgTPl/mCXG/0WbMcpqbcejlUbbxZWNhVb5v2fKI=; b=ERAof/BVkrQWTLapje81kIq59Z5xTZJmZGO/tAlemnrRI7UjOeRPH6DcnPuW0+nEA/lICA zHiDVYVhzYU1fEfaXdz7+F0/HXwUTLckZIIYQD5przW2m0XTgz/BllFZkfUxMMk/tdhRM4 aIdyLNS+bInr7Vw5+16xsTl8aMOuFNLKNCH3tUCbDR/uyByYjjVXlfB1VuN6lF6FiZyVF4 zdE58iEnALF39qhD7oZJ0wfwJIujERIXqoZSnQpgYfYPEBpB0WNW7auQ5NFAbDLRDyHtQO ybWD/VTvqEkbS0a8xzyV4u5eufhLphfIjhgnW5Ol0fZvEJ3izoJ+G0ja6djafg== Received: from ltc.des.no (2a02-8428-0993-f001-36e8-94ff-feca-9834.rev.sfr.net [IPv6:2a02:8428:993:f001:36e8:94ff:feca:9834]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: des) by smtp.freebsd.org (Postfix) with ESMTPSA id 4S0NSk0wLmz10xQ for ; Tue, 3 Oct 2023 16:24:38 +0000 (UTC) (envelope-from des@freebsd.org) Received: by ltc.des.no (Postfix, from userid 1001) id 692857137A; Tue, 3 Oct 2023 18:24:36 +0200 (CEST) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: freebsd-current@freebsd.org Subject: Re: something magic about the size of a ports tree In-Reply-To: (Matthias Apitz's message of "Tue, 3 Oct 2023 18:09:43 +0200") References: User-Agent: Gnus/5.13 (Gnus v5.13) Date: Tue, 03 Oct 2023 18:24:36 +0200 Message-ID: <86y1gjhdx7.fsf@ltc.des.no> List-Id: Discussions about the use of FreeBSD-current List-Archive: https://lists.freebsd.org/archives/freebsd-current List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-current@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Matthias Apitz writes: > I have on my poudriere build host a ports tree and wanted to move it to > the host where the resulting packages are installed: > > root@jet:/usr/local/poudriere/ports # du -sh ports20230806 > 397M ports20230806 > root@jet:/usr/local/poudriere/ports # tar cf p.tar ports20230806 > root@jet:/usr/local/poudriere/ports # ls -lh p.tar > -rw-r--r-- 1 root wheel 672M Oct 3 18:00 p.tar > > already the size of the tar file is somewhat magic; but if you un-tar it > on the other host I will get: > > [guru@c720-1400094 ~]$ ls -lh p.tar > -rw-r--r-- 1 guru wheel 672M 3 oct. 18:00 p.tar > [guru@c720-1400094 ~]$ tar xf p.tar > [guru@c720-1400094 ~]$ du -sh ports20230806 > 1,2G ports20230806 > > How this is possible? Most files in the ports tree are very small. On disk, each file gets rounded up to the nearest multiple of the filesystem block size, which could be as small as 512 bytes or as large as 8 kB (or even more in pathological cases). In a tarball, they get rounded up to the nearest multiple of 512 bytes plus an additional 512 bytes per file for metadata. For instance, your average distinfo file (of which there are 30k in the ports tree) is only 200-250 bytes long, but it occupies 512 bytes on an FFS filesystem, 1 kB in a tarball, and 4 kB on a typical ZFS filesystem. Note that if the target system is FreeBSD 14 or newer, you can simply mount the tarball (`sudo mount -rt tarfs p.tar /usr/ports`). DES --=20 Dag-Erling Sm=C3=B8rgrav - des@FreeBSD.org