What is Making a filesystem?
Making a filesystem is the technical process of initializing a partition or disk so that it can be used to store and organize files. Before this process occurs, a disk is simply raw storage space that most programs cannot use.
πΊοΈ The Purpose: Writing the "Map"
When you make a filesystem, the operating system writes bookkeeping data structures onto the physical sectors of the disk. These structures act as a master map that allows the computer to keep track of where files begin and end.
The central components created during this process include:
The Superblock: This contains high-level information about the entire filesystem, such as its total size.
Inodes: These are individual maps for every file. An inode stores everything about a fileβlike permissions and timestampsβexcept for its name.
Data Blocks: These are the actual physical areas where the content of your files will be stored.
Directory Entries: These link a filename to its specific inode number so the system can find it.
π οΈ The Specialized Tools Used
Because this process requires interacting with the physical disk directly, it requires specialized programs found in the /sbin directory:
mkfs: The primary command used to build a filesystem.mkfs.*: Specific versions of the tool used for different filesystem types (such asmkfs.ext2).mkswap: A tool used to initialize a partition specifically for swap space (virtual memory).
π The Practical Result
Once a filesystem is "made," it must then be mounted before you can use it.
While the device file (like
/dev/hda2) gives the system access to the raw disk sectors, the mount point (the folder where you attach the filesystem) gives you access to the actual files.
β οΈ Why It Is Dangerous
As discussed in our conversation, tools like
mkfsoperate directly on the raw sectors of a disk.They do not check to see if your photos or documents are already there; they simply begin writing the new "map" over the existing data.
If you run this process on a partition that already contains files, the existing filesystem will be destroyed or seriously corrupted because its original organization system has been overwritten.
Top comments (0)