Sysresccd-manual-en How to personalize SystemRescueCd
From SystemRescueCd
[edit] Introduction
Being able to make one's own version of SystemRescueCd was a frequently requested feature. It's now possible to make your own version of SystemRescueCd.
This means you will be able to add files to the sysrcd.dat compressed image file, which will be the file system of SystemRescueCd. For example, you can add script files that make a full backup of a server, or a binary program that you need. It's also possible to add data files, in order to have everything on the CDRom (data and system files which allow you to restore data). For now, it's not possible to change the kernel. If you need a kernel option that is disabled, please contact us.
The goal is to produce a new ISO image file, with an updated sysrcd.dat. In order to be able to make your own version of SystemRescueCd, you will need a recent official version of this CDRom, and a partition with read-write access from within linux, with at least 700 MB. If you make a very large version of the CDRom, you may need a lot more space.
Be aware that this operation requires a large amount of memory (both RAM and space on the hard disk). If you don't have 128 MB of RAM, and at least 700 MB free on your hard disk, it will fail. You can create a swap partition in order to avoid problems with the squashfs step in the script.
[edit] Usage
All the personalization is processed from the CDRom system with a script. This means you have to burn the official version, boot your computer from this official SystemRescueCd version, and then you are able to make your own version. The script needs to be run from the CDRom system, because it's easier to use this way. I am sure all programs are installed. If this script was designed to run from any linux installed system, you would have to install several programs, such as a module for the kernel, and it would be a lot more complex. Here are the instructions to follow in order to make your own ISO image. We assume that the /dev/hda1 partition is formatted for linux (ext2, ext3, reiserfs, reiser4, xfs, jfs, ...), and that it has at least 700 MB free. It must really be a linux diskspace, because other filesystem, such as FAT, NTFS don't supports symbolic links and files permissions. If you only have a FAT partition available, you can create a virtual linux filesystem image inside the FAT partition:
mount /dev/hda1 /mnt/fat cd /mnt/fat dd if=/dev/zero of=fsimage bs=1M count=500 mke2fs -F -q -N 50000 fsimage mount -t ext2 -o loop fsimage /mnt/custom
If you use the docache boot option, the original SystemRescueCd disc must be mounted when you run the first step (extract) of the script.
[edit] Procedure
This procedure will make a directory customcd at the root of this partition. All the files located in other directories won't be affected by this script. If you have an old version of this personalized CDRom in this directory, please make a backup. All files of /dev/hda1/customcd/ may be lost! Note that you must keep the name /mnt/custom that we used in this example. You can't simply use /mnt/another-name.
[edit] Step-01: Mount the working partition
mount /dev/hda1 /mnt/custom
If you don't want the main temporary directory to be written to the root of /mnt/custom, you can choose another directory. For example, if the free space is an NFS share, you can try this:
mount -o bind /mnt/nfs/remote-directory /mnt/custom
[edit] Step-02: Extract the current files from the sysrcd.dat image
/usr/sbin/sysresccd-custom extract
If there is no error, all the files of the squashfs image should have been copied in /mnt/custom/customcd/files/
[edit] Step-03: Customize files (optional)
You have to customize the files which you have just extracted. You can do this from the SystemRescueCd, but it's also possible to restart the computer and do it from any other installed linux system. If you choose to restart, you will have to restart from the SystemRescueCd, and mount files again (follow step-01 again). All the changes have to be made in the following directory: (This is the root of the new filesystem) /mnt/custom/customcd/files/
[edit] Step-04: Create the new squashfs image
In this step, all files from /mnt/custom/customcd/files/ are read, and put inside the new squashfs image. The new squashfs image is copied in /mnt/custom/customcd/isoroot/sysrcd.dat, but you don't have to concern yourself with this.
/usr/sbin/sysresccd-custom squashfs
[edit] Step-05: Add files to the ISO image (optional)
By default, you only need the big squashfs image file and the isolinux directory. The CDRom can work with only these two items on the disc. In this step, you can add other files to the ISO image, outside of the squashfs image. For example, you can put big backup files inside the CDRom, and outside the squashfs image, in order to avoid overloading the squashfs. If you are interested in adding such files, you just have to copy the files along with the sysrcd.dat, in this directory: /mnt/custom/customcd/isoroot
cp -a my-files /mnt/custom/customcd/isoroot
You may add an autorun script to the root of the CDRom, outside of the squashfs image. If you put an autorun script there, it can be run at startup. It allows to automake many tasks, such as doing a backup. See the autorun section for more details.
cp autorun /mnt/custom/customcd/isoroot chmod 755 /mnt/custom/customcd/isoroot/autorun
Of course, you need to make sure that the size of the isoroot directory is not too big for your CDR (usually 700 MB). You can use the du -sh /mnt/custom/customcd/ command for that.
[edit] Step-06: Select your keymap (optional)
In the official version, SystemRescueCd asks you to select a keymap at startup. If you want to avoid seeing this menu and define a permanent keymap, you can run this command:
/usr/sbin/sysresccd-custom setkmap <your-keymap>
The second parameter is the name or the number of your keymap in the menu. For example, French users will use this:
/usr/sbin/sysresccd-custom setkmap fr
[edit] Step-07: Edit boot options (optional)
You may want to edit boot options (options such as docache or dodhcp) in the following file: /mnt/custom/customcd/isoroot/isolinux/isolinux.cfg
[edit] Step-08: Create the new ISO image
You just have to type this command. The second parameter to provide is the volume name for the CDRom.
/usr/sbin/sysresccd-custom isogen my_srcd
[edit] Step-09: Synchronize your disks
Before leaving the system and rebooting, you should make sure all your disks are cleanly unmounted. The best way to be sure not to lose data is to umount all mounted partitions, especially the temporary one (/dev/hda1 in this example), and then type sync
cd / ; umount /mnt/custom ; sync
[edit] Step-10: Test and burn the ISO image
The new final ISO image is located in /mnt/custom/customcd/isofile/sysresccd-new.iso. You can burn it with cdrecord, Nero, or any other burning software. If you don't want to burn a CDR, you can test it with VMWare or qemu. You have to tell this software that the CDRom drive to use is the virtual ISO-image file drive.
[edit] Result of your changes
When you start your computer with your own SystemRescueCd version, you can see all the files in /mnt/livecd. If your new files belong to a standard directory, you can access it without a problem. If you made a new directory in the root of the filesystem, it will appear in /mnt/livecd, but you won't see that in the root of the system. In fact, the root of the system contains symbolic links to /mnt/livecd. You may have to make the link yourself.
