Search:  
Gentoo Wiki

HOWTO_Update_reiser4_partitions

This article is part of the HOWTO series.
Installation Kernel & Hardware Networks Portage Software System X Server Gaming Non-x86 Emulators Misc

Contents

Warning!

This paragraph is completely outdated. "Latest" refers to circa march 2005! This issue concerns using an R4 partition created with a kernel <2.6.12 and mounting it on a later one. It seems an unlikely situation now. If you think it applies to you, read on. In either case ignore the arbitary reference to a fictitious version 1.0.6+ .

The latest Reiser4 version 1.0.5 is known to have bugs that can and will cause damage to an existing Reiser4 partition formated with an earlier version.

Quote from the creator of the Reiser4 FS.

"I apologize that the latest reiser4 with the cleanups requested by Hellwig is more than a bit of a turkey (due to bugs in our cleanups). We just now sent some patches which will improve things, but I don't yet have confidence in the code, and will not until we go for two weeks with no reports of problems. It may also be that the new to -mm write throttling patch is causing us problems, we are still investigating."

Hans

I recommend you do not attempt to upgrade your Reiser4 version until the release of 1.0.6+. This means you may have to stay on an older kernel that supports your Reiser4 version. Even simply attempting to run a fsck --check can cause corruption with 1.0.5.

The rest of this guide however is still applicable for a general method of converting your filesystem.

Background

Have you formatted a partition with reiser4, only to find that it's become outdated by a new reiser4 / reiser4progs release? Well, there's an easy way to update reiser4 using only a couple of LiveCDs and a few commands. No need to reformat!

Backing Up

You should realize that although I've tested this method myself with no harmful side-effects or data loss, when dealing with upgrades of this proportion you should ALWAYS backup your data. The following commands will backup your / partition to /backup.tbz2:

mkdir /mnt/tmp
mount -o bind / /mnt/tmp
cd /mnt/tmp
tar --exclude backup.tbz2 -cvvpjf backup.tbz2 .
cd /
umount /mnt/tmp

How this works: First a temporary directory is created for remounting the file system without special files. Special files include things in /proc and /sys which you do not want to backup as they are created dynamically by the kernel. The mount command does the actual remount. The tar command creates and compresses the backup image. This can take awhile, especially for systems with lots of data.

And FYI, it may seem obvious, but you probably will want to keep this backup file on some partition OTHER than the one you're upgrading ;)

A more sophisticated method to create a full system backup is described here. The gentoo forum post is located here. It does the very same thing while excluding unnecessary folder and files and giving you the possibility of finetuning.

Required materials

All you should need is the latest RIP LiveCD here.

Configuring the kernel

You'll need to patch your kernel with the latest reiser4 patch. Preferably, this is done with an -mm kernel version, which is Linus' testbed for new features that may be added to future, stable kernels. The mm-sources that are in portage no longer need to be patched for reiser4, as did previous versions. However, to be able to see the reiser4 options while configuring the kernel, you have to enable "Prompt for development and/or incomplete code/drivers" and disable 4k-stacks in the "Kernel hacking" section (this is default menuconfig behavior; if you manage to use 4k stacks with a reiser4 filesystem, your kernel will oops / panic soon after boot - believe me, I tried :P ).

Of course, if you don't want to use an experimental kernel (which is perfectly understandable!), then get the ck-sources overloaded kernel-patch from here: http://kem.p.lodz.pl/~peter/cko/ and apply it to the vanilla kernel. The ck-source is Con Kolivas' kernel patchset that improves kernel performance and is very stable. Since 2.6.8.1-ck8 Con no longer sports a reiser4 patch due to time constraints, so you'll want the "overloaded" version which is his -ck patchset + a bunch of new features, including reiser4.

Note that as with the -mm patch in portage, 4k stacks MUST be disabled and "Prompt for development and/or incomplete code/drivers" MUST be ENabled for reiser4 to show up.

Chrooting

Boot from the RIP CD and CHROOT into gentoo, as the below shows. We chroot only to update reiser4progs, then we get out of the chroot. What these commands do:

  1. Create a mount point.
  2. Mount. Change 'X' to the partition number your reiser4 filesystem is on!
  3. Mount the virtual filesystem, proc.
  4. Actually chroot -- which changes the location of "/" . For all intents and purposes, you are now in your personal Gentoo environment; everything is same, except the kernel, which is provided with the RIP cd.
  5. Set default environmental variables, such as $PATH.
mkdir /mnt/gentoo
mount -t reiser4 /dev/hdaX /mnt/gentoo
mount -t proc none /mnt/gentoo/proc
chroot /mnt/gentoo /bin/bash
source /etc/profile

Update process

Now issue the following in a command prompt.

echo "sys-fs/reiser4progs ~arch" >> /etc/portage/package.keywords
echo "sys-libs/libaal ~arch" >> /etc/portage/package.keywords
emerge reiser4progs

Once the emerge is completed, reboot into the RIP LiveCD, if you're not already using it. Either way, unmount all current drives and partitions. DO NOT do the following inside a chroot or while anything is mounted. You CAN NOT attempt to change a filesystem while it is mounted and running, or else you will get a segmentation fault and may risk permanent corruption! You can unmount your reiser4 filesystem via the following commands:

exit
cd /
umount /mnt/gentoo/proc
umount /mnt/gentoo

If you get a "device is busy" error, then reboot (back into the RIP cd) to forcefully unmount your drives. Once you've done this, execute the following commands to update.

NOTE: Change /dev/hdaX to the location of the reiser4 partition you wish to update. Do that throughout this process.
fsck.reiser4 --fix /dev/hdaX
fsck.reiser4 --build-sb /dev/hdaX
debugfs.reiser4 -C /dev/hdaX
fsck.reiser4 --fix /dev/hdaX

What's going here is:

  1. "fsck.reiser4 --fix" -- Checking your filesystem for errors.
  2. "fsck.reiser4 --build-sb" Rebuild the superblock.
  3. "debugfs.reiser4 -C" Use the reiser4 converter, which updates the fs.
  4. "fsck.reiser4 --fix" Check for errors once more (very important - new errors are a certainty after update)


All that's left to do now is reboot. Do so and enjoy your updated reiser4 filesystem!

Retrieved from "http://www.gentoo-wiki.info/HOWTO_Update_reiser4_partitions"

Last modified: Thu, 15 Feb 2007 13:59:00 +0000 Hits: 39,352