Characteristics of file systems
All operating systems have a file system that controls how information is stored and retrieved, regardless of the physical support (hard drive, SSD drives, pen drives, etc.). It is very important to configure the correct file system, because each one has clearly different characteristics, and some are better for a certain use, and others are better for another use. In the case of Synology NAS servers, we have the possibility of configuring EXT4 or Btrfs, in fact, in the volume configuration wizard we can choose between one and the other without any problem. Next, we are going to briefly explain the main characteristics of EXT4 and Btrfs.
EXT4 is the most used file system in Linux-based operating systems, this file system is transactional and has very important characteristics such as that it does not require a very powerful processor, and we have a very good read and write speed. EXT4 allows you to mitigate the fragmentation of the file system, so it is ideal for a NAS where we are going to copy many files of all sizes, however, it has tools to defragment individual files and even the entire volume without having to unmount it. The general characteristics of EXT4 are the following:
- Maximum file size: 16TiB using 4K blocks.
- Maximum number of files: 4 billion
- Maximum file name size: 255 bytes
- Maximum volume size: 1EiB
- Transparent data encryption: yes
- Copy-on-write: no
- Transparent compression: no
- Transparent deduplication: no
As you can see, we have many features that EXT4 does not support, such as CoW (Copy on Write), compression and transparent deduplication, something that Btrfs does have.
This file system is the successor to EXT4, however, right now it competes with it depending on the hardware used. This file system is primarily geared towards servers, not a desktop computer that might be running Ubuntu or Debian. This file system allows very advanced configurations, such as the possibility of having snapshots natively, in this way, we can “return” all the data written on the disk backwards. In addition, this file system allows mirroring and striping of several disks without as many limitations as EXT4. The general characteristics of Btrfs are the following:
- Maximum file size: 16EiB.
- Maximum number of files: 18 trillion.
- Maximum file name size: 255 bytes
- Maximum volume size: 16EiB.
- Transparent data encryption: no
- Copy-on-write: yes
- Transparent compression: yes
- Deduplication: yes
As you can see, we have much more capacity for the number of files and also the maximum file size. In addition, we have very interesting features such as Copy On Write, compression and deduplication, quite advanced aspects that are ideal for a NAS server.
Advantages of Btrfs on a Synology NAS
Setting up the Btrfs file system on a Synology NAS offers several very interesting advantages, especially for advanced users and also at the enterprise level:
- Metadata mirroring: in any NAS system keeping the data intact is essential, with this file system we can configure a Mirroring of several disks to store several copies and avoid data loss due to the breakage of one or more disks.
- Automatic file recovery from errors: Traditional file systems can experience errors that go completely unnoticed when writing and reading them, so that corrupted data can be sent to applications without any error messages. Btrfs generates checksums for data and metadata. The file system in each reading process checks and verifies these checksums, which will guarantee that the data is sent correctly without failure. In the case of detecting a damaged file due to data corruption, we can recover the original file if we use a RAID such as RAID 1 or RAID 5.
- Snapshots to protect data: The Btrfs file system incorporates snapshots or snapshots natively, in this way, it allows you to make a copy of a shared folder at a certain time, and go back in case of accidental deletion or a ransomware attack. This functionality is extremely important to properly protect the data on the NAS. Making these snapshots consumes very little additional storage space, it only takes up if we change or delete a certain file, thanks to the Copy on Write architecture it uses. At the software level, we have the possibility to create snapshots on demand, scheduled, configure the retention policy of up to 256 snapshots and much more. Of course, we could access the state of previous versions of the files without the need to restore everything, this can be done with File Station directly.
Other features that are also very important for a NAS server are the following:
- efficient storage– Compared to EXT4, you don’t need twice the storage space for Drive file versions and history data. We no longer have to worry about free space.
- More reliable backups: When we make a backup, it is possible that the files in the source NAS have changed, so there may be some data inconsistency if they are modified during the process. Btrfs allows you to take a snapshot before starting the backup, and by copying the data from the snapshot instead of the current data that has changed.
- Quota for shared folders: With this file system we will be able to specify a storage limit for individual shared folders, so that a specific folder does not hog all the storage space.
- Clone entire shared folders: with Btrfs we have the possibility to clone the content of a shared folder in another almost instantly, this is ideal for testing updates or simply to replicate one folder in another.
What should I keep in mind before using it?
Before using the Btrfs file system, you should know that it is not possible to change the file system once you have already created it in EXT4. That is, if you currently have a volume with EXT4 created, it is not possible to “migrate” to Btrfs. What you will have to do is make a complete backup of all the data contained and the shared folders, delete the EXT4 volume completely and create a new volume with the new Btrfs file system, once created, we will have to go through all the backup files. For backup, you can use Hyper Backup directly to perform a full backup to another NAS or cloud storage system.
Another aspect that you must take into account is the hardware of your NAS server, the EXT4 file system needs less hardware requirements than Btrfs, so entry-level or mid-range models will not even have the ability to configure this advanced file system. In the event that your NAS is powerful and allows you to configure it, you should know that the performance in reading and writing could be compromised, that is, we will have less real speed in certain scenarios, so you should assess if it really deserves the worth changing the file system.
You should only choose Btrfs if you want protection features such as snapshots, replication to other NAS, data integrity protection, and user quotas for each shared folder. That is, if you want to have the best data integrity and advanced data management features, then you should choose Btrfs because it is far superior to EXT4.