Ext4 Write Barriers

From Thomas-Krenn-Wiki
Jump to navigation Jump to search

Write barriers are used in the Linux kernel to ensure that data that has been written is actually written to a data carrier permanently before further new data is written. The use of write barriers ensures that even in the event of a sudden power failure, no data written via fsync() is lost. Write barriers force the correct sequence of journal-commits of the file system on the data carrier which allows volatile write caches to be used safely (but with some loss of performance).

Function of write barriers

Write barriers are implemented via flushing the storage writing case before and after I/O operation. After writing a transaction, the storage-cache is flushed, the commit-block of the file system is written and the cache is emptied again. Therefore, it is ensured that:

  • the data carrier (hard disk or SSD) contains all data
  • no re-ordering of individual accesses has taken place

If barriers are activated, a fsync() call also triggers a storage-cache-flush. This guarantees that the file data is stored permanently on the hard disk even if a power failure occurs shortly after the return of fsync().

Ext4 file system as example

The Ext4 file system has been using write barriers since May 2008.[1] This ensures that even with data carriers with volatile caches—e.g., hard disks with RAM caches—no data written using fsync() is lost, even in the event of a sudden power failure.

The activation of write barriers can lead to significant performance losses in some applications. In particular, applications that use fsync() intensively or that create or delete a lot of small files sometimes run significantly slower. [2] IF RAID-controllers with battery-backed cache or for example SSDs with SSD Power Loss Protection are used, the performance can be increased by deactivating write barriers without increasing the risk of data loss. [3]However, this only applies if effective power loss protection is actually in place.

Test case HDD Western Digital WD5003ABYX Intel SSD with PLP Samsung SSD without PLP
barriers=1 (activated) no data loss no data loss no data loss
barriers=0 (deactivated) data loss no data loss no data loss (Attention: data loss still possible!)

Ext4 file system tests with diskchecker.pl

The following test has been performed with the diskchecker.pl Perl Script. The test script uses two computers to check whether data can be lost in the event of a power failure. To do this, the script runs on two computers:

  1. On a logging computer: The script is in server mode.
  2. On the system to be tested: After the script has been started, the power supply is interrupted

The system to be tested is then infected again and restarted. The script is now executed again for verification purposes. Further background information on this script can be found here: http://brad.livejournal.com/2116715.html

Test with WD 500 GByte HDD

Western Digital WD5003ABYX 500GB SATA HDD with 64MB Cache

In this test, a Western Digital WD5003ABYX 500GB SATA HDD with 64MB cache is used.

barrier=1 (default)

root@pve:~# mount | grep sdc
/dev/sdc1 on /mnt/sdc-hdd type ext4 (rw,relatime)
root@pve:~# uname -a
Linux pve 6.17.2-1-pve #1 SMP PREEMPT_DYNAMIC PMX 6.17.2-1 (2025-10-21T11:55Z) x86_64 GNU/Linux
root@pve:/mnt/sdc-hdd# ./diskchecker.pl -s 172.16.0.112 create test-hdd-ext4-default 1000
  diskchecker: running 1 sec, 0.02% coverage of 1000 MB (11 writes; 11/s)
  diskchecker: running 2 sec, 0.05% coverage of 1000 MB (35 writes; 17/s)
  diskchecker: running 3 sec, 0.09% coverage of 1000 MB (59 writes; 19/s)
  diskchecker: running 4 sec, 0.13% coverage of 1000 MB (83 writes; 20/s)
  diskchecker: running 5 sec, 0.17% coverage of 1000 MB (107 writes; 21/s)
  diskchecker: running 6 sec, 0.20% coverage of 1000 MB (132 writes; 22/s)
  diskchecker: running 7 sec, 0.24% coverage of 1000 MB (155 writes; 22/s)
  diskchecker: running 8 sec, 0.28% coverage of 1000 MB (180 writes; 22/s)
  diskchecker: running 9 sec, 0.32% coverage of 1000 MB (204 writes; 22/s)
  diskchecker: running 10 sec, 0.36% coverage of 1000 MB (229 writes; 22/s)
  diskchecker: running 11 sec, 0.39% coverage of 1000 MB (252 writes; 22/s)
  diskchecker: running 12 sec, 0.43% coverage of 1000 MB (276 writes; 23/s)
  diskchecker: running 13 sec, 0.47% coverage of 1000 MB (300 writes; 23/s)
  diskchecker: running 14 sec, 0.50% coverage of 1000 MB (323 writes; 23/s)
  diskchecker: running 15 sec, 0.54% coverage of 1000 MB (347 writes; 23/s)
  diskchecker: running 16 sec, 0.58% coverage of 1000 MB (371 writes; 23/s)
  diskchecker: running 17 sec, 0.62% coverage of 1000 MB (396 writes; 23/s)
  diskchecker: running 18 sec, 0.66% coverage of 1000 MB (421 writes; 23/s)
  diskchecker: running 19 sec, 0.69% coverage of 1000 MB (445 writes; 23/s)
client_loop: send disconnect: Broken pipe
werner@x390:~/bin$ 
werner@x390:~/bin$ ssh root@172.16.10.1
root@172.16.10.1's password: 
Linux pve 6.17.2-1-pve #1 SMP PREEMPT_DYNAMIC PMX 6.17.2-1 (2025-10-21T11:55Z) x86_64
[...]
root@pve:~# mount /dev/sdc1 /mnt/sdc-hdd
root@pve:~# dmesg | tail -4
[   38.545085] vmbr0: port 1(nic1) entered blocking state
[   38.545091] vmbr0: port 1(nic1) entered forwarding state
[  207.082732] EXT4-fs (sdc1): recovery complete
[  207.101678] EXT4-fs (sdc1): mounted filesystem 8ac821f6-c372-415c-addd-855c3161ded9 r/w with ordered data mode. Quota mode: none.
root@pve:~# cd /mnt/sdc-hdd/
root@pve:/mnt/sdc-hdd# ./diskchecker.pl -s 172.16.0.112 verify test-hdd-ext4-default 
 verifying: 0.36%
 verifying: 19.26%
 verifying: 59.26%
 verifying: 94.18%
 verifying: 100.00%
Total errors: 0
root@pve:/mnt/sdc-hdd#

barrier=0

root@pve:~# mount -t ext4 -o barrier=0 /dev/sdc1 /mnt/sdc-hdd
root@pve:~# mount | grep sdc
/dev/sdc1 on /mnt/sdc-hdd type ext4 (rw,relatime,nobarrier)
root@pve:~# cd /mnt/sdc-hdd
root@pve:/mnt/sdc-hdd# ./diskchecker.pl -s 172.16.0.112 create test-hdd-ext4-nobarrier 1000
  diskchecker: running 1 sec, 0.20% coverage of 1000 MB (129 writes; 129/s)
  diskchecker: running 2 sec, 0.62% coverage of 1000 MB (394 writes; 197/s)
  diskchecker: running 3 sec, 0.95% coverage of 1000 MB (608 writes; 202/s)
  diskchecker: running 4 sec, 1.22% coverage of 1000 MB (782 writes; 195/s)
  diskchecker: running 5 sec, 1.55% coverage of 1000 MB (998 writes; 199/s)
  diskchecker: running 6 sec, 1.89% coverage of 1000 MB (1213 writes; 202/s)
  diskchecker: running 7 sec, 2.13% coverage of 1000 MB (1377 writes; 196/s)
  diskchecker: running 8 sec, 2.41% coverage of 1000 MB (1556 writes; 194/s)
  diskchecker: running 9 sec, 2.74% coverage of 1000 MB (1774 writes; 197/s)
  diskchecker: running 10 sec, 3.00% coverage of 1000 MB (1945 writes; 194/s)
  diskchecker: running 11 sec, 3.31% coverage of 1000 MB (2146 writes; 195/s)
  diskchecker: running 12 sec, 3.61% coverage of 1000 MB (2347 writes; 195/s)
  diskchecker: running 13 sec, 3.90% coverage of 1000 MB (2542 writes; 195/s)
  diskchecker: running 14 sec, 4.21% coverage of 1000 MB (2750 writes; 196/s)
  diskchecker: running 15 sec, 4.54% coverage of 1000 MB (2967 writes; 197/s)
  diskchecker: running 16 sec, 4.80% coverage of 1000 MB (3142 writes; 196/s)
  diskchecker: running 17 sec, 5.09% coverage of 1000 MB (3336 writes; 196/s)
  diskchecker: running 18 sec, 5.35% coverage of 1000 MB (3513 writes; 195/s)
  diskchecker: running 19 sec, 5.65% coverage of 1000 MB (3713 writes; 195/s)
  diskchecker: running 20 sec, 5.91% coverage of 1000 MB (3890 writes; 194/s)
  diskchecker: running 21 sec, 6.21% coverage of 1000 MB (4091 writes; 194/s)
  diskchecker: running 22 sec, 6.48% coverage of 1000 MB (4281 writes; 194/s)
  diskchecker: running 23 sec, 6.72% coverage of 1000 MB (4449 writes; 193/s)
  diskchecker: running 24 sec, 7.01% coverage of 1000 MB (4645 writes; 193/s)

client_loop: send disconnect: Broken pipe
werner@x390:~/bin$ ssh root@172.16.10.1
root@172.16.10.1's password: 
Linux pve 6.17.2-1-pve #1 SMP PREEMPT_DYNAMIC PMX 6.17.2-1 (2025-10-21T11:55Z) x86_64
[...]
root@pve:~# mount -t ext4 -o barrier=0 /dev/sdc1 /mnt/sdc-hdd
root@pve:~# dmesg | tail -n 4
[   38.535100] vmbr0: port 1(nic1) entered forwarding state
[  324.430790] EXT4-fs (sdc1): barriers disabled
[  327.063895] EXT4-fs (sdc1): recovery complete
[  327.064076] EXT4-fs (sdc1): mounted filesystem 8ac821f6-c372-415c-addd-855c3161ded9 r/w with ordered data mode. Quota mode: none.
root@pve:~# cd /mnt/sdc-hdd
root@pve:/mnt/sdc-hdd# ./diskchecker.pl -s 172.16.0.112 verify test-hdd-ext4-nobarrier 
 verifying: 0.02%
  Error at page 19, 2 seconds before end.
  Error at page 303, 1 seconds before end.
  Error at page 339, 0 seconds before end.
  Error at page 511, 1 seconds before end.
  Error at page 544, 0 seconds before end.
  Error at page 681, 0 seconds before end.
  Error at page 708, 2 seconds before end.
  Error at page 1108, 1 seconds before end.
  Error at page 1337, 0 seconds before end.
  Error at page 1388, 0 seconds before end.
 verifying: 2.22%
  Error at page 1487, 0 seconds before end.
  Error at page 1492, 0 seconds before end.
[...]
  Error at page 63758, 0 seconds before end.
  Error at page 63990, 1 seconds before end.
 verifying: 100.00%
Total errors: 545
Histogram of seconds before end:
     0  178
     1  187
     2  142
     3    1
     4    1
     6    2
     7    3
     8    3
     9    2
    10    5
    11    1
    14    4
    15    1
    16    2
    17    1
    18    1
    19    2
    20    3
    22    3
    23    2
    24    1
root@pve:/mnt/sdc-hdd# 

Test with SSD with PLP

In this example, a 80 GByte Intel DC S3500 Series SSD with SSD Power Loss Protection is used.

barrier=1 (default)

root@pve:/mnt/sdc-ssd-with-plp# mount | grep sdc
/dev/sdc1 on /mnt/sdc-ssd-with-plp type ext4 (rw,relatime)
root@pve:/mnt/sdc-ssd-with-plp# ./diskchecker.pl -s 172.16.0.112 create test-ssd-ext4 1000
  diskchecker: running 1 sec, 0.04% coverage of 1000 MB (28 writes; 28/s)
  diskchecker: running 2 sec, 0.67% coverage of 1000 MB (427 writes; 213/s)
  diskchecker: running 3 sec, 1.34% coverage of 1000 MB (859 writes; 286/s)
  diskchecker: running 4 sec, 2.05% coverage of 1000 MB (1324 writes; 331/s)
  diskchecker: running 5 sec, 2.71% coverage of 1000 MB (1758 writes; 351/s)
  diskchecker: running 6 sec, 3.48% coverage of 1000 MB (2266 writes; 377/s)
  diskchecker: running 7 sec, 4.24% coverage of 1000 MB (2775 writes; 396/s)
  diskchecker: running 8 sec, 4.88% coverage of 1000 MB (3207 writes; 400/s)
  diskchecker: running 9 sec, 5.53% coverage of 1000 MB (3652 writes; 405/s)
  diskchecker: running 10 sec, 6.14% coverage of 1000 MB (4073 writes; 407/s)
  diskchecker: running 11 sec, 6.76% coverage of 1000 MB (4492 writes; 408/s)
  diskchecker: running 12 sec, 7.38% coverage of 1000 MB (4922 writes; 410/s)
  diskchecker: running 13 sec, 7.98% coverage of 1000 MB (5344 writes; 411/s)
  diskchecker: running 14 sec, 8.65% coverage of 1000 MB (5799 writes; 414/s)
  diskchecker: running 15 sec, 9.25% coverage of 1000 MB (6229 writes; 415/s)
  diskchecker: running 16 sec, 9.84% coverage of 1000 MB (6652 writes; 415/s)
  diskchecker: running 17 sec, 10.47% coverage of 1000 MB (7103 writes; 417/s)
  diskchecker: running 18 sec, 11.11% coverage of 1000 MB (7556 writes; 419/s)
  diskchecker: running 19 sec, 11.71% coverage of 1000 MB (7974 writes; 419/s)
  diskchecker: running 20 sec, 12.31% coverage of 1000 MB (8405 writes; 420/s)
  diskchecker: running 21 sec, 12.91% coverage of 1000 MB (8847 writes; 421/s)
  diskchecker: running 22 sec, 13.57% coverage of 1000 MB (9328 writes; 424/s)
  diskchecker: running 23 sec, 14.18% coverage of 1000 MB (9767 writes; 424/s)
werner@x390:~/bin$ ssh root@172.16.10.1
root@172.16.10.1's password: 
Linux pve 6.17.2-1-pve #1 SMP PREEMPT_DYNAMIC PMX 6.17.2-1 (2025-10-21T11:55Z) x86_64
[...]
root@pve:~# mount /dev/sdc1 /mnt/sdc-ssd-with-plp
root@pve:~# dmesg | tail -n 4
[   38.515045] vmbr0: port 1(nic1) entered blocking state
[   38.515052] vmbr0: port 1(nic1) entered forwarding state
[  175.603062] EXT4-fs (sdc1): recovery complete
[  175.603218] EXT4-fs (sdc1): mounted filesystem 2847a7c0-0a1e-4ab8-8a4b-7c2856dcf0a3 r/w with ordered data mode. Quota mode: none.
root@pve:~# cd /mnt/sdc-ssd-with-plp/
root@pve:/mnt/sdc-ssd-with-plp# ./diskchecker.pl -s 172.16.0.112 verify test-ssd-ext4 
 verifying: 0.00%
 verifying: 28.12%
 verifying: 85.80%
 verifying: 100.00%
Total errors: 0
root@pve:/mnt/sdc-ssd-with-plp# 

barrier=0

root@pve:~# mount -t ext4 -o barrier=0 /dev/sdc1 /mnt/sdc-ssd-with-plp
root@pve:~# mount | grep sdc
/dev/sdc1 on /mnt/sdc-ssd-with-plp type ext4 (rw,relatime,nobarrier)
root@pve:~# cd /mnt/sdc-ssd-with-plp/
root@pve:/mnt/sdc-ssd-with-plp# ./diskchecker.pl -s 172.16.0.112 create test-ssd-ext4-nobarrier 1000
  diskchecker: running 1 sec, 0.45% coverage of 1000 MB (289 writes; 289/s)
  diskchecker: running 2 sec, 1.19% coverage of 1000 MB (768 writes; 384/s)
  diskchecker: running 3 sec, 1.90% coverage of 1000 MB (1230 writes; 410/s)
  diskchecker: running 4 sec, 2.65% coverage of 1000 MB (1721 writes; 430/s)
  diskchecker: running 5 sec, 3.47% coverage of 1000 MB (2258 writes; 451/s)
  diskchecker: running 6 sec, 4.20% coverage of 1000 MB (2743 writes; 457/s)
  diskchecker: running 7 sec, 4.92% coverage of 1000 MB (3246 writes; 463/s)
  diskchecker: running 8 sec, 5.72% coverage of 1000 MB (3783 writes; 472/s)
  diskchecker: running 9 sec, 6.43% coverage of 1000 MB (4266 writes; 474/s)
  diskchecker: running 10 sec, 7.15% coverage of 1000 MB (4756 writes; 475/s)
  diskchecker: running 11 sec, 7.90% coverage of 1000 MB (5270 writes; 479/s)
  diskchecker: running 12 sec, 8.60% coverage of 1000 MB (5758 writes; 479/s)
  diskchecker: running 13 sec, 9.43% coverage of 1000 MB (6325 writes; 486/s)
  diskchecker: running 14 sec, 10.17% coverage of 1000 MB (6862 writes; 490/s)
  diskchecker: running 15 sec, 10.86% coverage of 1000 MB (7354 writes; 490/s)
  diskchecker: running 16 sec, 11.57% coverage of 1000 MB (7870 writes; 491/s)
  diskchecker: running 17 sec, 12.21% coverage of 1000 MB (8337 writes; 490/s)
  diskchecker: running 18 sec, 12.88% coverage of 1000 MB (8821 writes; 490/s)
  diskchecker: running 19 sec, 13.50% coverage of 1000 MB (9288 writes; 488/s)
  diskchecker: running 20 sec, 14.15% coverage of 1000 MB (9755 writes; 487/s)
  diskchecker: running 21 sec, 14.76% coverage of 1000 MB (10213 writes; 486/s)
  diskchecker: running 22 sec, 15.45% coverage of 1000 MB (10719 writes; 487/s)
  diskchecker: running 23 sec, 16.09% coverage of 1000 MB (11199 writes; 486/s)
  diskchecker: running 24 sec, 16.71% coverage of 1000 MB (11681 writes; 486/s)
  diskchecker: running 25 sec, 17.52% coverage of 1000 MB (12301 writes; 492/s)
root@pve:~# mount -t ext4 -o barrier=0 /dev/sdc1 /mnt/sdc-ssd-with-plp
root@pve:~# dmesg | tail -n 4
[   38.503206] vmbr0: port 1(nic1) entered forwarding state
[  128.406477] EXT4-fs (sdc1): barriers disabled
[  129.953659] EXT4-fs (sdc1): recovery complete
[  129.953789] EXT4-fs (sdc1): mounted filesystem 2847a7c0-0a1e-4ab8-8a4b-7c2856dcf0a3 r/w with ordered data mode. Quota mode: none.
root@pve:~# cd /mnt/sdc-ssd-with-plp
root@pve:/mnt/sdc-ssd-with-plp# ./diskchecker.pl -s 172.16.0.112 verify test-ssd-ext4-nobarrier 
 verifying: 0.00%
 verifying: 29.52%
 verifying: 77.96%
 verifying: 100.00%
Total errors: 0
root@pve:/mnt/sdc-ssd-with-plp# 

Test with SSD without PLP

In this test, a 512 GByte Samsung 850 PRO SATA SSD is used.

barrier=1 (default)

root@pve:~# mkfs.ext4 /dev/sdc1 
mke2fs 1.47.2 (1-Jan-2025)
Discarding device blocks: done                            
Creating filesystem with 125026646 4k blocks and 31260672 inodes
Filesystem UUID: b1721738-9749-4b86-9d05-d380b0337316
Superblock backups stored on blocks: 
	32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
	4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968, 
	102400000

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (262144 blocks): done
Writing superblocks and filesystem accounting information: done     

root@pve:~# mkdir /mnt/sdc-ssd-without-plp
root@pve:~# mount /dev/sdc1 /mnt/sdc-ssd-without-plp
root@pve:~# cd /mnt/sdc-ssd-without-plp
root@pve:/mnt/sdc-ssd-without-plp# wget https://gist.githubusercontent.com/bradfitz/3172656/raw/301f516a4719b48cc9c133c4ba9c864ff8eaf056/diskchecker.pl
[...]
2026-02-27 11:34:15 (140 MB/s) - 'diskchecker.pl' saved [6702/6702]

root@pve:/mnt/sdc-ssd-without-plp# chmod +x diskchecker.pl 
root@pve:/mnt/sdc-ssd-without-plp# sync
root@pve:/mnt/sdc-ssd-without-plp# ./diskchecker.pl -s 172.16.0.112 create test-ssd-noplp-ext4 1000
  diskchecker: running 1 sec, 0.03% coverage of 1000 MB (22 writes; 22/s)
  diskchecker: running 2 sec, 0.33% coverage of 1000 MB (214 writes; 107/s)
  diskchecker: running 3 sec, 0.64% coverage of 1000 MB (408 writes; 136/s)
  diskchecker: running 4 sec, 0.94% coverage of 1000 MB (603 writes; 150/s)
  diskchecker: running 5 sec, 1.24% coverage of 1000 MB (803 writes; 160/s)
  diskchecker: running 6 sec, 1.54% coverage of 1000 MB (993 writes; 165/s)
  diskchecker: running 7 sec, 1.86% coverage of 1000 MB (1205 writes; 172/s)
  diskchecker: running 8 sec, 2.16% coverage of 1000 MB (1399 writes; 174/s)
  diskchecker: running 9 sec, 2.48% coverage of 1000 MB (1607 writes; 178/s)
  diskchecker: running 10 sec, 2.79% coverage of 1000 MB (1810 writes; 181/s)
  diskchecker: running 11 sec, 3.09% coverage of 1000 MB (2012 writes; 182/s)
  diskchecker: running 12 sec, 3.40% coverage of 1000 MB (2216 writes; 184/s)
  diskchecker: running 13 sec, 3.69% coverage of 1000 MB (2412 writes; 185/s)
  diskchecker: running 14 sec, 3.99% coverage of 1000 MB (2615 writes; 186/s)
  diskchecker: running 15 sec, 4.29% coverage of 1000 MB (2814 writes; 187/s)
  diskchecker: running 16 sec, 4.60% coverage of 1000 MB (3018 writes; 188/s)
  diskchecker: running 17 sec, 4.90% coverage of 1000 MB (3218 writes; 189/s)
  diskchecker: running 18 sec, 5.20% coverage of 1000 MB (3425 writes; 190/s)
  diskchecker: running 19 sec, 5.50% coverage of 1000 MB (3626 writes; 190/s)
  diskchecker: running 20 sec, 5.79% coverage of 1000 MB (3828 writes; 191/s)
  diskchecker: running 21 sec, 6.08% coverage of 1000 MB (4028 writes; 191/s)
  diskchecker: running 22 sec, 6.36% coverage of 1000 MB (4214 writes; 191/s)
  diskchecker: running 23 sec, 6.65% coverage of 1000 MB (4414 writes; 191/s)
  diskchecker: running 24 sec, 6.94% coverage of 1000 MB (4617 writes; 192/s)
  diskchecker: running 25 sec, 7.23% coverage of 1000 MB (4816 writes; 192/s)
  diskchecker: running 26 sec, 7.52% coverage of 1000 MB (5020 writes; 193/s)
client_loop: send disconnect: Broken pipe
werner@x390:~/bin$ ssh root@172.16.10.1
root@172.16.10.1's password: 
Linux pve 6.17.2-1-pve #1 SMP PREEMPT_DYNAMIC PMX 6.17.2-1 (2025-10-21T11:55Z) x86_64

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Fri Feb 27 11:32:14 2026 from 172.16.0.112
root@pve:~# mount /dev/sdc1 /mnt/sdc-ssd-without-plp
root@pve:~# dme
dmesg     dmeventd  
root@pve:~# dmesg | tail -n 4
[   38.593080] vmbr0: port 1(nic1) entered blocking state
[   38.593084] vmbr0: port 1(nic1) entered forwarding state
[   88.513484] EXT4-fs (sdc1): recovery complete
[   88.514141] EXT4-fs (sdc1): mounted filesystem b1721738-9749-4b86-9d05-d380b0337316 r/w with ordered data mode. Quota mode: none.
root@pve:~# cd /mnt/sdc-ssd-without-plp
root@pve:/mnt/sdc-ssd-without-plp# ./diskchecker.pl -s 172.16.0.112 verify test-ssd-noplp-ext4 
 verifying: 0.02%
 verifying: 3.74%
 verifying: 100.00%
Total errors: 0
root@pve:/mnt/sdc-ssd-without-plp# 

barrier=0

root@pve:~# mount -t ext4 -o barrier=0 /dev/sdc1 /mnt/sdc-ssd-without-plp
root@pve:~# mount | grep sdc
/dev/sdc1 on /mnt/sdc-ssd-without-plp type ext4 (rw,relatime,nobarrier)
root@pve:~# cd /mnt/sdc-ssd-without-plp
root@pve:/mnt/sdc-ssd-without-plp# ./diskchecker.pl -s 172.16.0.112 create test-ssd-noplp-ext4-nobarrier 1000
  diskchecker: running 1 sec, 0.47% coverage of 1000 MB (303 writes; 303/s)
  diskchecker: running 2 sec, 1.26% coverage of 1000 MB (814 writes; 407/s)
  diskchecker: running 3 sec, 1.97% coverage of 1000 MB (1274 writes; 424/s)
  diskchecker: running 4 sec, 2.75% coverage of 1000 MB (1783 writes; 445/s)
  diskchecker: running 5 sec, 3.51% coverage of 1000 MB (2285 writes; 457/s)
  diskchecker: running 6 sec, 4.34% coverage of 1000 MB (2835 writes; 472/s)
  diskchecker: running 7 sec, 5.14% coverage of 1000 MB (3371 writes; 481/s)
  diskchecker: running 8 sec, 5.90% coverage of 1000 MB (3883 writes; 485/s)
  diskchecker: running 9 sec, 6.59% coverage of 1000 MB (4348 writes; 483/s)
  diskchecker: running 10 sec, 7.26% coverage of 1000 MB (4809 writes; 480/s)
  diskchecker: running 11 sec, 8.02% coverage of 1000 MB (5333 writes; 484/s)
  diskchecker: running 12 sec, 8.75% coverage of 1000 MB (5843 writes; 486/s)
  diskchecker: running 13 sec, 9.43% coverage of 1000 MB (6317 writes; 485/s)
  diskchecker: running 14 sec, 10.12% coverage of 1000 MB (6805 writes; 486/s)
  diskchecker: running 15 sec, 11.05% coverage of 1000 MB (7450 writes; 496/s)
  diskchecker: running 16 sec, 11.70% coverage of 1000 MB (7912 writes; 494/s)
  diskchecker: running 17 sec, 12.38% coverage of 1000 MB (8401 writes; 494/s)
  diskchecker: running 18 sec, 12.99% coverage of 1000 MB (8862 writes; 492/s)
  diskchecker: running 19 sec, 13.65% coverage of 1000 MB (9352 writes; 492/s)
  diskchecker: running 20 sec, 14.29% coverage of 1000 MB (9822 writes; 491/s)
  diskchecker: running 21 sec, 14.92% coverage of 1000 MB (10294 writes; 490/s)
  diskchecker: running 22 sec, 15.55% coverage of 1000 MB (10761 writes; 489/s)
  diskchecker: running 23 sec, 16.21% coverage of 1000 MB (11261 writes; 489/s)
  diskchecker: running 24 sec, 16.82% coverage of 1000 MB (11741 writes; 489/s)
client_loop: send disconnect: Broken pipe
werner@x390:~/bin$ ssh root@172.16.10.1
root@172.16.10.1's password: 
Linux pve 6.17.2-1-pve #1 SMP PREEMPT_DYNAMIC PMX 6.17.2-1 (2025-10-21T11:55Z) x86_64
[...]
root@pve:~# mount -t ext4 -o barrier=0 /dev/sdc1 /mnt/sdc-ssd-without-plp
root@pve:~# dmesg | tail -n 4
[   38.959022] vmbr0: port 1(nic1) entered forwarding state
[  322.860448] EXT4-fs (sdc1): barriers disabled
[  323.915454] EXT4-fs (sdc1): recovery complete
[  323.915513] EXT4-fs (sdc1): mounted filesystem b1721738-9749-4b86-9d05-d380b0337316 r/w with ordered data mode. Quota mode: none.
root@pve:~# cd /mnt/sdc-ssd-with
sdc-ssd-without-plp/ sdc-ssd-with-plp/    
root@pve:~# cd /mnt/sdc-ssd-without-plp
root@pve:/mnt/sdc-ssd-without-plp# ./diskchecker.pl -s 172.16.0.112 verify test-ssd-noplp-ext4
test-ssd-noplp-ext4            test-ssd-noplp-ext4-nobarrier  
root@pve:/mnt/sdc-ssd-without-plp# ./diskchecker.pl -s 172.16.0.112 verify test-ssd-noplp-ext4-nobarrier 
 verifying: 0.01%
 verifying: 49.87%
 verifying: 100.00%
Total errors: 0
root@pve:/mnt/sdc-ssd-without-plp# 

More information

References

  1. ext4: enable barriers by default (git.kernel.org, 26.05.2008)
  2. Chapter 22. Write Barriers (docs.redhat.com, Storage Administration Guide RHEL 7) Enabling write barriers incurs a substantial performance penalty for some applications. Specifically, applications that use fsync() heavily or create and delete many small files will likely run much slower.
  3. PostgreSQL File System Tuning - Write Barrier Tuning (kb.techtaco.org)


Author: Werner Fischer

Werner Fischer, working in the Knowledge Transfer team at Thomas-Krenn, completed his studies of Computer and Media Security at FH Hagenberg in Austria. He is a regular speaker at many conferences like LinuxTag, OSMC, OSDC, LinuxCon, and author for various IT magazines. In his spare time he enjoys playing the piano and training for a good result at the annual Linz marathon relay.


Translator: Alina Ranzinger

Alina has been working at Thomas-Krenn.AG since 2024. After her training as multilingual business assistant, she got her job as assistant of the Product Management and is responsible for the translation of texts and for the organisation of the department.


Related articles

Linux Cluster Management Console (LCMC) GUI
Lscpu
Setting of CPU Governor under Linux