Difference between revisions of "Reiser4"

From ArchWiki
Jump to navigation Jump to search
m (Important Notes)
m (Added AUR link)
 
(52 intermediate revisions by 23 users not shown)
Line 1: Line 1:
[[Category:File systems (English)]]
+
[[Category:File systems]]
Reiser4 is the "new" (circa 2004) successor filesystem for ReiserFS, developed from scratch by [http://www.namesys.com/ Namesys] and Hans Reiser (the site has been dead since [http://en.wikipedia.org/wiki/Namesys 2008]). It is very efficient for handling small files (often used in {{Filename|/var}} for this purpose) and includes features such as cheap transparent compression and block suballocation. Because it is an atomic file system "your file system operations either entirely occur, or they entirely don't, and they don't corrupt due to half occurring." [http://vizzzion.org/?id=reiser4 Benchmarks] with other linux filesystems are also available.
+
[[ja:Reiser4]]
 +
[[ru:Reiser4]]
 +
{{Related articles start}}
 +
{{Related|File systems}}
 +
{{Related articles end}}
  
==Important Notes==
+
[[Wikipedia:Reiser4|Reiser4]] is the successor filesystem for [[Wikipedia:ReiserFS|ReiserFS]], initially designed and developed entirely from scratch by [[Wikipedia:Namesys|Namesys]] and [[Wikipedia:Hans Reiser|Hans Reiser]].
* Reiser4 requires a patched kernel
+
It is very efficient in handling many files (often used in {{ic|/var}} for this purpose) and includes a plugin-based design with plugins with features such as intelligent transparent compression, both inline data and meta-data checksums through the [[Wikipedia:Cyclic redundancy check#CRC-32_algorithm|crc32c]] algorithm with added optional [https://reiser4.wiki.kernel.org/index.php/Reiser4_Mirrors_and_Failover mirrors and failover] support through its own implementation of subvolumes.
* Reiser4 is developed for the 2.6 kernel and not backported for 2.4
+
 
* Reiser4 consumes a little more CPU than other filesystems
+
Reiser4 supports different [https://reiser4.wiki.kernel.org/index.php/Reiser4_transaction_models transaction models] optimized for different types of storage devices. These include '''Write-Anywhere''' (or '''CoW'''), '''journal''' and a unique combination of the two called '''hybrid'''.
* Reiser4 is still not considered a stable release.
+
Reiser4's main goals is performance as well as the modular nature which can expand features of the file system more easily, as well as the implementations that make it less prone to both data loss and corruption because of it's atomic approach in regards to every transaction that it performs.
 +
In the hybrid transaction model, Reiser4 heuristically alternates between journaling and Write-Anywhere/Copy-on-Write and is also the default if no mount option is specificed and this transaction model is optimized primarily for performance for rotating disks (while Write-Anywhere is aimed towards SSDs).
 +
However, in '''hybrid''' mode, it will result in more fragmentation compared to the '''journal''' transaction model over time.
 +
 
 +
However, Reiser4's journaling model (in both hybrid or journal modes) is more efficient than regular journaling file systems in that instead of traditional journaling, Reiser4 uses a more advanced technique known as [https://reiser4.wiki.kernel.org/index.php/V4#Wandering_Logs '''wandering logs'''] which provides journaling without having to write data to the disk twice thus reducing writes.
 +
In many cases, Reiser4 can write journal data to a disk block, then atomically swap the journal block into the file itself which avoids having to write the data twice by changing one's definition of where the log area and the committed area are instead of moving the data from the log to the committed area.
 +
 
 +
Another unique feature is the implementation of a special technique for SSD users called [https://reiser4.wiki.kernel.org/index.php/PreciseDiscard '''Precise Asynchronous Discard'''].  
 +
This implementation means that in Reiser4, issuing discard requests is a delayed action, which is performed on a per-atom basis at transaction commit time.
 +
It allows to reduce number of discard requests issued (because the merging of extents, which needs to be discarded) and eliminates the need for issuing discards periodically as well, thus removing the need to set up an external tool like '''fstrim''' through a cron daemon which issues discard requests on a schedule.
 +
 
 +
Additionally, it also features block suballocation and is built on the [[Wikipedia:Dancing tree|dancing tree]] design, which was exclusively invented for the use with Reiser4 and is also one of the several unique but also fundamental differences when compared to every other file system in general.
 +
The idea behind the '''dancing tree''' approach is to speed up file system operations by delaying optimization/balancing of the tree and only writing to disk when necessary, as writing to disk is much slower than writing to memory.
 +
Because this optimization is done less often than with other tree data structures like [[Wikipedia:B+ tree|B+ tree's]] or [[Wikipedia:B-tree|B- tree's]], the optimizations and performance gains can be more extensive.
 +
 
 +
Because it is designed as an atomic file system, "your file system operations either entirely occur, or they entirely don't, and they do not corrupt due to half occurring."
 +
What this means in practice is that all operations in Reiser4 are atomic. In the case of very long writes, Reiser4 is forced to close transactions to free dirty pages in a response to memory pressure and thus, long writes in Reiser4 are split into a number of atomic writes to maintain is atomicity.
 +
However, current lead developer, mathematician and programmer '''PhD Edward Shishkin''' has [https://reiser4.wiki.kernel.org/index.php/Why_Reiser4 suggested] a change to full atomicity (atomic writes of any length) in the '''Write-Anywhere''' transaction model, where atoms can be flushed without closing a transaction.
 +
 
 +
It's core design is very modular and allows for easy integration of new modules (called "plugins").
 +
According to the developers, because of the modular design, Reiser4 can quite easily be ported to other operating systems like [[Wikipedia:FreeBSD|FreeBSD]]. As of 2019, Linux is still the only operating system Reiser4 is known to be compatible with.
 +
 
 +
Synthetic benchmarks and speed comparisons between '''Reiser4''', [[Btrfs]] and [[Ext4]] are [https://www.phoronix.com/scan.php?page=article&item=reiser4_benchmarks&num=1 available], as well as [https://openbenchmarking.org/result/1510278-BE-REISER4VS69 benchmarks] that include comparisons between the different '''transaction models''' and with/without the '''cryptcompress''' plugin.
  
==Required materials==
 
  
* One empty partition for the new Reiser4 system
+
More information about the features, plugins, design and mkfs or mount options is described in detail [https://reiser4.wiki.kernel.org/index.php/Main_Page here].
  
* One small (12 - 200 MB) non-Reiser4 partition, such as ext2 for /boot
 
  
* gparted is probably a necessity for resizing unless you want to use parted from the command line. Install to your Arch install, or just get the [ http://gparted.sourceforge.net/livecd.php LiveCD].
+
==Important Notes==
 +
* Reiser4 requires a patched kernel. A custom [[Linux-ck]] based kernel with Reiser4 patches is available as {{AUR|linux-ck-reiser4}}
 +
* It consumes a little more CPU than other filesystems (just like [[Btrfs]]). To avoid having issues on laptops using [[TLP]] for power saving, it is recommended to disable the options for '''SATA Link''' power saving in '''/etc/default/tlp''' (again, as with [[Btrfs]]).
 +
* Even [[LILO]] as the only bootloader officially supporting Reiser4 seems to have issues with it when {{ic|/boot}} is formatted as Reiser4
 +
* It is still not included in the official Linux kernel, but patches for '''Linux-5.x''' is already available.
 +
* [[Access Control Lists]] is not implemented and as of linux-5.x.x requires that [[Systemd/Journal]] either logs to a seperate logging [[daemon]] or to [[Tmpfs]]. Another workaround is to compile systemD by source without ACL support, but is not recommended.
  
* A Reiser4 enabled LiveCD. Only a few are still in existance for some reason:
 
  
I highly reccomend the [http://rescuecd.pld-linux.org/ PLD RescueCD], as it seems to be one of the few in existance that still have working Reiser4 support. You will probably need Gparted's livecd as mentioned above too.
+
{{Tip|[http://gparted.sourceforge.net/livecd.php Gparted LiveCD] is a small Linux distribution booting straight into Gparted. It also supports Reiser4 and can be used to migrate from an existing filesystem to Reiser4}}
  
 
==Packages==
 
==Packages==
1. Install {{Package AUR|reiser4progs}} from [[AUR]]
+
1. [[Install]] the {{AUR|reiser4progs}} package which provides utilities for creating, fsck'ing and debugging Reiser4 volumes.
  
2. You'll need a reiser4 patched kernel. Unfortunately, it has yet not been ported into 3.0 kernel. You can check out here for the progress: http://www.kernel.org/pub/linux/kernel/people/edward/reiser4/
+
2. You will need a Reiser4 patched kernel. Patches can be found [https://sourceforge.net/projects/reiser4/files/ here] or at the more recently created Git [https://github.com/edward6/reiser4 repository] which is maintained by it's current lead developer, the mathematician and programmer '''Edward Shishkin'''.
  
3. Bootloader
+
3. Bootloader ''(Optional, only needed if you want to format your {{ic|/}} (root, including '''/boot''') as '''Reiser4''')
  
a) '''Reccomended:''' make a small (as mentioned above, 20-200mb) partition for /boot with a filesystem other than Reiser4 with gparted, and then copy your /boot folder to the partition. Update the menu.lst accordingly, making a new entry for your Reiser4 partition.
+
{{Note|Backing up your bootloader configuration file should be considered if one is going to have /boot residing on a Reiser4 volume.}}
  
b) '''lilo''' is reccomended if you with to put everything including /boot on a Reiser4 partition. This is not advised, as you'll get an error when trying to update lilo.conf.
+
a) '''Recommended:''' make a small (as mentioned above, 20-200mb) partition for {{ic|/boot}} with a filesystem other than Reiser4 with [[GParted]], and then copy your {{ic|/boot}} folder to the partition. Update your bootloader config accordingly, eg. with [[Grub2]] do:
 +
# grub-mkconfig -o /boot/grub/grub.cfg.
 +
{{Note|[[EFI]] systems in general require a [[FAT32]] partition for booting the kernel and thus it may be advantageous or unproblematic to have the /boot directory residing on that partition instead of only the EFI directory. Many EFI-users have their whole /boot directory on their [[ESP]]}}
  
c) If you wish to use '''grub''' with /boot residing on a Reiser4 partition, the grub package should be rebuilt applying the reiser4 patch. This site has a great guide, however I (ilikenwf) have tried this but failed.
+
b) If you do not use [[EFI]] and wish to put everything including {{ic|/boot}} on a Reiser4 partition (not recommended) you will need to use [[LILO]]. This is not advised, as you will probably get an error when trying to update {{ic|lilo.conf}}:
 +
# lilo
  
===Install and reboot===
+
4. Reboot
You'll have to install the new packages, and update your kernel and your bootloader. Before updating it's recommended a good practice to backup {{Filename|/boot/grub/grub.cfg}} and to first make sure it all works.
 
  
Remember to run lilo as root if you choose it as bootloader.
+
{{Note|The following steps are for using Reiser4 as your / (root, including /boot). If you just want to use Reiser4 as root with /boot mounted on the [[ESP]] you should modify the following instructions according to your needs.}}
  
 
==Moving to Reiser4==
 
==Moving to Reiser4==
In the next steps we'll copy the data from your current root partition to the new Reiser4 partitions. Make
+
In the next steps we will copy the data from your current root partition to the new Reiser4 partitions. Make
sure you have enough disk space on the Reiser4 partition. You can check this disk information with '''df'''.
+
sure you have enough disk space on the Reiser4 partition with:
 +
# df -h
  
 
===Sample system===
 
===Sample system===
 
<pre>
 
<pre>
 +
# fdisk -l
 
* /dev/sda1: (10 Gb, 5 Gb free); Reiserfs /mnt/reiser4
 
* /dev/sda1: (10 Gb, 5 Gb free); Reiserfs /mnt/reiser4
 
* /dev/sda2: (10 Gb, 10 Gb free); Reiser4 /
 
* /dev/sda2: (10 Gb, 10 Gb free); Reiser4 /
Line 50: Line 82:
  
 
===Formatting===
 
===Formatting===
Run the following commands:
+
Since Reiser4 supports different transaction models optimized for different types of storage media (SSDs, HDDs), the options used while formatting and mounting will differ.
 +
 
 +
{{Note|For users with traditional HDDs, the defaults listed below will be enough.
 +
Keep in mind that the defaults for mkfs.reiser4 includes enabled compression with the default algorithm being Zstd.
 +
If one wishes to use either lzo or gzip instead of Zstd, it is needed to append <pre>-o compress=lzo1</pre> or <pre>-o compress=gzip1</pre>
 +
If one wishes to disable compression altogether, one must append:
 +
<pre>-o create=reg40</pre> to the <pre>mkfs.reiser4</pre> command.
 +
 +
Additionally, the inline checksum plugin can be enabled with <pre>-o node=node41</pre>
 +
More information about the features, plugins and options is available [https://reiser4.wiki.kernel.org/index.php/Reiser4_Howto here.]}}
  
 +
{{Note|With '''X''' being your partition number!}}
 
<pre>
 
<pre>
mkfs.reiser4 /dev/sda1
+
mkfs.reiser4 /dev/sdaX
 
mkdir /mnt/reiser4
 
mkdir /mnt/reiser4
mount -t reiser4 /dev/sda1 /mnt/reiser4
+
mount -t reiser4 -o txmod=journal,noatime,onerror=remount-ro /dev/sdaX /mnt/reiser4
 
</pre>
 
</pre>
  
It is recommended that you use the amazing Cryptcompress plugin by formatting with the following command:
+
It is recommended and also the default to use the '''Cryptcompress''' plugin by formatting with the following options:
<pre>
+
</pre> mkfs.reiser4 -o create=ccreg40 /dev/sda'''X'''</pre>
mkfs.reiser4 -o create=ccreg40,compress=lzo1 /dev/hda1
+
 
 +
Since Reiser4 also has options specifically for SSD users as well, it is recommended to discard the partition upon creation of the filesystem,
 +
the '''-d''' switch can be applied as shown below:
 +
 
 +
<pre>mkfs.reiser4 -d -o create=ccreg40,compress=Zstd1 /dev/nvme0n1X
 
</pre>
 
</pre>
 +
 +
For drives with controllers already having hardware compression (like SandForce ones), it may be better to to disable the compression plugin.
 +
 +
For HDDs:
 +
<pre>mkfs.reiser4 -o create=reg40,node=node41 /dev/sdX</pre>
 +
 +
For SSDs:
 +
<pre>mkfs.reiser4 -d -o create=reg40,node=node41 /dev/nvme0n1pX</pre>
  
 
===Copy system===
 
===Copy system===
Once the partition is formated, copy you current system to the new partition and create the system directories. You may either do this from Arch Linux, or '''to make it easier''' (so that you don't have to use makedev later), just '''boot up with the PLD Rescue CD and mount both your new Reiser4 partition and your current root partition. Then, just copy everything over (as root) like so:
+
Once the partition is formatted, copy you current system to the new partition and create the system directories. You may either do this from Arch Linux, or '''to make it easier''' (so that you do not have to use makedev later), just '''boot up with the [http://gparted.sourceforge.net/livecd.php Gparted LiveCD] and mount both your new Reiser4 partition and your current root partition. Then, just copy everything over (as root) like so:
'''
+
 
 
<pre>
 
<pre>
 
cd /mnt
 
cd /mnt
 
mkdir oldroot
 
mkdir oldroot
 
mkdir reiser4
 
mkdir reiser4
mount /dev/sda1 oldroot
+
mount /dev/sdaX oldroot
mount /dev/sda2 reiser4 (the Reiser4 partition)
+
</pre>
 +
 
 +
Depending on what transaction model one wish to use which are optimized for different types of storage media, the mount option '''txmod=wa''' (for SSDs), '''txmod=journal''' (for HDDs) must be defined when mounting the partitions through the '''-o''' switch. The default is '''txmod=hybrid''' which heuristically alternates between the "wa" (write-anywhere) and "journal" models for optimized performance on rotating disks while trying to avoid excess fragmentation at the same time.
 +
 
 +
<pre>
 +
mount -t reiser4 -o txmod=hybrid,noatime,onerror=remount-ro /dev/sdaY reiser4 (the Reiser4 partition)
 
cp -R -a /mnt/oldroot/* /mnt/reiser4/
 
cp -R -a /mnt/oldroot/* /mnt/reiser4/
 
</pre>
 
</pre>
  
Then, you need to mount your /boot partition, and if you haven't already, copy /boot from your original root partition over to it. Note that it is suggested you remove /boot from your new Reiser4 partition and then make an empty folder called boot in the root of the partition to use as a mountpoint for it, which is reflected later in your fstab.
+
Then, you need to mount your {{ic|/boot}} partition, and if you have not already, copy {{ic|/boot}} from your original root partition over to it.
 +
{{Note|It is suggested to empty your /boot from the Reiser4 partition to use it as a mountpoint, which is reflected later in your fstab}}
  
 
<pre>
 
<pre>
 
mkdir bootpart
 
mkdir bootpart
mount /dev/sda3 bootpart
+
mount /dev/sdaZ bootpart
 
cp -R -a /mnt/oldroot/boot/* /mnt/bootpart/
 
cp -R -a /mnt/oldroot/boot/* /mnt/bootpart/
 
</pre>
 
</pre>
  
Don't forget to edit your bootloader's config appropriately (see examples at the bottom of the article). Should you upgrade grub, note that before rebooting you may need to manually install grub to your /boot partition, otherwise, things may break and prevent you from booting, in which case using a livecd to chroot and fix it would be your last hope.
+
Do not forget to edit your bootloader's config appropriately (see examples at the bottom of the article).  
 +
 
 +
{{Note|In case you upgraded grub before rebooting you may need to manually install grub to your /boot partition, otherwise, things may break and prevent you from booting. In this case using a LiveCD to Chroot and would be your last hope.}}
  
====/reiser4/etc/fstab:====
+
===/etc/fstab:===
  
Note: If Reiser4 works out well for you, I'd (at least in the sample system) format the old root partition once everything is confirmed working with a stable fs and use it for storage.
+
Note: If you can confirm that Reiser4 works for you, you should format the old root partition.
  
<pre>
+
{{bc|1=#
#  
 
 
# /etc/fstab: static file system information
 
# /etc/fstab: static file system information
 
#
 
#
# <file system>       <dir>         <type>   <options>          <dump> <pass>
+
# <file system> <dir>       <type> <options>         <dump> <pass>
none                  /dev/pts      devpts    defaults            0      0
 
none                  /dev/shm      tmpfs    defaults            0      0
 
tmpfs                  /tmp          tmpfs    defaults            0      0
 
usbfs                  /proc/bus/usb usbfs    defaults            0      0
 
 
 
/dev/cdroms/cdrom0    /mnt/cd  iso9660  ro,user,noauto,unhide  0      0
 
/dev/cdroms/cdrom0    /mnt/dvd  udf      ro,user,noauto,unhide  0      0
 
  
/dev/sda1              reiser4           defaults,noatime,nodiratime,notail          0     1
+
/dev/nvme0n1p1  /            reiser4 noatime,txmod=wa,onerror=remount-ro,discard 0   1
/dev/sda2             /mnt/storage        ext3      defaults           0     0
+
/dev/sda2       /mnt/oldroot  ext4    defaults                                   0   0
/dev/sda3             /storage              ext2   defaults           0     1
+
/dev/sda3       /boot        ext2   defaults                                   0   1
</pre>
+
}}
  
 
== Bootloader Examples ==
 
== Bootloader Examples ==
  
====/boot/grub/menu.lst:====
+
====/boot/grub/grub.cfg:====
(on ext2 /boot partition, mind you)
+
{{bc|1=
 
 
<pre>
 
color light-blue/black light-cyan/blue
 
timeout 0
 
default 0
 
 
 
 
# (0) Arch Linux
 
# (0) Arch Linux
 
title  Arch Linux
 
title  Arch Linux
root   (hd0,1) '''# You will have to change this to appopriately point to your /boot partion'''
+
set root=(hd0,msdos3)
kernel /boot/vmlinuz26zen '''root=/dev/sdaX''' ro noatime nodiratime notail acl init=/sbin/bootchartd
+
kernel /vmlinuz-linux root=/dev/sda3 ro rootfstype=reiser4 rootflags=noatime,txmod=journal,onerror=remount-ro init=/usr/bin/bootchartd
initrd /boot/kernel26zen.img
+
initrd /initramfs-linux.img
  
 
# (1) Arch Linux
 
# (1) Arch Linux
 
title  Arch Linux Fallback
 
title  Arch Linux Fallback
root   (hd0,1) '''# You will have to change this to appopriately point to your /boot partion'''
+
set root=(hd0,msdos3)
kernel /boot/vmlinuz26 '''root=/dev/sdaX''' ro
+
kernel /vlinuz-linux root=/dev/sda3 ro rootfstype=reiser4 rootflags=noatime,txmod=journal,onerror=remount-ro
initrd /boot/kernel26.img
+
initrd /initramfs-linux-fallback.img
 +
}}
  
# (1) Windoze
+
Run {{ic|grub-mkconfig}} to update your config:
#title Windows
+
  # grub-mkconfig -o /boot/grub/grub.cfg
#rootnoverify (hd0,1) '''# You will have to change this to appopriately point to your /boot partion'''
 
#makeactive
 
#chainloader +1
 
</pre>
 
  
 
====/etc/lilo.conf:====
 
====/etc/lilo.conf:====
Line 152: Line 197:
 
compact
 
compact
  
image=/boot/vmlinuz26beyond
+
image=/boot/vmlinuz-linux
 
         label=Arch4
 
         label=Arch4
 
         root=/dev/hda5
 
         root=/dev/hda5
 
         append="video=vesafb:1024x768-24@56,ywrap,mtrr splash=verbose,theme:darch console=tty1 resume2=swap:/dev/hdb1"
 
         append="video=vesafb:1024x768-24@56,ywrap,mtrr splash=verbose,theme:darch console=tty1 resume2=swap:/dev/hdb1"
initrd=/boot/initramfs-beyond.img
+
initrd=/boot/initramfs-linux.img
 
read-only
 
read-only
  
image=/boot/vmlinuz26beyond
+
image=/boot/vmlinuz-linux
 
         label=Arch
 
         label=Arch
 
         root=/dev/hda3
 
         root=/dev/hda3
 
         append="video=vesafb:1024x768-24@56,ywrap,mtrr splash=verbose,theme:darch console=tty1 resume2=swap:/dev/hdb1"
 
         append="video=vesafb:1024x768-24@56,ywrap,mtrr splash=verbose,theme:darch console=tty1 resume2=swap:/dev/hdb1"
initrd=/boot/initramfs-beyond.img
+
initrd=/boot/initramfs-linux.img
 
read-only
 
read-only
 
</pre>
 
</pre>
  
'''Run lilo''' to install new kernels.
+
Run '''lilo''' to update your config:
 
+
# lilo
===Done===
 
You are hopefully done now, you can reboot your system and try to run the 'new' reiser4 installation.
 
If you plan to format /dev/sda3, make sure you run lilo or grub from the new system and configure them like above.
 
  
==Possible Issues==
+
==Troubleshooting==
 
* Permissions: chown -R username.group <userdir>
 
* Permissions: chown -R username.group <userdir>
* If you have problem with "su" command after the change of fs, you should reinstall coreutils package.
+
* If you have problem with '''su''' command after the change of fs, you should reinstall '''coreutils''' package.
* The first time you start the new system, no modules are loaded:
 
** Run '''hwdetect --load-modules'''
 
** Restart some daemons from /etc/rc.d
 
** Everything works fine now and the next time you reboot.
 
 
 
==External Links==
 
* [http://en.wikipedia.org/wiki/Reiser4 Reiser4] from Wikipedia.org
 
 
 
==Credits==
 
Special thanks to Itlain for this article.
 

Latest revision as of 18:39, 2 May 2019

Reiser4 is the successor filesystem for ReiserFS, initially designed and developed entirely from scratch by Namesys and Hans Reiser. It is very efficient in handling many files (often used in /var for this purpose) and includes a plugin-based design with plugins with features such as intelligent transparent compression, both inline data and meta-data checksums through the crc32c algorithm with added optional mirrors and failover support through its own implementation of subvolumes.

Reiser4 supports different transaction models optimized for different types of storage devices. These include Write-Anywhere (or CoW), journal and a unique combination of the two called hybrid. Reiser4's main goals is performance as well as the modular nature which can expand features of the file system more easily, as well as the implementations that make it less prone to both data loss and corruption because of it's atomic approach in regards to every transaction that it performs. In the hybrid transaction model, Reiser4 heuristically alternates between journaling and Write-Anywhere/Copy-on-Write and is also the default if no mount option is specificed and this transaction model is optimized primarily for performance for rotating disks (while Write-Anywhere is aimed towards SSDs). However, in hybrid mode, it will result in more fragmentation compared to the journal transaction model over time.

However, Reiser4's journaling model (in both hybrid or journal modes) is more efficient than regular journaling file systems in that instead of traditional journaling, Reiser4 uses a more advanced technique known as wandering logs which provides journaling without having to write data to the disk twice thus reducing writes. In many cases, Reiser4 can write journal data to a disk block, then atomically swap the journal block into the file itself which avoids having to write the data twice by changing one's definition of where the log area and the committed area are instead of moving the data from the log to the committed area.

Another unique feature is the implementation of a special technique for SSD users called Precise Asynchronous Discard. This implementation means that in Reiser4, issuing discard requests is a delayed action, which is performed on a per-atom basis at transaction commit time. It allows to reduce number of discard requests issued (because the merging of extents, which needs to be discarded) and eliminates the need for issuing discards periodically as well, thus removing the need to set up an external tool like fstrim through a cron daemon which issues discard requests on a schedule.

Additionally, it also features block suballocation and is built on the dancing tree design, which was exclusively invented for the use with Reiser4 and is also one of the several unique but also fundamental differences when compared to every other file system in general. The idea behind the dancing tree approach is to speed up file system operations by delaying optimization/balancing of the tree and only writing to disk when necessary, as writing to disk is much slower than writing to memory. Because this optimization is done less often than with other tree data structures like B+ tree's or B- tree's, the optimizations and performance gains can be more extensive.

Because it is designed as an atomic file system, "your file system operations either entirely occur, or they entirely don't, and they do not corrupt due to half occurring." What this means in practice is that all operations in Reiser4 are atomic. In the case of very long writes, Reiser4 is forced to close transactions to free dirty pages in a response to memory pressure and thus, long writes in Reiser4 are split into a number of atomic writes to maintain is atomicity. However, current lead developer, mathematician and programmer PhD Edward Shishkin has suggested a change to full atomicity (atomic writes of any length) in the Write-Anywhere transaction model, where atoms can be flushed without closing a transaction.

It's core design is very modular and allows for easy integration of new modules (called "plugins"). According to the developers, because of the modular design, Reiser4 can quite easily be ported to other operating systems like FreeBSD. As of 2019, Linux is still the only operating system Reiser4 is known to be compatible with.

Synthetic benchmarks and speed comparisons between Reiser4, Btrfs and Ext4 are available, as well as benchmarks that include comparisons between the different transaction models and with/without the cryptcompress plugin.


More information about the features, plugins, design and mkfs or mount options is described in detail here.


Important Notes

  • Reiser4 requires a patched kernel. A custom Linux-ck based kernel with Reiser4 patches is available as linux-ck-reiser4AUR
  • It consumes a little more CPU than other filesystems (just like Btrfs). To avoid having issues on laptops using TLP for power saving, it is recommended to disable the options for SATA Link power saving in /etc/default/tlp (again, as with Btrfs).
  • Even LILO as the only bootloader officially supporting Reiser4 seems to have issues with it when /boot is formatted as Reiser4
  • It is still not included in the official Linux kernel, but patches for Linux-5.x is already available.
  • Access Control Lists is not implemented and as of linux-5.x.x requires that Systemd/Journal either logs to a seperate logging daemon or to Tmpfs. Another workaround is to compile systemD by source without ACL support, but is not recommended.


Tip: Gparted LiveCD is a small Linux distribution booting straight into Gparted. It also supports Reiser4 and can be used to migrate from an existing filesystem to Reiser4

Packages

1. Install the reiser4progsAUR package which provides utilities for creating, fsck'ing and debugging Reiser4 volumes.

2. You will need a Reiser4 patched kernel. Patches can be found here or at the more recently created Git repository which is maintained by it's current lead developer, the mathematician and programmer Edward Shishkin.

3. Bootloader (Optional, only needed if you want to format your / (root, including /boot) as Reiser4)

Note: Backing up your bootloader configuration file should be considered if one is going to have /boot residing on a Reiser4 volume.

a) Recommended: make a small (as mentioned above, 20-200mb) partition for /boot with a filesystem other than Reiser4 with GParted, and then copy your /boot folder to the partition. Update your bootloader config accordingly, eg. with Grub2 do:

# grub-mkconfig -o /boot/grub/grub.cfg. 
Note: EFI systems in general require a FAT32 partition for booting the kernel and thus it may be advantageous or unproblematic to have the /boot directory residing on that partition instead of only the EFI directory. Many EFI-users have their whole /boot directory on their ESP

b) If you do not use EFI and wish to put everything including /boot on a Reiser4 partition (not recommended) you will need to use LILO. This is not advised, as you will probably get an error when trying to update lilo.conf:

# lilo

4. Reboot

Note: The following steps are for using Reiser4 as your / (root, including /boot). If you just want to use Reiser4 as root with /boot mounted on the ESP you should modify the following instructions according to your needs.

Moving to Reiser4

In the next steps we will copy the data from your current root partition to the new Reiser4 partitions. Make sure you have enough disk space on the Reiser4 partition with:

# df -h

Sample system

# fdisk -l
* /dev/sda1: (10 Gb, 5 Gb free); Reiserfs /mnt/reiser4
* /dev/sda2: (10 Gb, 10 Gb free); Reiser4 /
* /dev/sda3: (200 Mb, 180 Mb free); ext2 /boot

Formatting

Since Reiser4 supports different transaction models optimized for different types of storage media (SSDs, HDDs), the options used while formatting and mounting will differ.

Note: For users with traditional HDDs, the defaults listed below will be enough.

Keep in mind that the defaults for mkfs.reiser4 includes enabled compression with the default algorithm being Zstd.

If one wishes to use either lzo or gzip instead of Zstd, it is needed to append
-o compress=lzo1
or
-o compress=gzip1

If one wishes to disable compression altogether, one must append:

-o create=reg40
to the
mkfs.reiser4
command. Additionally, the inline checksum plugin can be enabled with
-o node=node41
More information about the features, plugins and options is available here.
Note: With X being your partition number!
mkfs.reiser4 /dev/sdaX
mkdir /mnt/reiser4
mount -t reiser4 -o txmod=journal,noatime,onerror=remount-ro /dev/sdaX /mnt/reiser4

It is recommended and also the default to use the Cryptcompress plugin by formatting with the following options:

mkfs.reiser4 -o create=ccreg40 /dev/sdaX

Since Reiser4 also has options specifically for SSD users as well, it is recommended to discard the partition upon creation of the filesystem, the -d switch can be applied as shown below:

mkfs.reiser4 -d -o create=ccreg40,compress=Zstd1 /dev/nvme0n1X

For drives with controllers already having hardware compression (like SandForce ones), it may be better to to disable the compression plugin.

For HDDs:

mkfs.reiser4 -o create=reg40,node=node41 /dev/sdX

For SSDs:

mkfs.reiser4 -d -o create=reg40,node=node41 /dev/nvme0n1pX

Copy system

Once the partition is formatted, copy you current system to the new partition and create the system directories. You may either do this from Arch Linux, or to make it easier (so that you do not have to use makedev later), just boot up with the Gparted LiveCD and mount both your new Reiser4 partition and your current root partition. Then, just copy everything over (as root) like so:

cd /mnt
mkdir oldroot
mkdir reiser4
mount /dev/sdaX oldroot

Depending on what transaction model one wish to use which are optimized for different types of storage media, the mount option txmod=wa (for SSDs), txmod=journal (for HDDs) must be defined when mounting the partitions through the -o switch. The default is txmod=hybrid which heuristically alternates between the "wa" (write-anywhere) and "journal" models for optimized performance on rotating disks while trying to avoid excess fragmentation at the same time.

mount -t reiser4 -o txmod=hybrid,noatime,onerror=remount-ro /dev/sdaY reiser4 (the Reiser4 partition)
cp -R -a /mnt/oldroot/* /mnt/reiser4/

Then, you need to mount your /boot partition, and if you have not already, copy /boot from your original root partition over to it.

Note: It is suggested to empty your /boot from the Reiser4 partition to use it as a mountpoint, which is reflected later in your fstab
mkdir bootpart
mount /dev/sdaZ bootpart
cp -R -a /mnt/oldroot/boot/* /mnt/bootpart/

Do not forget to edit your bootloader's config appropriately (see examples at the bottom of the article).

Note: In case you upgraded grub before rebooting you may need to manually install grub to your /boot partition, otherwise, things may break and prevent you from booting. In this case using a LiveCD to Chroot and would be your last hope.

/etc/fstab:

Note: If you can confirm that Reiser4 works for you, you should format the old root partition.

#
# /etc/fstab: static file system information
#
# <file system>	<dir>	      <type>  <options>	         <dump>	<pass>

/dev/nvme0n1p1  /             reiser4 noatime,txmod=wa,onerror=remount-ro,discard 0   1
/dev/sda2       /mnt/oldroot  ext4    defaults                                    0   0
/dev/sda3       /boot         ext2    defaults                                    0   1

Bootloader Examples

/boot/grub/grub.cfg:

# (0) Arch Linux
title  Arch Linux
set root=(hd0,msdos3)
kernel /vmlinuz-linux root=/dev/sda3 ro rootfstype=reiser4 rootflags=noatime,txmod=journal,onerror=remount-ro init=/usr/bin/bootchartd
initrd /initramfs-linux.img

# (1) Arch Linux
title  Arch Linux Fallback
set root=(hd0,msdos3)
kernel /vlinuz-linux root=/dev/sda3 ro rootfstype=reiser4 rootflags=noatime,txmod=journal,onerror=remount-ro
initrd /initramfs-linux-fallback.img

Run grub-mkconfig to update your config:

# grub-mkconfig -o /boot/grub/grub.cfg

/etc/lilo.conf:

#
# /etc/lilo.conf
#

boot=/dev/hda
# This line often fixes L40 errors on bootup
# disk=/dev/hda bios=0x80

default=Arch4
timeout=20
lba32
prompt
compact

image=/boot/vmlinuz-linux
        label=Arch4
        root=/dev/hda5
        append="video=vesafb:1024x768-24@56,ywrap,mtrr splash=verbose,theme:darch console=tty1 resume2=swap:/dev/hdb1"
initrd=/boot/initramfs-linux.img
read-only

image=/boot/vmlinuz-linux
        label=Arch
        root=/dev/hda3
        append="video=vesafb:1024x768-24@56,ywrap,mtrr splash=verbose,theme:darch console=tty1 resume2=swap:/dev/hdb1"
initrd=/boot/initramfs-linux.img
read-only

Run lilo to update your config:

# lilo

Troubleshooting

  • Permissions: chown -R username.group <userdir>
  • If you have problem with su command after the change of fs, you should reinstall coreutils package.