Reiser4
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.
More information about the features, plugins, design and mkfs or mount options is described in detail here.
Important Notes
- Reiser4 requires a patched kernel.
- 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.
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 its 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)
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 configuration accordingly, eg. with Grub2 do:
# grub-mkconfig -o /boot/grub/grub.cfg.
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
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.
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=lzo1or
-o compress=gzip1
If one wishes to disable compression altogether, one must append:
-o create=reg40to the
mkfs.reiser4command. Additionally, the inline checksum plugin can be enabled with
-o node=node41More information about the features, plugins and options is available here.
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.
mkdir bootpart mount /dev/sdaZ bootpart cp -R -a /mnt/oldroot/boot/* /mnt/bootpart/
Do not forget to edit your bootloader's configuration appropriately (see examples at the bottom of the article).
/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
Then run:
# 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
Then run:
# 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.