Real size of a file in a filesystem … 

Newsgroups: comp.os.linux.misc

My task is to divide myriads of files into subsets to burn them on a bunch of cdroms. For this I use mkisofs (to create a joliet-iso-filesystem) and I want to find a way to calculate the space a certain file or directory will take in the isofs later.

I guess, the size I get reported from the system is not the size the file acutally needs on the media and then it will need some place in the directory-table and more.

What I want now, is a fast method to estimate this 'real' size of a file as good as possible and on the other hand I would be interested in a deep- sight background of all this stuff. I read the filesystems-howto but didnt found the information I am looking for.

thanx for any hints, links and informations,

peter

Real size of a file in a filesystem … 

> Would the du (man du) command do what you need?

Unfortunately not. du calculate the needed diskspace on the current filesystem (reiserFS or ext2), but not its space on the target-filesystem (joliet-iso9660). On the other hand du is very usefor for calculating the space for a folder and its subfolder, but no use for calculating the space for 100.000nds of files seperately, which is what I need.

thanx a lot, peter

Real size of a file in a filesystem … 

> In my experience of making ISO images, I never have more than 500k of
> overhead.  I normally use the output of du and add 500k to it to do
> the estimate.  It comes very close.  If I have to add more, I just
> recreate the ISO file.  It does not take long to regenerate an ISO
> image.  I use a slow machine (Sparc5 85MHz cpu).  It takes about 12-14
> minutes to make an 650MB ISO image.  Don't forget 650MB is 681574400
> bytes and 700MB is 734003200 bytes.  If your cpu is faster than mine,
> you can afford to recreate as often as you need.

I have 24 gigs of files, seperated in about 80.000 files from 1k to 500M. I want to create 38 iso-images that holds all this files to burn it on cd. If I just copy them just as the files come in, I would need much more cd's, so I need to find out a perfect compiliation.

For this I want to take a file, calculate the exact size it will have in the iso-image and 'throw' it in the iso-image it fits best. (actually I create a symlink and run later mkisofs)

So du is no help for my task. And when adding 12.000 files in one iso- image the overhead is much greater.

thnx, peter

Real size of a file in a filesystem … 

The space occupied by each file is the file size rounded up to a multiple of 2048 bytes.

It is much harder to estimate the space taken by the directory entries - although it is unlikely to be more than 1 or 2% of the whole CD (even with 12000 files). The only way to get the exact size is to run mkisofs with the -print-size option.

There is something called "cdburn" which is a wrapper to mkisofs/cdrecord that designed to store data on multiple CDs. I've never used it, but it may help.

James Pearson

>> 2001.04.12 Thu 15:59:26