20 file systems of:
/fs01 /fs02 /fs03 ... /fs20
in my Unix environment. Each of these file systems, contains some free space, which I can use for saving files. These file systems are independent of each other, and each contain a different amount of free space.
100 files of different sizes on another host and I want to place each of these files in any of the available locations. Obviously, after a file is placed on a specific file system, the amount of available free space on that particular file system will be reduced by the file size.
I am looking for an efficient way of doing this; i.e. an algorithm which gets the above data as input and give me a mapping like:
/fs01 <- f1,f10,f29 /fs02 <- f5,f30 /fs03 <-nothing here. too small. ... /fs20 <- f89,f100
file 2, etc. Do you think if there is such an algorithm?