Taken from Foreword: When migrating from another operating system such as Microsoft Windows to another; one thing that will profoundly affect the end user greatly will be the differences between the filesystems. What are filesystems?
A filesystem is the methods and data structures that an operating system uses to keep track of files on a disk or partition; that is, the way the files are organized on the disk. The word is also used to refer to a partition or disk that is used to store the files or the type of the filesystem. Thus, one might say I have two filesystems meaning one has two partitions on which one stores files, or that one is using the extended filesystem, meaning the type of the filesystem.
The difference between a disk or partition and the filesystem it contains is important. A few programs (including, reasonably enough, programs that create filesystems) operate directly on the raw sectors of a disk or partition; if there is an existing file system there it will be destroyed or seriously corrupted. Most programs operate on a filesystem, and therefore won’t work on a partition that doesn’t contain one (or that contains one of the wrong type).
Before a partition or disk can be used as a filesystem, it needs to be initialized, and the bookkeeping data structures need to be written to the disk. This process is called making a filesystem.
Most UNIX filesystem types have a similar general structure, although the exact details vary quite a bit. The central concepts are superblock, inode, data block, directory block, and indirection block. The superblock contains information about the filesystem as a whole, such as its size (the exact information here depends on the filesystem). An inode contains all information about a file, except its name. The name is stored in the directory, together with the number of the inode. A directory entry consists of a filename and the number of the inode which represents the file. The inode contains the numbers of several data blocks, which are used to store the data in the file. There is space only for a few data block numbers in the inode, however, and if more are needed, more space for pointers to the data blocks is allocated dynamically. These dynamically allocated blocks are indirect blocks; the name indicates that in order to find the data block, one has to find its number in the indirect block first.
Like UNIX, Linux chooses to have a single hierarchical directory structure. Everything starts from the root directory, represented by /, and then expands into sub?directories instead of having so?called ‘drives’. In the Windows environment, one may put one’s files almost anywhere: on C drive, D drive, E drive etc. Such a file system is called a hierarchical structure and is managed by the programs themselves (program directories), not by the operating system. On the other hand, Linux sorts directories descending from the root directory / according to their importance to the boot process.
If you’re wondering why Linux uses the frontslash / instead of the backslash \ as in Windows it’s because it’s simply following the UNIX tradition. Linux, like Unix also chooses to be case sensitive. What this means is that the case, whether in capitals or not, of the characters becomes very important. So this is not the same as THIS. This feature accounts for a fairly large proportion of problems for new users especially during file transfer operations whether it may be via removable disk media such as floppy disk or over the wire by way of FTP.
- Linux Filesystem Hierarchy [ 1.1. Foreword ~ 1.2. The Root Directory ~ 1.3. /bin ~ 1.4. /boot ~ 1.5. /dev ~ 1.6. /etc ~ 1.7. /home ~ 1.8. /initrd ~ 1.9. /lib ~ 1.10. /lost+found ~ 1.11. /media ~ 1.12. /mnt ~ 1.12.1. Mounting and unmounting ~ 1.13. /opt ~ 1.14. /proc ~ 1.15. /root ~ 1.16. /sbin ~ 1.17. /usr ~ 1.18. /var ~ 1.19. /srv ~ 1.20. /tmp ]
- Appendix A. UNIX System V Signals
- Appendix B. Sources
- Appendix C. About the Author
- Appendix D. Contributors
- Appendix E. Disclaimer
- Appendix F. Donations
- Appendix G. Feedback
This Linux guide is available FREE at