Trim diskless rootimg

the exclude list attribute: linuximage.exlist

To reduce the memory occupation and boot-up time for the diskless node, the initrd and rootimg.gz should be kept as compact as possible under the premise of meeting the user’s requirements.

xCAT provides an exclude list attribute linuximage.exlist in the osimage object definition, which enables user to trim the rootimg on the diskless node after the rpms are installed into the rootimg directory by genimage on management node.

Take the osimage sles12.1-ppc64le-netboot-compute for example:

# lsdef -t osimage -o sles12.1-ppc64le-netboot-compute
Object name: sles12.1-ppc64le-netboot-compute

the content of exlist file

The file specified in linuximage.exlist includes relative path of the directories and files that will be excluded from the rootimg.gz generated by packimage. The relative path suppose the rootimg directory, /install/netboot/sles12.1/ppc64le/compute/rootimg here, to be the base directory. [1] [2]

xCAT ships a default exlist file, user can add or remove entries based on it according to their need.

The content of the default exlist file /opt/xcat/share/xcat/netboot/sles/compute.sles12.ppc64le.exlist is:

# cat /opt/xcat/share/xcat/netboot/sles/compute.sles12.ppc64le.exlist

The content above presents some syntax supported in exlist file:

  • exclude entry:


all the files and subdirectories under rootimg/usr/share/X11/locale/ will be excluded.

  • include entry:


all the files and subdirectories with the name matching pattern C* under /usr/share/locale/ will be included in the rootimg.gz, it is quite useful to use + initialed entries following an exclude entry to include some specific files or directories under the excluded parent directory.

  • pattern of the file name and directory [3]:


all the files and subdirectories matching the pattern ./usr/lib/perl[0-9]/[0-9.]*/ppc64le-linux-thread-multi/Encode/JP* will be excluded, such as


customize the exlist file and the osimage definition

Please check the default exlist file and make sure:

  • all files and directories you do not want in the image will be excluded from the rootimg.
  • no file or directory you need will be excluded from the rootimg.

If you want to customize the osimage sles12.1-ppc64le-netboot-compute with your own exlist file, please follow the following steps:

#create a customized exlist file based on the default one
cp /opt/xcat/share/xcat/netboot/sles/compute.sles12.ppc64le.exlist  /install/custom/netboot/sles/compute.sles12.ppc64le.exlist

#edit the newly created exlist file according to your need
vi /install/custom/netboot/sles/compute.sles12.ppc64le.exlist

#specify the newly created exlist file in the osimage definition
chdef -t osimage -o sles12.1-ppc64le-netboot-compute exlist=/install/custom/netboot/sles/compute.sles12.ppc64le.exlist
[1]It would only make sense to use an absolute path name here. It means that this entry will never match anything: /usr/share/locale/*.
[2]The exlist file entry should not be ended with a slash /, it means that this entry will never match anything: ./usr/lib/perl[0-9]/[0-9.]*/ppc64le-linux-thread-multi/Encode/.
[3]Pattern match test applies to the whole file name,starting from one of the start points specified in the exlist file entry. The regex syntax comply the with the regex syntax of system command find -path, please refer to its doc for details.