July 6, 2011

fsl.pack.isos: Builds ISOs By Adding File Sizes

perl

Backing up large data sets to DVD-ROM or (God Forbid!) CD-ROM can be quite frustrating. When this has been a requirement for me I dreaded sifting through the data, attempting to find a logical place to split the data between disks. Often times the disk size limitations doesn’t allow me to split the information at logical bounds (such as splitting on top level folders etc.) In the end I inevitably am forced to try and pack as much data as possible onto each disk. This gets even more frustrating. So I wrote fsl.pack.isos.fsl.pack.isos is a small Perl script that iterates over directories and files, first weeding out any symbolic links. Next it parses this output to create “graft-point” text files by adding the file sizes of each file until it reaches a defined size (the size of our storage medium.) Lastly, using genisoimage (mkisofs) it passes these graft files in and builds the ISOs. This means that obviously you need genisoimage installed on your system. (Note there are several places online where you can get a windows binary for mkisofs. Simply edit the last few lines of the file and you are in business.)

To execute this script you would type something like this:

perl ./fsl.pack.iso /path/to/folder1 /path/to/file1 /path/to/folder2

As simple as this seems I have found some great uses for this script. I maintained a server system once which took regular scheduled backups but did not have access to an external storage. It was determined that the data would periodically have to be archived to disk. A slight modification to the script and every cycle I would receive an email from the archive job with these (slightly altered/specially crafted) graft files attached. I would mount the remote share and pass these graft files into genisoimage installed locally on my system – then piping the output into wodim (cdrecord) and archiving the files to disk without making a trip to the data center. Hopefully it proves useful to someone else.

 

 

Read more from fsl.pack.isos, Perl

Share your thoughts, post a comment.

You must be logged in to post a comment.