Linux distributors do not enable you to install onto a Reiser4 partition (a partition formated with the Reiser4 filesystem). This means that installing your favorite distribution on a Reiser4 partition, is harder than usual. Still, it is not that hard.
First, you need three partitions:
1) a partition with your favorite distribution installed on it,
2) two empty partitions that are large enough to hold the contents of the first.
My favorite distribution was on /dev/sda2 and I chose /dev/sda3 and /dev/sda6 as the empty partitions. Therefore, this guide will follow that partition numbering. /dev/sda2 was formated with Reiser3=reiserfs, but it could have been any filesystem your rescue CD, or some other partition on your computer, has support for.
What we will do is the following:
1) Boot /dev/sda2 and add a kernel that understands Reiser4.
2) Compile the Reiser4 programs (requires aal libraries).
3) Format /dev/sda6 with a filesystem of your choice.
4) Format /dev/sda3 with Reiser4.
5) Boot a rescue CD, or some other Linux partition, and use it to copy /dev/sda2 to /dev/sda6.
6) Boot /dev/sda2 again and copy /dev/sda6 to /dev/sda3.
7) Configure GRUB menu and /etc/fstab.
8) Delete/reformat /dev/sda6.
There are other permutations that get the job done. Of course, if your rescue CD (or some other partition) understands Reiser4, then you can copy /dev/sda2 directly to /dev/sda3. The reason for this long winded approach, is that you cannot copy a booted partition and expect to get an exact copy.
As usual, I assume you are the root user.
Download the following files and save them somewhere, like /src.
libaal-1.0.5.tar.gz from namesys.com, local copy here,
reiser4progs-1.0.6.tar.gz from namesys.com, local copy here.
So, let's get on with it.
Boot /dev/sda2 and recompile your kernel to understand Reiser4.
There are instructions for doing this here.
Make sure that you have compiled Reiser4 into the kernel.
reboot choosing your new Reiser4 understanding kernel.
Change to the /src directory and unpackage the tar archives, with:
cd /src/; for a in *.tar.*; do tar -xf $a; done
Compile the Reiser4 filesystem programs (version 1.0.6). These require the aal libraries:
Now compile the 1.0.6 version of reiser4progs:
Both reiser4progs and libaal are installed in /usr/local/. On SuSE systems, /usr/local/sbin is often missing from root's path. This means that your system will not be able to find the reiser4 programs. If this is the case, a temporary fix, is to reset the path variable, with:
For a permanent fix, add the following line to your /etc/bash.bashrc file.
if test "$UID"=0; then PATH=/usr/local/sbin:$PATH; fi
Another problem is that fsck.reiser4 cannot be found by the boot mechanism, so you need to create the symbolic link:
ln -st /sbin /usr/local/sbin/fsck.reiser4
Now you can format /dev/sda3 with the default Reiser4 filesystem, with:
Or, if you wish to use Reiser4's transparent compression, with either:
mkfs.reiser4 -o create=ccreg40,compress=gzip1 /dev/sda3 (uses gzip)
mkfs.reiser4 -o create=ccreg40,compress=lzo1 /dev/sda3 (uses lzo)
My favorite Linux distro (on a reiser3 partition) occupied 6.3 gigabytes. The same data, on the reiser4 partition, when using transparent gzip compression, weighed in at 2.7 gigabytes. This is quite a saving in a 10 gigabyte partition. There is no perceptible reduction in speed due to the use of compression.
Initially, this guide used Riffard's Reiser4 patch. However, if you use Riffard's plain Reiser4, you will have problems with file corruption. Although, I have never had any trouble with SuSE 10.0's Reiser4, or even Riffard's version when using transparent compression, I have already had problems with Riffard's plain Reiser4. Just a day or two with Riffard's plain Reiser4 and I have found files that have been zeroed out (and this is without any system crash or power outage).
You see, the Reiser4 saboteurs (a number of so called Linux kernel "developers") have arranged that Reiser4 will not work properly. However, they forgot to sabotage the more complex case of transparent compression, so we have the weird situation where the more complex case works fine, while the kernel "developers" "struggle" to get the simple case to work like it used to. The parts of Reiser4 they have not touched, still work, but where they have coded, Reiser4 no longer works properly.
For examples of this sabotage, see The Linux Kernel Saboteurs.
Since this article was first written, NameSys's 2.6.20 and 2.6.21 patches have become available. They are now used instead of Riffard's.
I chose to format /dev/sda6 with the reiserfs=reiser3 filesystem:
Now boot your rescue CD, or some other partition (not /dev/sda2). I used another Linux distro I had on partition /dev/sda7.
Once you have a terminal, mount /dev/sda6 on /6 and /dev/sda2 on /2:
mkdir /6; mount /dev/sda6 /6
mkdir /2; mount /dev/sda2 /2
Now, copy over the entire filesystem:
cd /2; tar -cpf - * | tar -C /6 -xvpf -
Now boot partition /dev/sda2.
Mount /dev/sda6 on /6 and the new Reiser4 partition, /dev/sda3, on /3 with:
mkdir /6; mount /dev/sda6 /6
mkdir /3; mount -t reiser4 /dev/sda3 /3
Again, copy over the entire filesystem:
cd /6; tar -cpf - * | tar -C /3 -xvpf -
If /dev/sda2 is not already your default root partition, then make it so with:
grub> root (hd0,1) (set default root partition to /dev/sda2)
grub> setup (hd0) (install GRUB to the MBR)
grub> quit (exit the GRUB shell)
Now you have to setup your /boot/grub/menu.lst file.
emacs /boot/grub/menu.lst &
I assume that after compiling and installing your new Reiser4 understanding kernel, it looks something like:
Yeap, Debian is now my preferred Linux distro. Add a new entry for the Reiser4 partition:
Before rebooting you need to adjust the /etc/fstab file on /dev/sda3:
emacs /3/etc/fstab & (note the /3/)
Change the root directory line (the line with mount directory /) to the following:
Now reboot again and choose the ".... My New Kernel 2.6.23 for Reiser4" from the GRUB menu.
You can now throw away (reformat) /dev/sda6. This leaves you with two copies of your favorite Linux distribution. The reason for two identical copies is just safety. When/if you decide to delete /dev/sda2, you must to remember that it contains the kernel and initrd for /dev/sda3, so you need to make arrangements for these to go elsewhere. They are often put on a separate, small partition that is mounted at /boot. Another option, is to compile a Reiser4 understanding GRUB for /dev/sda3.
If you have used plain vanilla Reiser4, then you can compile GRUB to understand Reiser4. This allows you to use your Reiser4 partition as the GRUB (default) root partition. This is not (yet) possible if you have used transparent compression.
A guide to installing a Reiser4 aware GRUB, can be found here.