XFS hint

Carsten Menke bootsy52 at gmx.net
Sun Jan 13 17:29:02 PST 2002


Attached is my xfs hint. It's my first hint ever, so I hope that it is
clear and helpfull.

Carsten
-- 
Registered Linux User #228992
-------------- next part --------------
TITLE:		Changing from ext2 to xfs hint
LFS VERSION:	3.1+
AUTHOR:		Carsten Menke <bootsy52 at gmx.net>

SYNOPSIS:
	How to change from ext2 to xfs after the LFS is installed.
	
HINT:
ext2 to xfs hint
Jan 13th 2002 Ver. 1.0b

Intro
-----

Today everybody is talking of journaling filesystems. This document describes
how to get your LFS working with journaled filesystem. I have choosen xfs, 
because I find it reliable and stable.

Requirements
------------

You need your Host Linux Distribution, you had as well needed for the LFS
Installation.

You need the kernel patch, which matches your Kernel version. e.g. for the
3.1 Book you need xfs-2.4.16-all-i386.bz2 (asuming you have the kernel 
of the book installed and your architecture is i386). Look that you download
the package named xfs-kernelversion-all-architecture.bz2 and NOT the splitted 
ones. 

You can download the kernel patches at:

ftp://oss.sgi.com/projects/xfs/download/patches/
for a 2.5 kernel
ftp://oss.sgi.com/projects/xfs/download/patches-2.5

Further more you need the xfs tools, which can be downloaded here:

ftp://oss.sgi.com/projects/xfs/download/cmd_tars

Shortcuts
---------

I will use the following shortcuts in this document, so I explain them here.

$LFS = the Mountpoint to your LFS installation (e.g. /mnt/LFS )
$MNT = Mountpoint directory (e.g. /mnt )
$K-VERSION = Your Kernel version
$XFS-PATCH = the patch you dowloaded for your kernel version. 
	    (xfs-2.4.16-all-i386.bz2)
$HOST-DISTRO = Host Distribution, from where you make the changes to LFS.
	    (Mandrake,SuSE,Redhat or whatever)
$LFS-DEVICE = The device your LFS Partition is on (e.g. /dev/hda8)
$HOST-DEVICE = The device your Host Distribution is on (e.g. /dev/hda1)

Description
------------
1.	 Boot your $HOST-DISTRO system.

Mount your LFS partition

2.	mount -t ext2 $LFS-DEVICE $LFS

----------------------------------------------------------
3. 	!! Enter the chroot'ed area as described in the book !!
-----------------------------------------------------------

4. 	Download the necessary packages.

After you have downloaded all packages, copy $XFS-PATCH to the directory
where your kernel Sources are located. (e.g. /usr/src/linux ) contrary to 
other kernel patches, you have to copy this patch in the kernel directory 
NOT to the top directory of the kernel sources.

5. 	Patch your kernel by running:
  	bzip2 -dc $XFS-PATCH | patch -p1

If you have dowloaded the correct patch everything should go well.

Now recompile your kernel by running:

6.	make mrproper &&
	make menuconfig &&
	make bzImage &&
	make modules &&
	make modules_install
	cp System.map /boot &&
	cp arch/i386/boot/bzImage /boot/lfs-kernel

**Site Note: mrproper deletes your config settings, so make sure you have them
  saved somewhere, make menuconfig is to check that under menu <File-Systems> 
  SGI xfs is checked.**

To save ourselves some hassle we do compile the xfs filesystem NOT as a module,
but directly into the kernel. Feel free to change that on your own.

The next step is to build the xfsprogs package, to do so unpack it somewhere
with:

7.	tar xvfj xfsprogs-version.tar.bz2 

and compile xfsprogs with:

8.	make configure &&
	./configure --prefix=/usr --exec-prefix=/ --localstatedir=/var \
	--mandir=/usr/share/man &&
	make &&
	make install &&
	make distclean

That's it for the first.
-------------------------------------- 
9.	!!Exit the chroot'ed Area with exit !!
---------------------------------------

Now, you have 2 options, either copy your Kernel from
LFS to your $HOST-DISTRO or to patch and recompile the kernel of your
$HOST-DISTRO as well as you have done right before.

I assume you want to copy the kernel from your LFS distribution. To do so:

10. cp $LFS/boot/lfs-kernel /boot

modify /etc/lilo.conf of your $HOST-DISTRO so that you could boot your
$HOST-DISTRO with your lfs-kernel.

11.	image = /boot/lfs-kernel
   	label = LFS
  	root = $HOST-DEVICE
  	read-only
   
after that run /sbin/lilo

Now repeat step 8 and compile the xfsprogs package again.

When you have reached so far, you should now be awake, drink enough coffee,
what now follows is the dangerous part.

Pack your complete partition and save it somewhere where you have enough room
for the COMPLETE LFS Partition. You should check the amount of disk space
which LFS uses bye:

12.	df -h 

Mine was already 1.2 GB. But fortunatley bzip2 has a strong 
compression, so that I shrinked it down to 227 MB.

To finally pack your partiton:

13.	tar cfj /path/to/enough-Room/LFS.tar.bz2 $LFS/*

This will take some time.

When finished, reboot your system with your lfs kernel.

14. reboot

Create the xfs filesytem for your LFS Partition by:

15.	/sbin/mkfs.xfs -f /dev/$LFS-DEVICE

Mount the newly created filesystem with:

16.	mount -t xfs /dev/$LFS-DEVICE $LFS

Change to the Mount directory:

17.	cd $MNT

unpack your partition to your newly created filesystem:

18.	tar xvfj /path/to/LFS.tar.bz2

Head's up your nearly done.....
edit the fstab from your LFS:

19.	edit $LFS/etc/fstab

and change ext2 to xfs for the / Mountpoint.

Change your lilo.conf from your $HOST-DISTRO back so that it points
to the $LFS-DEVICE of your LFS Partition again:

20.	image = /boot/lfs-kernel
   	label = LFS
   	root = $LFS-DEVICE
   	read-only
   
run /sbin/lilo


21. reboot

WELCOME to Journalized LFS :-)


More information about the hints mailing list