Installing SystemRescueCd on the disk


Introduction

There is an easy way to boot SystemRescueCd from the harddisk. It can be convenient if you often want to boot on SystemRescueCd as it will be faster and there is no need to insert any media before you restart your computer. This method allows to use SystemRescueCd as you do with the CDRom version. It also allows to boot SystemRescueCd if you do not have any CD/DVD drive or USB socket 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.

The installation is done by copying files from the SystemRescueCd media to the local filesystem where your operating system is installed. This approach does not require any repartitioning of your disk. Using grub4dos you can even install SystemRescueCd on a Windows NTFS partition. All you have to do is to install the files that are on the SystemRescueCd disc to an existing partition on your local disk, that can be either a linux partition (ext4, xfs, …) or a Windows one (NTFS). That way you can boot SystemRescueCd from your Windows partition, and using the

```ntpass``` to reset the administrator password or ```ntfs-3g``` to work on
the filesystem where it is installed.

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

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

The last section of this page 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 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 SystemRescueCd main files
to the partition. If that is a Windows 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 Daemon-Tools 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```,
```rescue32```, ```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 Linux bootmanager configuration (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/grub.d/``` for Grub2). You have to customize the configuration
given there. With grub, you will have to give the grub device name for the
partition you have chosen. It is usually a name such as ```(hd0,0)``` instead of
```sda1``` or ```(hd0,1)``` instead of ```sda2```, ... Then, you may update
several options related to your keyboard (```setkmap=xx```). You may have a look
at ```isolinux.cfg``` that is on the CDRom, if you do not know the values you
can use for these options.

### Example for Grub2  bootmanager
Here is an example of Grub2 configuration. Create a new file such as
```/etc/grub.d/20_sysresccd``` so its configuration is located after your
default operating system configuration. The search directive is very important
as it must provide a way for grub to locate the filesystem which contains the
SystemRescueCd files. In the following example the filesystem is identified
using its label which is ```boot``` but you can also identify the filesystem
using its UUID if you prefer.

menuentry ‘SystemRescueCd’ { load_video insmod gzio insmod part_gpt insmod part_msdos insmod ext2 search –no-floppy –label boot –set=root echo ‘Loading Linux kernel …’ linux /sysrcd/rescue64 docache echo ‘Loading initial ramdisk …’ initrd /sysrcd/initram.igz }


You can then run a command such as grub-mkconfig which will produce the final grub
configuration from fragments located in ```/etc/grub.d/```.

## 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 straight forward. 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```

### install grub4dos
You must [download grub4dos](https://gna.org/projects/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``` but it should work with any recent version.

### update the windows boot loader
#### update your boot.ini (if you are using Windows XP or older)
These instructions should work on Windows NT4/2000/2003/XP. Edit ```C:\boot.ini```
(with a text editor such as Notepad++, do not use Microsoft 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: do not replace your ```boot.ini``` with
the version given there. It is 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 (if you are using Windows Vista/7/8/10)
Together with ```grldr``` you need to copy ```grldr.mbr``` (part of the archive)
to the root of the Windows 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


### 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.

### check the SystemRescueCd files
Check that the SystemRescueCd files are correctly installed in ```C:\sysrcd```

### reboot
Just reboot and choose ```grldr```, then ```SystemRescueCd``` in the boot menus
displayed by the Windows boot loader.

## Booting the ISO image from the disk using Grub2
Grub2 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
filesystem 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.

This installation can be done either by following this documentation or by using
a package from Linux distributions on [ArchLinux](https://aur.archlinux.org/packages/systemrescuecd/)
or [Gentoo](https://packages.gentoo.org/packages/sys-boot/systemrescuecd-x86-grub)

Grub2 knows what an ISO image is and it will load the kernel image such as
rescue32 or 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 specifies the path of the ISO image in the partition that grub
considers as its root partition. It is 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 Grub2 configuration section. Replace
```rescue64``` below with your kernel, when you chose a different kernel:

menuentry “SystemRescueCd (isoloop)” { search –no-floppy –label boot –set=root loopback loop /systemrescuecd-x86-x.y.z.iso linux (loop)/isolinux/rescue64 isoloop=systemrescuecd-x86-x.y.z.iso initrd (loop)/isolinux/initram.igz } ```

What happens when Grub2 boots is that:

  • Grub2 reads the filesystem that it considers as its root partition (the filesystem labelled as boot)
  • Grub2 searches for a file called /systemrescuecd-x86-x.y.z.iso at the root of that partition
  • Grub2 loads both isolinux/rescue64 and isolinux/initram.igz from the ISO image
  • Grub2 executes the kernel image (rescue64)
  • The kernel boots, then it executes the /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.

Documentation
Manual (EN)
LVM Guide
Disk partitioning
Networking
Manual (FR)

Related
Sourceforge
FSArchiver