+----+----+----+----+----+ | |XXXX|XXXX|XX**| | +----+----+----+----+----+ | | = Disk block XX = File ** = Wasted space #### use POSIX qw( ceil ); $filesize = ceil($filesize / BLOCK_SIZE) * BLOCK_SIZE; #### # Space for directories. No idea what's reasonable. use constant DIR_BUF => 64*1024; use constant DVD_CAP => 4707319808 - DIR_BUF;