A computer's file system is the data structures and way it stores, retrieves and updates any files contained in that machine. It allows users to name files and attach attributes to them as well as organizing them in directories (folders) and subdirectories. Modern file systems allow large filenames and can accommodate many unusual characters, but there are still some exceptions that cannot be used in filenames due to conflict with the syntax of the system. The term can refer to both the abstract data structures (trees, hash tables, heaps, etc.) or the implementations of those abstractions in the software/firmware themselves. Files can be stored and file systems used locally in a device's data storage components, through a network protocol or virtually, whereupon files are transferred upon request from off-site devices, or in the case that the files are simply a mapping to a different file system.
Space allocation to files is done in a granular manner by most file systems using physical units on the device. A major part of this space organisation is keeping track of which areas belong to which files and which are free entirely. When the space in memory required by a file does not fit neatly into a multiple of the allocation unit, the spare space is called slack space. Slack space can be minimized by picking an allocation unit size by looking at the average size of the kinds of files you are expecting your system to have to accommodate.
Fragmentation of files occurs when they must be stored in more than one place. For example, if there is not enough memory available consecutively upon their creation for their expected size, or if they expand over their lifetimes beyond the space allocated to them, files may be stored non-contiguously. Too many fragmented files will lower system performance.