Linux Filesystem basics


This article is intended to be a very high-level details of Linux filesystem concepts. This is a layer that is under the operating system that handles the positioning of your data on the storage; without it, the system cannot knows which file starts from where and ends where. When you install Linux, one thing you’ll notice when choosing between file systems is that some of them are marked as a “journaling” file system and some aren’t. This is important. Journaling is designed to prevent data corruption from crashes and sudden power loss. Let’s say your system is partway through writing a file to the disk and it suddenly loses power. Without a journal, your computer would have no idea if the file was completely written to disk. The file would remain there on disk, corrupt.
While Microsoft develops Windows and Apple controls macOS, Linux is an open-source project developed by the community. Anyone (or any company) with the skill and time can create a new Linux file system. That’s one reason why there are so many options. Here are the differences:

Ext stands for “Extended file system”, and was the first created specifically for Linux. 

Ext2 is not a journaling file system. When introduced, it was the first file system to support extended file attributes and 2 terabyte drives. Ext2’s lack of a journal means it writes to disk less, which makes it useful for flash memory like USB drives. 

Ext3 is basically just Ext2 with journaling. Ext3 was designed to be backwards compatible with Ext2, allowing partitions to be converted between Ext2 and Ext3 without any formatting required. 

Ext4 was also designed to be backwards compatible. You can mount an Ext4 file system as Ext3, or mount an Ext2 or Ext3 file system as Ext4. It includes newer features that reduce file fragmentation, allows for larger volumes and files, and uses delayed allocation to improve flash memory life. This is the most modern version of the Ext file system and is the default on most Linux distributions. It means Ext4 is rock-solid and stable. Use Ext4 if you’re Not Sure.

XFS It’s similar to Ext4 in some ways, as it also uses delayed allocation to help with file fragmentation and does not allow for mounted snapshots. It can be enlarged, but not shrunk, on the fly. XFS has good performance when dealing with large files, but has worse performance than other file systems when dealing with many small files. It may be useful for certain types of servers that primarily need to deal with large files.

Swap is an option when formatting a drive, but isn’t an actual file system. It’s used as virtual memory and doesn’t have a file system structure. You can’t mount it to view its contents. Swap is used as “scratch space” by the Linux kernel to temporarily store data that can’t fit in RAM. It’s also used for hibernating. While Windows stores its paging file as a file on its main system partition, Linux just reserves a separate empty partition for swap space.

Post a Comment

Thanks for your comment !
I will review your this and will respond you as soon as possible.