From owner-freebsd-questions@freebsd.org Wed Nov 30 10:24:33 2016 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D94E9C5DDDD; Wed, 30 Nov 2016 10:24:33 +0000 (UTC) (envelope-from rfg@tristatelogic.com) Received: from outgoing.tristatelogic.com (segfault.tristatelogic.com [69.62.255.118]) by mx1.freebsd.org (Postfix) with ESMTP id C1298105F; Wed, 30 Nov 2016 10:24:32 +0000 (UTC) (envelope-from rfg@tristatelogic.com) Received: from segfault-nmh-helo.tristatelogic.com (localhost [127.0.0.1]) by segfault.tristatelogic.com (Postfix) with ESMTP id 9D8F33AF79; Wed, 30 Nov 2016 02:18:57 -0800 (PST) From: "Ronald F. Guilmette" To: freebsd-questions@freebsd.org, freebsd-fs@freebsd.org Subject: Calculating size of a corresponding ISO9660+UDF image? Date: Wed, 30 Nov 2016 02:18:57 -0800 Message-ID: <25788.1480501137@segfault.tristatelogic.com> X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Nov 2016 10:24:34 -0000 I just got my first BluRay burner & a ton of blank single-sided BD-R media, so I want to start using these for making backups of most or all of the stuff I have on hard drives, which is a lot. But efficiently splitting up all of my stuff into nice neat little <25GB bundles seems like it might be a bit of tricky problem for two reasons. (See below.) (If I can't find anything off-the-shelf that will do this job for me, then I plan to roll my own, either in Perl or C.) The burning itself is no problem. I plan to use Imgburn. It is well regarded, and it's always worked well for me. The real problem is one that I have arguably created for myself... I never want to have to read multiple burnt optical disks in order to retrieve a single desired file from my backups. So I never want to split any individual input file across multiple backup volumes. Given that small limitation, I am faced with these two modest technical problems: 1) How to perform "bin packing" to get as many files onto each blank BD-R disk as possible without exceeding the 25GB limit. (This "bin packing" is said to be an NP-hard problem, but I'll muddle through this part somehow, even if I end up having my program just try all possible packings. I wasn't in a hurry anyway. :-) 2) How to calculate exactly how much space in the proposed ISO9660+UDF image the files that have so far selected for inclusion will actually occupy. Really, it is just this second problem that I care about at the moment. So, can anybody tell me the magic formula which, when given a set of on-harddisk files and directories, will calculate exactly how big that set of input files/directories will be, once they are all rendered into a single corresponding ISO9660+UDF image? If anybody can tell me how to do this calculation, please proceed. I'd really rather not have to get down on my hands and knees and spend time groveling around in the bowels of the FreeBSD optical disk drivers in order to find this information if I can avoid it. I mean it can't be THAT complex, now can it? Regards, rfg P.S. This whole problem... especially the "bin packing" part... feels like something that somebody else... or maybe a lot of somebody elses... must have already solved a long long long time ago, and probably many times. So maybe I just need to find and resuscitate some of those old solutions. I mean we've been making backups to finite and predictable length tapes for at least 50 years now, and I can't be the first guy to have ever said that I don't want to split files across multiple backup volumes. So where's the off-the-shelf open source freeware to solve the bin packing problem for backup tapes? I'm not proud. I'll just re-use that code, thank you very much.