【My Study Note】Files and File System
Files and File System

General
The kernel handles file storage and file systems on our machines. Also, there are three main components to handling files on an OS.
Three main components
File System
When we have a brand new hard disk that we want to store data on, we need to erase and configure the disk. This way our operating system can read and write data to it.
This is important since it’s how our operating system keeps track of files. So it must know what kind of file system is used.
There are a lot of file systems, and they’re used for different purposes. Some file systems support the storage of large amounts of data, while others only support small amounts. They can operate at different speeds, and have varying resiliency towards file corruption, and so on.
In general, different file system types don’t play nicely with each other. You might not be able to easily move files across different file systems, depending on the file system type.
A good guideline to use is just to use the file system that your operating system recommends.
For Windows
For windows, the major file system that’s used is NTFS. It was introduced in the previous version of Windows OS, Windows NT. And it includes many features, like encryption, faster access speeds, security, and more.
Microsoft is developing another file system called ReFS, but it isn’t quite ready for consumer use just yet.
For Mac
For Mac, they use APFS (Apple File System). It’s journaled, which means it does a better job of saving your disk state in case of a failure. This is a feature on other types of file systems, like NTFS too.
For Linux
For Linux, different distributions will use different file system types. A standard for file systems for Linux is ext4, which is compatible with older ext file systems.
File Data
Another important part of file management is the storage of actual file data. We write data to our hard drives in the form of data blocks. When we save something to our hard disks, it doesn’t always sit in one piece. It can be broken down into many pieces and written into different parts of the disk.
Block Storage
Block storage improves faster handling of data because the data isn’t stored on one long piece and it can be accessed quicker. It’s also better for utilizing storage space.
Meta Data
We need to keep the metadata that contains the information about our file. There’s a lot of information about our file that we want to know, like who created it, when it was last modified, who has access to it, and so on.
The file metadata tells us everything we need to know about our file. It also tells us what type of file it is. A file extension is the appended part of a filename that tells us what type of file it is in certain operating systems.