spacer

Sysresccd-manual-en Easy install SystemRescueCd on harddisk

History


Contents

Introduction

Since SystemRescueCd version 0.4.x, there is an easy way to boot SystemRescueCd from the harddisk. This method allows to use SystemRescueCd as you do with the CDRom version. But this method does not require to insert the disc in the drive each time you need it. It also allows to boot SystemRescueCd if you don't have a CD/DVD drive in your computer. You can use another operating system to process the installation of SystemRescueCd, and enable it. Thus, this method is recommended if you often use SystemRescueCd and you want to avoid having to insert the disc in the drive each time.

It has been possible to install SystemRescueCd on your hard disk for a long time using the the old installation method. It was necessary to have a linux file system (a filesystem supported by lilo or grub). The installation process was done by extracting the main filesystem from sysrcd.dat to a dedicated linux partition. With the new installation method, you don't have to create a new partition on your hard disk. You can copy these files on a already existing linux or Windows partition of your hard disk. Using grub4dos you can even install SystemRescueCd on a Windows partition formatted in NTFS. All you have to do is to install the files that are on the SystemRescueCd disc on an existing partition of your hard disk, that can be either a linux partition (ext3, reiser, xfs, ...) or a Windows one (NTFS). That way you can boot SystemRescueCd from your Windows partition, and using the docache option you can even use it to troubleshoot Windows itself using ntpass to reset the administrator password or ntfs3g to work on the filesystem.

This chapter has been updated to support the SystemRescueCd-1.0.0 version, so it will work with all versions newer than that.

There are two steps in this installation: first you will have to copy the main SysRescCd files onto a partition of your disk. Then, you will have to configure your boot loader. The installation process requires a partition with about 200 MB free space. You must have a working linux boot loader installed such as Lilo or Grub if you want to install the SystemRescueCd files on a Linux partition.

Four kernels are provided with SystemRescueCd: rescuecd, rescue64, altker32, altker64. In this chapter we will consider you are using rescuecd but you can just do the same thing with any other kernel that is provided with SystemRescueCd.

The last section explains how to boot SystemRescueCd from the hard disk as an ISO image. You can do that if you have Linux installed on your disk with Grub2 as the boot loader. This alternative method is more convenient than the other one if you want to frequently update SystemRescueCd on your disk. All you will have to do is to update the copy of the ISO image on your disk if you follow this method.

First step: copy important files

This step is very trivial: you just have to copy the SysRescCd main files to the partition. If that's a FAT16/FAT32 or NTFS partition, you can perform the copy with any operating system. Of course, if you choose a Linux native partition, you will have to copy from Linux (you can copy from SystemRescueCd itself).

You must create a directory /sysrcd/ and this directory must be in the root of the partition (not a subdirectory)

Now, take the disc with the latest SystemRescueCd version (you may prefer to mount the ISO image with mount under Linux (eg: mount -o loop systemrescuecd-x86-x.y.z.iso /mnt/cdrom) or you can use a software such as DaemonTools under Windows if you did not burn the disc), in order to have the main files.

Finally, just copy sysrcd.dat, sysrcd.md5, initram.igz, rescuecd, rescue64, altker32, altker64 from the CDRom to the directory you made (/sysrcd/). Some of these files are located in isolinux inside of the CDRom. You must not keep the directory structure. All the files must be copied to the sysrcd directory.

Second step: update the grub/lilo bootmanager (if you install on Linux)

Now, you must update your bootmanager (Lilo or Grub). This section describe how to update a boot manager based on linux (lilo or grub). If you are using an NTFS partition, please read the next section instead.

We will have to add several lines to the configuration file of the bootmanager (usually /etc/lilo.conf for Lilo, and /boot/grub/menu.lst or /boot/grub/grub.conf for grub). You have to personalize the configuration given there. With grub, you will have to give the grub device name for the partition you have chosen. It's usually a name such as (hd0,0) instead of hda1 or (hd0,1) instead of hda2, ... Then, you may update several options related to your keyboard (setkmap=xx). You may have a look at isolinux.cfg that's on the CDRom, if you don't know the values you can use for these options.

Example for LILO bootmanager

First, here is an example of the Lilo configuration (edit /etc/lilo.conf) The path /mount-point/ must be replaced with the mount point for the partition at the time you run lilo.

image=/mount-point/sysrcd/rescuecd
initrd=/mount-point/sysrcd/initram.igz
label=SysRescCd
append="subdir=sysrcd setkmap=us"
  1. Don't forget to run lilo after lilo.conf was edited.
  2. You must replace setkmap=us with your own keyboard type

Example for GRUB bootmanager

Here is an example of Grub configuration (edit menu.lst or grub.conf in /boot/grub/) In this example, files are located in /dev/hda8. The grub device name is (hd0,7) (you must subtract 1 from the linux device name, then 8-1=7)

title    SystemRescueCd from hard-disk
root     (hd0,7)
kernel   /sysrcd/rescuecd subdir=sysrcd setkmap=us
initrd   /sysrcd/initram.igz
boot
  1. Remember: in grub, IDE, SATA and SCSI devices (/dev/hda and /dev/sda) have the same name (hd0). You must not write (sd0) for SCSI and USB devices.
  2. You must replace setkmap=us with your own keyboard type

Second step: update the grub4dos bootmanager (if you install on Windows)

Now, you must update your bootmanager using grub4dos that is the grub port to windows. This section describes how to install the grub4dos boot manager if you installed the SystemRescueCd files on an NTFS partition running Windows. If you are using a Linux partition, please read the previous section instead.

One of the most interesting things you can do with the sysresccd ntfs installation is to troubleshoot windows when it has problems. This way you can mount the windows partition with ntfs-3g and repair your windows (replace a backup of the registry, ...). The only problem is you cannot mount the windows disk read-write with ntfs-3g because it was already mounted read-only during the boot process. The solution to this problem is to use the docache option at boot time. When this option is enabled, sysresccd will cache its own files (found on the ntfs disk) into memory during the boot process, and the ntfs disk will be unmounted. So it allows you to mount it again with ntfs-3g. So you have to add docache to the menu.lst boot options if you want to be able to mount your windows disk with ntfs-3g after booting from the ntfs disk itself.

Installation is really straightforward. In this mini tutorial, I assume Windows is installed on an NTFS disk (Disk-C) and that you copied the SystemRescueCd main files into C:\sysrcd

a) install grub4dos

grub4dos is provided on the disc with SystemRescueCd-1.0.0 and later versions. You can also download grub4dos, extract the zip file into a temporary directory, and copy grldr to C:\. This installation has been tested using the grldr file provided with grub4dos-0.4.3-2007-08-27.zip

b) update the windows boot loader

update your boot.ini: Windows NT4/2000/2003/XP

These instructions should work on Windows NT4/2000/2003/XP. Edit C:\boot.ini (with a text editor such as Notepad++, don't use Word !), and add a line that boots the grldr at the bottom of that file. Below is an example of a boot.ini file. Be careful: don't replace your boot.ini with the version given there. It's very important that you keep the current lines as they are in your boot.ini. You must just add the last line to your boot.ini.

[boot loader]
timeout=4
default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Windows" /noexecute=optin /fastdetect
C:\grldr="SystemRescueCd"

update your boot loader: Windows Vista/2008

Thanks to user700512 here are the instructions that should work on Windows Vista/2008. Together with grldr you need to copy grldr.mbr (part of the archive) to the root of the Vista boot partition. Then you need to type several commands at a command prompt (run cmd.exe with an administrator user account).

In the command prompt window (C:> is a dummy substitute for the cmd prompt) do the following:

C:> bcdedit /create /d "SystemRescueCd [GRUB4DOS]" /application bootsector

You get in return the boot entry {id} - use it (copy/paste or type) in the following steps

C:> bcdedit /set {id} device boot
C:> bcdedit /set {id} path \grldr.mbr
C:> bcdedit /displayorder {id} /addlast

You can also investigate further if you need more details about grub4dos under Vista.

c) create the C:\menu.lst file

You have to create a C:\menu.lst that is the grub4dos configuration file. Here is an example:

# This is a sample menu.lst file for SystemRescueCd
title    SystemRescueCd from the NTFS disk
root     (hd0,0)
kernel   /sysrcd/rescuecd subdir=sysrcd setkmap=us docache
initrd   /sysrcd/initram.igz

In menu.lst you will have to replace the setkmap with the code that matches your keyboard configuration. In this example, files are located on the NTFS partition that is the first partition of the first hard disk. Then the grub device name is (hd0,0). It would be (hd1,0) for the first partition of the 2nd hard-disk, (hd0,1) for the second partition of the first hard-disk, ... You have to replace root (hd0,0) with the grub name of your NTFS partition.

d) check the SystemRescueCd files

Check that the SystemRescueCd files are installed in C:\sysrcd

e) reboot

Just reboot and choose grldr, then SystemRescueCd in the boot menus displayed by the Windows NT-Loader.

Boot the ISO image from the disk using Grub2

Grub2 (currently in development: grub-1.98) provides a new feature to boot from an ISO image which is stored on the hard disk. If you put a copy of systemrescuecd-x86-x.y.z.iso on a partition that Grub2 can read then you can boot SystemRescueCd directly from the ISO image stored on your hard drive. This is very convenient if you frequently update SystemRescueCd and you want to boot it directly from Grub2.

Grub2 knows what an ISO image is and it will load the kernel image (rescuecd/rescue64) and the initramfs (initram.igz) from the ISO into memory. It will then do its normal job and execute the kernel. The SystemRescueCd init script must then be aware that its sysrcd.dat file is in an ISO and not directly on the partition. For that reason, this isoloop=xxx boot option is required so you must use it in your grub.cfg.

This option is only supported in SystemRescueCd-1.4.0 and more recent. This option specifies the path of the ISO image in the partition that grub considers as its root partition. It's important to understand that the path of the ISO image may be different from the path on your linux system. If you have a separate boot partition mounted on /boot and if you copy this ISO image to /boot/sysrcd/systemrescuecd-x86-x.y.z.iso then the option has to be isoloop=/sysrcd/systemrescuecd-x86-x.y.z.iso. This is because the boot partition is what Grub2 will consider as its root partition during the boot process.

Here is an example of a /boot/grub/grub.cfg configuration file. Replace rescue32 below with your kernel, when you chose a different kernel:

set default=0
set timeout=5
set root=(hd0,1)

menuentry "Debian-Lenny-2.6.32-3-amd64 (vgraid)" {
        linux   /boot/vmlinuz-2.6.32-3-amd64 root=/dev/mapper/vgraid-lenny ro
        initrd  /boot/initrd.img-2.6.32-3-amd64
}

menuentry "SystemRescueCd (isoloop)" {
        loopback loop /systemrescuecd-x86-x.y.z.iso
        linux (loop)/isolinux/rescue32 isoloop=systemrescuecd-x86-x.y.z.iso
        initrd (loop)/isolinux/initram.igz
}

What happens when Grub2 boots is that:

  • Grub2 reads the partition that it considers as its root partition which is (hd0,1) in this example
  • Grub2 searches for a file called /systemrescuecd-x86-x.y.z.iso at the root of that partition
  • Grub2 loads both isolinux/rescuecd and isolinux/initram.igz<code> from the ISO image
  • Grub2 executes the kernel image (rescuecd)
  • The kernel boots, then it executes the <code>/init script from the initramfs
  • The /init boot script will see that the isoloop=systemrescuecd-x86-x.y.z.iso option has been used
  • This script tries to find systemrescuecd-x86-x.y.z.iso on any partition and device
  • This script mounts the ISO image and reads the root filesystem image (sysrcd.dat) and boots normally.
spacer