Rebuilding onto an unsupported filesystem (using XFS as an example)
[Anecdote below is from when I was forced to do an emergency server rebuild under stressful conditions, but nonetheless decided to go out of my way to convert over the the XFS journaling filesystem, as part of that process. Since this happened in 2001, all software versions mentioned are long obsolete; support for journaling filesystems is now routine, and few admins would now go to the lengths described. However, I've retained the description because it lists generically steps sufficient to convert to any arbitrary filesystem, and thus is of ongoing interest.]
From: rick@linuxmafia.com (Rick
  Moen)
  Date: Mon May 14 00:59:01 2001
  Subject: [svlug] On Penguinizing the PowerBook 520
  To: svlug@lists.svlug.org
[Snip material about a system rebuild that is not relevant to this topic]
Thursday evening, I was finally able to take a breather and ponder what type of system I was going to rebuild onto. Given power outages and other mishaps, it seemed timely to try one of the journaling filesystems — but I needed to hurry, having already had two days of downtime. ReiserFS has recently become stable enough, but its fsck utility is acknowledged to be still useless. ext3 was a possibility (on 2.2.x). Both were probably slower than the third possibility, SGI's XFS, which is wonderful on Irix, but required some pretty scarily pervasive kernel modifications to port to Linux. And it is available as third-party patches to 2.4.2 or 2.4.3, only. Generally, I would have preferred 2.2.19 over any of the 2.4.x releases, which still seem a bit raw. (Are the filesystem corruption bugs truly gone?) Eventually, I decided on kernel 2.4.3 with the two patches necessary for XFS (one to add the driver, and the second to rip out and replace parts of the kernel). I'd still rather be on 2.2.19, but what can you do?
The first step was to upgrade Debian 2.2 "potato" to support kernel 2.4.x support packages listed (and made available) here: http://www.fs.tum.de/~bunk/kernel-24.html (Probably simply upgrading to the "woody" AKA "testing" development branch would have taken care of this, but I was in a hurry.) Note that you have to enable initrd (initial RAMdisk) support in lilo to make this work. Details here: http://rute.sourceforge.net/node34.html
[Snip other rebuild details.]
Next, I got the 2.4.3 kernel sources (since there's no XFS for
  2.4.4,
  yet,*other than CVS checkouts), patched it, and compiled. As
  I
  mentioned elsewhere, there's a nasty bug in the aic7xxx
  driver's
  Makefile.** Fix is described here:
  
  http://csociety.ecn.purdue.edu/pipermail/plug/2001-March/004951.html
  Then, it compiles. Edit lilo configuration, re-run /sbin/lilo,
  reboot.
  Make an XFS filesystem. Good, I can mount it!
Copy /usr over to it. Delete that tree from the cramped temporary root filesystem. Remount /usr from the XFS partition. Edit /etc/fstab ("root=" line). Reboot, to make sure it comes up properly. Good! Make another XFS filesystem. Copy / over to it. This becomes my maintenance partition, for emergency recoveries in the future. Edit /etc/lilo.conf and /etc/fstab to use it as my temporary root filesystem until I can rebuild the regular one. Reboot; it works. Go to sleep.
Friday morning, I go off for the workday. When I have a chance, I remotely log back into my server from work, reformat the original root filesystem as XFS, mount it on /mnt, copy the temporary root filesystem to it, edit /etc/fstab and /etc/lilo.conf again, reboot. Wait. Wait. No response to ping. Damn.
Friday evening, I come home: Apparently, it choked on the root filesystem's mount options, which I had carried forward from the Debian defaults, like this:
/dev/sda2 / ext2 defaults,errors=remount-ro 0 1
Except I had just edited the "ext2" to "xfs". The "errors=remount-ro" seemed to have caused the system to come up with that filesystem mounted read-only. The moment I edited that to "rw" and rebooted, everything was fine. I copied back all my backed-up datafile trees, then set about deciding what daemon software to run.
[Snip post-build configuration and software choice, and discussion of an unrelated Linux-on-Macintosh installation issue.]
From: rick@linuxmafia.com (Rick Moen)
  Date: Mon May 14 16:54:01 2001
  Subject: [svlug] On Penguinizing the PowerBook 520 (was: svlug
  digest, Vol 1 #757 - 13 msgs)
  To: svlug@lists.svlug.org
begin Al Udal quotation:
> That was very instructive lesson in system rescue
  operations, thank
  > you.
No problem. The process itself was pretty discouraging, and long, but it came out all right. I still have to yank the 9 GB IBM drive, and see if it's still under warranty.
I also forgot to mention a few other things:
[Snip material not directly relevant.]
By the way, for those considering taking Debian (and derived)
  systems
  to the Debian-testing branch and kernel 2.4.x with the XFS
  journaling
  filesystem, I've posted the necessary links here:
  http://www.debianplanet.org/debianplanet/article.php?sid=213
Some longer-term lessons:
Automate your backups. Otherwise, you'll not have one when you need it. I simply have to set up rsync partial mirroring onto one of my other machines, using cron and OpenSSH with an RSA keypair.
Have a maintenance partition, to boot from in case of disaster. (Now, I have one.)
Know exactly which directory trees are significant to the state of the machine, in case of need to do disaster-recovery.
Store copies of /etc and your package list off-site, frequently.
Start planning now for what software your next machine build will consist of. I figure I lost 1-2 days mulling over the decision tree. And I could have tested (e.g.) the alternative, smaller Web daemon packages on a different host, in advance of all this.
Don't procrastinate about eliminating hardware problems — even if you "can't afford the downtime".
  [What I posted at http://www.debianplanet.org/article.php?sid=213
  :]
Re: Debian and SGI XFS? (Score: 2, Informative)
  by Anonymous on Monday, May 14 @ 20:47:25 BST
  Some hyperlinks would probably be handy:
- SGI's linux-xfs page. [http://linux-xfs.sgi.com/projects/xfs/
  ]
 - xfs-linux's Release 1.0 page, including download links for the
  two
  XFS patches. [http://linux-xfs.sgi.com/projects/xfs/1.0_release.html
  ]
 - Debian-unstable's xfsprogs package (includes mkfs.xfs).
[ http://packages.debian.org/unstable/admin/xfsprogs.html ]
 - Debian-unstable's xfsdump package (includes dump/restore)
[ http://packages.debian.org/unstable/admin/xfsdump.html ]
 - Debian-unstable's attr package for manipulating extended
  file
  attributes
[http://packages.debian.org/unstable/utils/attr.html ]
 - Debian-unstable's xfslibs-dev package (for compiling
  XFS-aware
  utilities)
[ http://packages.debian.org/unstable/devel/xfslibs-dev.html ]
 - XFS-support patches to the core of the 2.4.2 or 2.4.3
  kernel.
[ http://packages.debian.org/unstable/devel/kernel-patch-xfs-core.html ]
 - XFS filesystem patch for the 2.4.2 or 2.4.3 kernel
[ http://packages.debian.org/unstable/devel/kernel-patch-xfs.html ]
 - Apt-gettable list of packages required to support kernel 2.4.x
  on
  debian-potato.
[ http://www.fs.tum.de/~bunk/kernel-24.html ]
 - Zoltan Kraus's site where XFS-supporting Debian install disks
  will
  eventually be available, around the time of kernel 2.4.5.
  Mirror
  here. (You can get some rather scary-sounding
  ReiserFS-supporting
  floppy images there, for now.)
[ http://www.markybob.com/zoltan/ ]
 - My own account of my process of getting from default
  Debian-potato
  to Debian-testing running on kernel 2.4.3 w/XFS. Please note
  that
  I omit mention of some packages cited above, which you will
  need.
[ Link was to the svlug@svlug.org post quoted above.] 
You'll also need to have packages kernel-package (recommended
  but not
  essential), perl, dpkg, patch dpkg-dev, fileutils, libc6-dev,
  gcc,
  debianutils, make, libdb3-dev, and libncurses5-dev. The 2.4.2 and
  2.4.3
  kernel sources are no longer available as .debs, but you can
  get
  tarballs [ http://http.us.debian.org/debian/pool/main/k/
  ]. If you'll be
  using 2.4.3's Adaptec SCSI aic7xxx driver, you'll also need to
  fix a
  broken Makefile
  [ 
  http://csociety.ecn.purdue.edu/pipermail/plug/2001-March/004951.html
  ]
  before you'll be able to successfully compile the kernel.
  Date: Thu, 14 Mar 2002 19:28:53 +1100
  From: hogan hogan@netspace.net.au
  Subject: Re: Loading Kernel modules on install
  To: luv@luv.asn.au
  X-Mailer: Sylpheed version 0.7.2 (GTK+ 1.2.10;
  i386-debian-linux-gnu)
I successfully used the ISO mentioned at:
  http://oss.sgi.com/projects/xfs/faq.html#debianbf
  which links to:
  http://www.physik.tu-cottbus.de/~george/woody_xfs/
This uses the 2.4.x kernel - so has the more current 8139too instead of the dodgy rtl8139 driver ("more current" and "dodgy" are based on my experience).
The .de page also has boot floppies.
Anthony
  From: hogan hogan@netspace.net.au
  Subject: Re: Loading Kernel modules on install
  To: luv@luv.asn.au
  X-Mailer: Sylpheed version 0.7.2 (GTK+ 1.2.10;
  i386-debian-linux-gnu)
To explain where XFS is in Debian in official terms..
  ------------------------------------------------------------------------
  Debian Weekly News
  http://www.debian.org/News/weekly/2002/11/
  Debian Weekly News - March 13th, 2002
  ------------------------------------------------------------------------
  ...
  XFS based Boot Floppies. Two people are working towards
  integration of
  XFS into Debian's boot-floppies. Eduard Bloch created the
  first
  installations CD image for Woody and XFS which can be downloaded
  from
  [6]here. Angelo Ovidi started a new project on SourceForge
  called
  [7]XFDeb. He already created a rescue disk based on kernel 2.4.14
  and
  XFS 1.0.2 and is going to create the root and drivers floppies,
  too.
  His aim is to unify his work with Ionut Georgescu's [8]Debian
  installer with SGI XFS support to offer the XFS journaling file
  system
  as an option at installation time.***
6. http://people.debian.org/~blade/XFS-Install/
  7. http://xfdeb.sourceforge.net/
  8. http://www.physik.tu-cottbus.de/~george/woody_xfs/
  ...
  ------------------------------------------------------------------------
  * As should be obvious, this is no longer the case.