Typo
[linux_from_scratch_hints.git] / OLD / xfs.txt
blobd889d093cff781eb9230a4b3c3bff10a0f7a6d64
1 TITLE:          Migrating to the xfs Filesystem
2 LFS VERSION:    3.3+ (3.1+ with Kernel >= 2.4.18)
3 AUTHOR:         Carsten Menke <bootsy52@gmx.net>
5 SYNOPSIS:
6         How to migrate LinuxFromScratch to xfs after LFS is installed.
7         
8 HINT:
9 migrate to xfs hint
10 Jan 18th 2003 Ver. 1.0
12 Intro
13 -----
15 Today everybody is talking of journaling filesystems. This document describes
16 how to get your LFS working with journaled filesystem. I have choosen xfs, 
17 because I find it reliable and stable.
19 Changelog
20 ----------
21 Ver 1.0 released Januar 04th 2003:
22  - Added the 'p' option to the tar command so that
23    the file permission are saved and restored.
24  - changed hint to not be only ext2 specific
25  - added note to inform about xfs snapshots
26  - added small faq
27  - added build instructions to install cmd_tar's.
29 Ver 1.0b released January 13th 2002 - initial release
31 Requirements
32 ------------
34 You need your Host Linux Distribution, you had as well needed for the LFS
35 Installation. The procedure described here is for the i386 architecture.
37 You need the kernel patch, which matches your Kernel version. e.g. for the
38 3.3 Book you need xfs-2.4.18-all.patch.bz2. Look that you download
39 the package named xfs-kernelversion-all-architecture.bz2 and *NOT* the splitted
40 ones. 
42 You can download the kernel patches at:
44 ftp://oss.sgi.com/projects/xfs/dowload/patches
45 for a 2.5 kernel
46 ftp://oss.sgi.com/projects/xfs/download/patches-2.5
48 NOTE: Releases are normally only available for the kernel version
49 which was up to date when the release came out. So the above patches are
50 usually snapshots, and not xfs releases. So if you want to be safe you'll
51 better download a xfs-RELEASE from (assuming you have the correct kernel):
53 ftp://oss.sgi.com/projects/xfs/download/Release-*
55 Further more you'll likely want the xfs tools, which can be downloaded here:
57 ftp://oss.sgi.com/projects/xfs/download/cmd_tars
59 Conventions
60 -----------
62 I will use the following conventions in this document, so I explain them here.
64 $LFS = the Mountpoint to your LFS installation (e.g. /mnt/LFS )
65 $MNT = Mountpoint directory (e.g. /mnt )
66 $K-VERSION = Your Kernel version
67 $XFS-PATCH = the patch you dowloaded for your kernel version. 
68             (xfs-2.4.18-all-i386.bz2)
69 $HOST-DISTRO = Host Distribution, from where you make the changes to LFS.
70             (Mandrake,SuSE,Redhat or whatever)
71 $LFS-DEVICE = The device your LFS Partition is on (e.g. /dev/hda8)
72 $HOST-DEVICE = The device your Host Distribution is on (e.g. /dev/hda1)
74 Description
75 ------------
77 1 MIGRATING LINUXFROMSCRATCH TO XFS
78 2 BUILDING XFS ADDITIONAL TOOLS
79 3 FAQ
81 1 MIGRATING LINUXFROMSCRATCH TO XFS
82 -----------------------------------
84 1.1     Boot your $HOST-DISTRO system.
86 1.2     Mounting the LFS partition
87         
88         mount -t ext2 $LFS-DEVICE $LFS
90 (Replace ext2 with the appropriate filesystem if you have another fileystem
91 then ext2 installed)
92 ---------------------------------------------------------------
93 1.3     !! Enter the chroot'ed area as described in the book !!
94 ---------------------------------------------------------------
96 1.4     Download the necessary packages.
98 After you have downloaded all packages, copy $XFS-PATCH to the directory
99 where your kernel Sources are located. (e.g. /usr/src/linux ) contrary to 
100 other kernel patches, you have to copy this patch *INTO* the kernel directory.
102 1.5     Patch your kernel by running:
103         
104         bzip2 -dc $XFS-PATCH | patch -p1
106 If you have dowloaded the correct patch everything should go well.
108 1.6     Recompile your kernel by running:       
109         
110         make mrproper &&
111         make menuconfig &&
112         make bzImage &&
113         make modules &&
114         make modules_install
115         cp System.map /boot &&
116         cp arch/i386/boot/bzImage /boot/lfs-kernel
118 ** Site Note: mrproper deletes your config settings, so make sure you have them
119   saved somewhere, use "make menuconfig" to enable SGI xfs, in the menu
120   <File Systems> **
122 To save ourselves some hassle we do compile the xfs filesystem NOT as a module,
123 but directly into the kernel. Feel free to change that on your own.
125 The next step is to build the xfsprogs package, to do so unpack it somewhere
126 with:
128 1.7     Build the XFS Programs
130         tar xvfj xfsprogs-version.tar.bz2 
132 1.8     Compile xfsprogs with (see also section 2.4):
133         
134         ./configure --prefix=/usr --exec-prefix=/ --bindir=/usr/sbin \
135         --libexecdir=/usr/libexec --localstatedir=/var \
136         --mandir=/usr/share/man && \
137         make && \
138         make install && \
139         make install-dev
141 optionally you can run (see FAQ 3.2 why possibly not)
142         make clean
144 That's it for the first.
145 ---------------------------------------------- 
146 1.9     !!Exit the chroot'ed Area with exit !!
147 ----------------------------------------------
149 Now, you have 2 options, either copy your Kernel from
150 $LFS to your $HOST-DISTRO or to patch and recompile the kernel of your
151 $HOST-DISTRO as well as you have done right before.
153 I assume you want to copy the kernel from your LFS distribution. To do so:
155 1.10    Copy the Kernel to the $HOST-DISTRO
157         cp $LFS/boot/lfs-kernel /boot
159 modify /etc/lilo.conf of your $HOST-DISTRO so that you could boot your
160 $HOST-DISTRO with your lfs-kernel.
162 1.11    Modify the $HOST-DISTRO's lilo.conf
164         image = /boot/lfs-kernel
165         label = LFS
166         root = $HOST-DEVICE
167         read-only
168    
169 after that run /sbin/lilo
171 Now repeat step 1.8 and compile the xfsprogs package again..
173 1.12    Repeat Step 1.8
175 When you have reached so far, you should now be awake, drink enough coffee,
176 what now follows is the dangerous part.
178 Pack your complete partition and save it somewhere where you have enough room
179 for the COMPLETE LFS Partition. You should check the amount of disk space
180 which LFS uses by:
182 1.13    Checking for Disk Space
184         df -h 
186 Mine was already 1.2 GB. But fortunatley bzip2 has a strong 
187 compression, so that I shrinked it down to 227 MB.
189 1.14    Pack the $LFS Partition
191         tar cfjp /path/to/enough-Room/LFS.tar.bz2 $LFS/*
193 This will take some time.
195 When finished, reboot your system with your lfs kernel.
197 1.15    Rebooting the System
199         reboot
201 1.16    Creating the XFS Filesytem for the $LFS Partition
202         
203         /sbin/mkfs.xfs -f /dev/$LFS-DEVICE
205 1.17    Mount the newly created Filesystem
207         mount -t xfs /dev/$LFS-DEVICE $LFS
209 1.18    Change to the Mount directory
211         cd $MNT
213 1.19    Unpack the archive containing the $LFS Data, we have packed in 1.14
215         tar xvfjp /path/to/LFS.tar.bz2
217 Head's up your nearly done.....
218 edit the fstab from your LFS:
220 1.20    Editing the $LFS fstab entry using your favorite editor (joe,vi,emacs)
222         edit $LFS/etc/fstab
224 and change ext2 (or whatever the / filesystem is) 
225 to xfs
227 Change your lilo.conf from your $HOST-DISTRO back so that it points
228 to the $LFS-DEVICE of your LFS Partition again:
230 1.21    Changing back lilo.conf of the $HOST-DISTRO
231         
232         image = /boot/lfs-kernel
233         label = LFS
234         root = $LFS-DEVICE
235         read-only
236    
237 run /sbin/lilo
240 1.22    Rebooting the System
241         
242         reboot
244 WELCOME to Journalized LFS :-)
247 2 BUILDING XFS ADDITIONAL TOOLS
248 -------------------------------
250 2.1 Dowload the appropiate packages
251         
252         attr-2.1.1.src.tar.gz
253         acl-2.1.1.src.tar.gz
254         xfsprogs-2.3.6.src.tar.gz
255         dmapi-2.0.5.src.tar.gz
256         xfsdump-2.2.4.src.tar.gz
258 from
260 ftp://oss.sgi.com/projects/xfs/download/cmd_tars
262 alternativley if you build a Release (Release-1.1 for example)
263 you could download the cmd_tars also from
265 ftp://oss.sgi.com/projects/xfs/download/Release-1.1/cmd_tars
267 if you use the cmd_tars of the Release-1.1 please read also FAQ 3.2
269 2.2     Building attr-2.1.1
271 unpack the file by 
272         tar xvfz attr-2.1.1.src.tar.gz
274 change into the attr directory by
275         cd attr-2.1.1
276 and run
277         ./configure --prefix=/usr --localstatedir=/var \
278         --mandir=/usr/share/man && \
279         make && \
280         make install && \
281         make install-dev && \
282         cp libattr/.libs/libattr.so.1.0.1 /usr/lib && \
283         (cd /usr/lib;ln -sf libattr.so.1.0.1 libattr.so.1)
285 optionally you can run (see FAQ 3.2 why possibly not) 
286         make clean
288 ** Here we got a classical case of FAQ 3.2, the make program
289 fails to copy all files from libattr/.libs/ and do the 
290 correct symlinking. **
292 2.3     Building acl-2.1.1
294 unpack the file by
295         tar xvfz acl-2.1.1.src.tar.gz
296 change into the directory by
297         cd acl-2.1.1
298 and run
299         ./configure --prefix=/usr --localstatedir=/var \
300         --mandir=/usr/share/man && \
301         make && \
302         make install && \
303         make install-dev && \
304         cp libacl/.libs/libacl.so.1.0.3 /usr/lib && \
305         (cd /usr/lib;ln -sf libacl.so.1.0.3 libacl.so.1)
307 optionally you can run (see FAQ 3.2 why possibly not) 
308         make clean
310 ** This is another example for FAQ 3.2 **
312 2.4     Building xfsprogs-2.3.6
314 unpack the file by
315         tar xvfz xfsprogs-2.3.6.src.tar.gz
316 change into the directory by
317         cd xfsprogs-2.3.6
318 and run
320         ./configure --prefix=/usr --exec-prefix=/ --bindir=/usr/sbin \
321         --libexecdir=/usr/libexec --localstatedir=/var \
322         --mandir=/usr/share/man && \
323         make && \
324         make install && \
325         make install-dev && \
326         cp libdisk/.libs/libdisk.la /usr/libexec && \
327         cp libxfs/.libs/libxfs.la /usr/libexec && \
328         cp libxlog/.libs/libxlog.la /usr/libexec && \
329         cp libxfs/.libs/libxfs.so.0.0.0 /lib && \
330     (cd /lib; ln -sf libxfs.so.0.0.0 libxfs.so.0; ln -sf libxfs.so.0 libxfs.so)
332 optionally you can run (see FAQ 3.2 why possibly not) 
333         make clean
335 ** This is the worst example of the library copy,linking,moving wirrwarr **
337 2.5     Building dmapi-2.0.5
339 unpack the file by 
340         tar xvfz dmapi-2.0.5.src.tar.gz
341 change into the directory by
342         cd dmapi-2.0.5
343 and run
344         ./configure --prefix=/usr --localstatedir=/var \
345         --mandir=/usr/share/man && \
346         make && \
347         make install && \
348         make install-dev
350 optionally you can run (see FAQ 3.2 why possibly not) 
351         make clean
353 2.6     Building xfsdump-2.2.4
355 unpack the file by
356         tar xvfz xfsdump-2.2.4.src.tar.gz
357 change into the directory by
358         cd xfsdump-2.2.4
359 and run
360         ./configure --prefix=/usr --exec-prefix=/ \
361         --localstatedir=/var --mandir=/usr/share/man && \
362         make && \
363         make install && \
364         make install-dev && \
365         rm -f /bin/xfsdump && \
366         rm -f /bin/xfsrestore
368 optionally you can run (see FAQ 3.2 why possibly not) 
369         make clean
371 Huuh! That was hard, but finally you got it all
373 3 FAQ
374 -----
376 3.1     Do I have to modify any boot scripts ?
377         Does fsck still work ?
378                 
379         A: You have to modify nothing in your bootscripts :-)
380         Because fsck works in that way that
381         it searches for the corresponding fsck to run for your filesystem
382         (e.g /sbin/fsck.ext2 for an ext2 system and /sbin/fsck.xfs for a
383         xfs based filesystem).
384         Additionally, the fsck.xfs is only a dummy because fsck'ing happens
385         automatically during boot.
386                 
387 3.2     After installing the cmd_tar's and additional xfs progs, the installed
388         program complains about not finding a library, how could that be ?
389                 
390         A: Unfortunatley (especially in older releases of the cmd_tar's), the
391         "make install" step seems to be a bit buggy. 
392         That means that the symlinks are (or worse only partly)
393         created but it does not copy the actually library file. 
394         To fix this copy the file manually to the destination directory 
395         after "make" finished
396                          
397         Usually you'll find that library in
398                          /path/to/programSourcedir/libdir/.libs/library.so
399         where libdir is libacl,libattr,libxfs for example.
400         
401         IMPORTANT: "make clean" will also delete the content of the .libs 
402         directory so that you have to perform these steps 
403         before issuing "make clean".
404         
405         See also:
406         http://oss.sgi.com/bugzilla/show_bug.cgi?id=205