What you need to know about local filesystems
This recipe will discuss the differences between local and remote filesystems, as well as the core differences between Btrfs and ZFS.
The backbone of an operating system (OS) is the local filesystem. It enables efficient storage and management of files and directories on a computer or server using a hierarchical structure. This structure allows users and programs to easily create, modify, and access files on local storage devices such as hard disks, solid-state drives, and storage logical unit numbers (LUNs) from a local storage area network (SAN) or cloud provider. These filesystems are designed specifically for file and folder management efficiency, protecting files from accidental deletion or corruption. They come equipped with features such as file permissions, ownership, and access control, which provide users with utmost security and privacy. In comparison to remote filesystems, local filesystems offer superior performance, though files are not available on other systems unless paired with a remote filesystem technology. Notable examples of local Linux filesystems include Btrfs, XFS, ext4, fat32, and even ZFS.
Note
While ZFS is a local filesystem, it is not included in the kernel and needs to be added using software from https://zfsonlinux.org.
A remote filesystem allows you to access files and directories on a remote server through a network. This system provides the convenience of accessing and manipulating files on a remote machine as if they were stored locally, eliminating the need to transfer them physically. Remote filesystems are widely used in distributed computing environments where multiple computers or servers need to share data and resources. They are also valuable in cloud computing and web hosting environments where data is stored remotely and accessed over the internet. However, it’s important to note that using remote filesystems can impact performance when sharing files between multiple servers over a network.
Examples of remote filesystems include Network File System (NFS), Server Message Block (SMB), and Common Internet File System (CIFS), which are widely used in Unix, Linux, and Windows environments, respectively. Other popular remote filesystems include s3fs, which allows users to access files securely over cloud-based object storage.
For optimal performance when managing MySQL, Postgres, and Oracle databases, it’s highly recommended to utilize local filesystems instead of network filesystems. This strategy can also be effectively applied to the OS.
Getting ready
You need to understand the core differences between the two filesystems. The XFS filesystem is surprisingly much older than many admins realize. It started back in 1993, as the filesystem for the Silicon Graphics IRIX OS, and was ported over to Linux in 2001. Btrfs is much newer, being developed in 2007 by Oracle (as an open source project) for Linux. Btrfs is also more than a filesystem, as it includes the volume manager, data redundancy, and filesystem functionality in one technology.
With XFS, you need to combine it with a logical volume manager for dynamic volumes and also redundant array of inexpensive disks (RAID) technology (most commonly configured with the mdadm command) to provide for fault tolerance.
With Btrfs, you have the choice of five types of RAID volumes. What you pick is based on your use case as it’s a balance between performance, disk space required, and the usable capacity of the volume. The details are in the following table:
Type | Description | Performance | Redundance | Capacity |
RAID 0 | Striping across disks | Best | None | 100% |
RAID 1 | Mirror two disks | Good | 1 drive failure | 50% |
RAID 10 | Mirrored then striped, min of 4 disks | Almost the best | 1 drive failure | 50% |
RAID1C3 | 3 copies of the metadata, min of 3 disks | Average | 2 drive failures | 66% |
RAID1C4 | 4 copies of the metadata, min of 4 disks | Lowest | 3 drive failures | 75% |
Table 4.1 – Btrfs RAID options
Both systems have the same limitation for the maximum filesystem size of 8 exabytes! But Btrfs also adds features such as snapshots, transparent compression, integrated checksum-based data integrity, and rollback capabilities. XFS is not left out though, with higher performance through I/O threads and more bandwidth, though these advantages may not be realized once you integrate XFS with an LVM and RAID technology. One other major difference is that Btrfs requires that you use the UEK, though XFS works well with both UEKs and Red Hat Compatible Kernels (RHCKs).