Friday, July 24, 2009

Disk Spanning

If you've read my last post, you'll already have some background on the program that I'm going to use to demonstrate an awesome side effect of that particular program(mhddfs). If you haven't, read it now and then come back to this post.

This is an easy 4 step process.

This is the (hypothetical, I don't need it myself) situation: I've got 20GB of data that I need to burn to DVD(4.7GB single layer discs) and I can't find a no-nonsense tool to split up this data logically so that I can burn all of the data using as much space as possible.

Step 1: Create enough 4.7GB disk images to fit 20GB of data(around 5) and mount them. Note the paths where they're mounted at.

Step 2: Bind them all together using mhddfs.

Step 3: Copy all of the data to burn into the mhddfs mounted volume.

Step 4: Unmount all of the volumes/images and burn the contents of the images onto DVDs.

(optional) Step 5: Profit!

Problem solved.

It actually works really well for DVDs because of the way mhddfs decides where to place files. Its default behaviour is to use the next lowest priority folder when the current priority's size has reached approximately 4.2GB. Eg. You drop 1,000 equally sized files totalling 4.4GB onto the mhddfs volume(2 images, 4.7GB each. A has priority 1, B has 2), around 950 make their way to A and the rest get pushed over to B. Note that this value can be changed in the mount options so if you want to use more of the image, consult the manual page/readme to find the option(specified in bytes if I remember correctly).