DIQ'S DEN - WWW.COUYON.NET
  • Home
  • Blog
  • Photos

Making XFS volumes in CentOS 5.4/5.5 kickstart

6/10/2011

 
We've been using XFS with CentOS for a while now, but we always created the volumes post-kickstart as part of our puppet runs. After hearing that CentOS/RHEL 5.4 would support XFS in Kickstart, we gave it a try. It didn't really work the way we thought it would and started looking around in Google results. Sadly, this information isn't really written down anywhere, so here it is. We're not doing anything novel here, I just thought that I'd post it to save people a lot of time and trouble. Keep in mind that we don't create our root partitions with XFS (we still use EXT3 for that), but we do create our "data" partitions using XFS.

  • Write a disk label and partition your disk using a %pre step:
modprobe xfs
parted -s /dev/sdb mklabel gpt
parted -s /dev/sdb unit s mkpart primary 2048 100%

  • At this point, you've got a partition created, but you can't format it yet. Why not? Because while the XFS kernel module can be loaded, none of the XFS utilities are included in the updated Kickstart. You can't mkfs it quite yet. Be sure to include your partition declaration in kickstart. Example:
part /data --onpart=sdb1 --noformat --fsoptions="noatime,nodiratime,nobarrier,defaults" --fstype=xfs

  • In a %post step, install kmod-xfs, xfsprogs, and xfsdump RPM packages. We install them off of our own server, but you can get them fromhttp://mirror.centos.org/centos-5/5.5/extras/x86_64/RPMS/
rpm -Uvhi /mnt/tmpnfs/src/kmod-xfs-0.4-2.x86_64.rpm
rpm -Uvhi /mnt/tmpnfs/src/xfsdump-2.2.46-1.el5.centos.x86_64.rpm
rpm -Uvhi /mnt/tmpnfs/src/xfsprogs-2.9.4-1.el5.centos.x86_64.rpm

  • unmount the partition (in case data existed there previously), make the mount point, then mkfs:
umount /dev/sdb1
mkdir /data
/sbin/mkfs.xfs -f -d su=64k,sw=3 -l size=32m,su=16k -L /data /dev/sdb1

Thomas
7/3/2012 06:59:55 am

Hi,

I found this URL to be useful, but when I try adding this line.

part /data --onpart=sdb1 --noformat --fs

I'm getting an error message. I got an error message about -fs is confusing. I try placing --fstype but it requires a value. When I tried xfs, it failed.

Could you advise?

Thanks,
Thomas

diq link
7/3/2012 08:41:30 am

Thomas, you found a Weebly bug! Looks like the exact text didn't quite get pasted in properly. I've verified it and escalated the issue with our developers. Anyhow, you're right that it should be --fstype=xfs. I've updated the appropriate text. If you're getting a failure with --fstype=xfs, try either a "modprobe xfs" in a %pre step or adding the keyword "xfs" to your PXE kernel boot line. Example:

ks=nfs:buildserver:/kickstart/foo.ks initrd=images/centos/initrd-centos56-net.img ramdisk_size=100000 ksdevice=eth0 xfs nodmraid ip=dhcp console=tty0 console=ttyS1,57600n8

Thomas
7/5/2012 03:32:23 am

Thanks for the response and correction. I am getting the following message. I tried

either.

part /data --onpart=sdb1 ..

or

part /data -ondisk=sdb


11:33:54 CRITICAL: Traceback (most recent call first):
File "/tmp/treedir.27146/instimage/usr/lib/anaconda/fsset.py", line 591, in labelDevice
raise SystemError
File "/tmp/treedir.27146/instimage/usr/lib/anaconda/fsset.py", line 1817, in labelEntry
entry.fsystem.labelDevice(entry, chroot)
File "/tmp/treedir.27146/instimage/usr/lib/anaconda/fsset.py", line 1941, in makeFilesystems
self.labelEntry(entry, chroot)
File "/tmp/treedir.27146/instimage/usr/lib/anaconda/packages.py", line 162, in turnOnFilesystems
anaconda.id.fsset.makeFilesystems (anaconda.rootPath)
File "/usr/lib/anaconda/dispatch.py", line 204, in moveStep
rc = stepFunc(self.anaconda)
File "/usr/lib/anaconda/dispatch.py", line 127, in gotoNext
self.moveStep()
File "/usr/lib/anaconda/text.py", line 727, in run
anaconda.dispatch.gotoNext()
File "/usr/bin/anaconda", line 974, in ?
anaconda.intf.run(anaconda)
SystemError

Suggestions?

diq link
7/5/2012 01:03:41 pm

Thomas, which version of CentOS are you running? Is it possible to check /tmp/anaconda.log or dmesg output from the host? The error looks related to partition definitions, but I can't say it's related to the XFS entry. Could be related to something else and there's a typo somewhere? What does parted print output say? I'd look down these routes for your answer.

Thomas
7/6/2012 12:57:34 am

I'm running CentOS 5.5. The following is my part definition.

zerombr yes
clearpart --all --drives=sda --initlabel
clearpart --all --drives=sdb --initlabel
part /boot --fstype ext3 --size 250 --asprimary --ondisk sda
part swap --size 7680 --asprimary --ondisk sda
part / --fstype ext3 --size 5120 --asprimary --ondisk sda
part /vol1 --fstype ext3 --size 20624 --grow --asprimary --ondisk sda
part /data --ondisk sdb --size 250 --grow --noformat --fsoptions="noatime,nodiratime,nobarrier,defaults" --fstype=xfs

I tried w/ --onpart or --ondisk and got similar debug message. With --ondisk, this is what was the last bit on /tmp/anaconda.log


..
..

13:19:58 INFO : formatting /boot as ext3
13:19:58 INFO : Format command: ['/usr/sbin/mke2fs', '/tmp/sda1', '-i', '4096', '-j']

13:19:59 INFO : Running kickstart %%traceback script(s)
13:19:59 INFO : All kickstart %%traceback script(s) have been run
13:19:59 CRITICAL: Traceback (most recent call first):
File "/usr/lib64/python2.4/subprocess.py", line 993, in _execute_child
raise child_exception
File "/usr/lib64/python2.4/subprocess.py", line 550, in __init__
errread, errwrite)
File "/tmp/treedir.27146/instimage/usr/lib/anaconda/iutil.py", line 51, in execWithRedirect
stderr=stderr, preexec_fn=chroot, cwd=root)
File "/tmp/treedir.27146/instimage/usr/lib/anaconda/fsset.py", line 484, in labelDevice
stderr = "/dev/tty5")
File "/tmp/treedir.27146/instimage/usr/lib/anaconda/fsset.py", line 1817, in labelEntry
entry.fsystem.labelDevice(entry, chroot)
File "/tmp/treedir.27146/instimage/usr/lib/anaconda/fsset.py", line 1941, in makeFilesystems
self.labelEntry(entry, chroot)
File "/tmp/treedir.27146/instimage/usr/lib/anaconda/packages.py", line 162, in turnOnFilesystems
anaconda.id.fsset.makeFilesystems (anaconda.rootPath)
File "/usr/lib/anaconda/dispatch.py", line 204, in moveStep
rc = stepFunc(self.anaconda)
File "/usr/lib/anaconda/dispatch.py", line 127, in gotoNext
self.moveStep()
File "/usr/lib/anaconda/text.py", line 727, in run
anaconda.dispatch.gotoNext()
File "/usr/bin/anaconda", line 974, in ?
anaconda.intf.run(anaconda)
RuntimeError: /usr/sbin/xfs_db can not be run

13:19:59 INFO : in run, screen = <snack.SnackScreen instance at 0xf319f80>

diq link
7/6/2012 02:05:02 pm

OK well that's the problem then. You cannot let the kickstart partitioner create the partition for you. Even though you set noformat, it doesn't understand xfs. You added --grow and a size, so it's going to want to muck with stuff. If you just have --onpart and --noformat with no size or grow options, the installer will just add a fstab entry and ignore it. Re-read the section in the post about the %pre section and creating your own partition.

Generally, I'd avoid all the anaconda partitioning stuff and create your own partitions and filesystems. Much more control that way.

Thomas
7/9/2012 08:07:07 am

You are correct. I was trying to incorporate this with foreman and had some of the lines in the wrong location.

thanks again for your document. I was able to create an XFS volume.

diq link
7/9/2012 09:46:40 am

Great! Glad that we finally got that worked out!


Comments are closed.

    Author

    A NOLA native just trying to get by. I live in San Francisco and work as a digital plumber for the joint that runs this thing. (Square/Weebly) Thoughts are mine, not my company's.

    Picture
    Moi

    Archives

    May 2021
    April 2021
    March 2021
    February 2021
    December 2019
    April 2019
    July 2018
    February 2018
    January 2017
    August 2016
    May 2016
    June 2015
    May 2015
    December 2014
    July 2014
    March 2014
    December 2013
    November 2013
    June 2013
    May 2013
    April 2013
    March 2013
    February 2013
    October 2012
    July 2012
    June 2012
    April 2012
    March 2012
    February 2012
    November 2011
    September 2011
    August 2011
    June 2011
    May 2011

    Categories

    All
    Cajun
    Computers And Internet
    Cooking
    Creole
    Food
    Gumbo
    Nola
    Recipe
    Sf

    RSS Feed

Proudly powered by Weebly
  • Home
  • Blog
  • Photos