Archive for March, 2008

HowTo: No-effort Backup Solution for Partitions and Hard Drives

March 6, 2008 3 comments

HowTo: Install SystemRescueCD on a Dedicated Hard Disk Partition.
HowTo: No-effort Backup Solution for Partitions and Hard Drives

Downloading and burning SystemRescueCD provides a bootable Gentoo-based distro on a CD. The installed applications focus on restoring disabled Linux/windows distros on the hard drives, or retrieving data if things go terribly wrong. You can operate direct from the booted CD. It’s great. But SystemRescueCD also contains PartImage, the powerful free Linux alternative to Norton Ghost. So it’s a too-easy tool for backing up single or multiple partitions, or whole drives.

Here I recount HowTo install SystemRescueCD onto a dedicated partition. I include a script for creating backup images of your hard drive partitions. Once you go through this tutorial as a practical exercise, you’ll have the knowledge and confidence to customise all manner of backup solutions so very easily.

This tutorial is for the middle ground reader, too hard for new Linux users and too simple for Gurus. It’s drawn from material in the On Line Manual at the System Rescue CD Site.

Summary of the steps for installing SystemRescueCD on a dedicated hard disk partition:

  1. Prepare a separate SystemRescue partition
  2. Download the SystemRescueCD ISO file
  3. Extract bootable image files from the ISO to the boot partitiion
  4. Edit Suse’s GRUB configuration to facilitate booting the SystemRescue partition
  5. Prepare and place your scripts, if any
  6. Boot with Suse’s loader –> select item SystemRescueCd

Step 1: Prepare a separate SystemRescue partition: I leave it to you to make the partition. You need about 160Mb plus any extra storage you might need. I use 400Mb. Note that this partition becomes the root of the cdrom after SysRescueCD boots from it, so its filesystem becomes read-only. This means you will select writeable workspaces on other partitions.

Suppose for illustration that you have prepared partition hda13 for the installation. Now make a directory to mount hda13 into openSUSE, e.g. /SysRescCD. You can mount hda13 with this command:

mount /dev/hda13 /SysRescCD

BUT I use the more convenient permanent mount created by placing this line into /etc/fstab:

/dev/hda13    /SysRescCD    ext3    defaults    1 2

You can do that with Yast –> System –> Partitioner OR more simply by issuing this command in a console: kdesu kwrite /etc/fstab and then typing the line in.

Step 2: Download the SystemRescueCD ISO file: You can download the CD ISO for the SystemRescueCD by following this project download link. The ISO filename looks like this: systemrescuecd-x86-x.y.z.iso. Place it anywhere on your hard drives, at e.g. /path_to/systemrescuecd-x86-x.y.z.iso

Step 3: Extract bootable image files from the ISO and place them in boot partition: You can mount the ISO file for viewing the files on the CD. First create a folder to mount the ISO in, e.g. /iso. Then mount the ISO with this command in a root terminal:

mount -o loop -t iso9660  /path_to/systemrescuecd-x86-0.3.6.iso    /iso

You’ll find these three files of special interest on these paths inside the mount folder:


Create the folder sysrcd in the root of hda13, using the mount point /SysRescCD to place it at /SysRescCD/sysrcd. Then copy the three files into folder sysrcd. The name sysrcd is immutable.

The partition hda13 is now configured with the bootable Gentoo distro and all that remains is to point Suse’s bootloader at it.

Step 4: Edit Suse’s GRUB configuration to facilitate booting the SystemRescue partition: You can open the Grub configuration file in a text editor with commands like this one for Kwrite:

kdesu kwrite /boot/grub/menu.lst

Edit/add these lines at the bottom of the file, one blank line below the last entry:

title    SystemRescueCd
root    (hd0,12)
kernel    /sysrcd/rescuecd root=/dev/ram0 init=/linuxrc looptype=squashfs loop=/sysrcd/sysrcd.dat splash=silent nosound subdir=sysrcd cdroot=/dev/hda13 setkmap=us vga=0x31a
initrd    /sysrcd/rescuecd.igz

Remember to adapt my (hd0,12) which is for my hda13, across to your situation. Also, note that the sequence beginning “kernel” and ending “0x31a” is all the same/one line. I’ve included three parameters at the end: cdroot=/dev/hda13 setkmap=us vga=0x31a. These set the distro upto have hda13 at the root of the cd (on /mnt/cdrom), to have the US keyboard and for a vga screen that suits me. If you wanted to boot into the Window Manager Desktop Environment to access GUI tools, you would use this line instead:

kernel    /sysrcd/rescuecd root=/dev/ram0 init=/linuxrc looptype=squashfs loop=/sysrcd/sysrcd.dat splash=silent nosound subdir=sysrcd cdroot=/dev/hda13 setkmap=us vga=0 dostartx

A list of boot options can be seen on this link at the SystemRescueCD site.

Step 5: Prepare and place your scripts, if any: Pre defined sites [like the floppy disk, the root of the CDROM, the root of the installation partition] are searched straight after booting for scripts which if found are executed. You can have one or many scripts. See the SystemRescueCD site for full details. I’ll deal with only one location here: the root of the installation partition. It’s really simple. Rust create a script called autorun and lodge it in the root of the installation partition, hda13. It will run just after the system boots to a console.

Step 6: Boot with Suse’s loader: Reboot and select item SystemRescueCd. The root of partition hda13 automounts at location /mnt/cdrom in the booted-up virtual filesystem. All files and scripts placed on the partition are thus available at /mnt/cdrom.

Backup Script: I constantly change the filesystems on my primary hard drive and it’s hard to prevent damage to them. So I back them up regularly. This takes a long time. I use a script called autorun in the root partition of hda13 and simply boot to SystemRescueCD on hda13 and walk away to let the job proceed. Here’s my scenario and script. You could easily modify the script for your scenario.

Scenario: I have a Suse root partition at hda5 and a /home partition at hda6. These have to be backed up when they’re not being used, i.e. from within another operating system. The Gentoo installation on the SystemRescueCD partition contains a script, “autorun”, which employs “partimage”, the Linux free version of “Ghost”. It is perfect for the task. I have prepared a folder called “partimage” on partition hdb2 on IDE2 drive. The script mounts hdb2 into Gentoo/SystemRescueCD’s filesystem, generates a date-coded folder on hdb2 and copies image files across from the Suse root and home partitions.


# mount the target directory
mkdir /mnt/hdb2
mount /dev/hdb2 /mnt/hdb2
# assign today’s date to xx, example 071130 on 30Nov2007
xx=`date +%y%m%d`
# make a directory in the folder “partimage” on hdb2 and name it for the date
mkdir /mnt/hdb2/partimage/$xx
cd /mnt/hdb2/partimage/$xx
# write start time to a logfile
echo ‘start at: ‘`date`>$zz
# make an image of suse102_root options: -z1=gzip -d=no description save=save_image -b=batch(not gui) -f3=quit when finished
partimage -z1 -d save -b -f3 /dev/hda5 /mnt/hdb2/partimage/$xx/hda5.partimg.gz
# make an image of /home options: -z1=gzip -d=no description save=save_image -b=batch(not gui) -f3=quit when finished
partimage -z1 -d save -b -f3 /dev/hda6 /mnt/hdb2/partimage/$xx/hda6.partimg.gz
# write contents of file autorun to a file in the target directory
cat /mnt/cdrom/autorun >>script.used
# write end time to the logfile
echo ‘end at: ‘`date`>>$zz
# write the contents of the backup directory into the logfile
ls -l>>$zz

These are the things to customise: Change hdb2 to match your target storage partition. Change hda5 to match your root partition. Change hda6 to match your home partition. Everything else should match your system.

This is the key line:

partimage -z1 -d save -b -f3 /dev/hda5 /mnt/hdb2/partimage/$xx/hda5.partimg.gz

If you have six partitions, duplicate this line six times, replacing hda5 with your correct partition designations and hdb2 with your target storage/backup partition.

That’s all there is folks, enjoy.

For more technical articles, news and forum discussion logon

Categories: Linux

How to: Compile Linux kernel 2.6

March 6, 2008 Leave a comment

Compiling custome kernel has its own advantages and disadvantages. However new Linux user / admin find it difficult to compile kernel. Compiling kernel needs to understand few things and then just type couple of commands. This step by step howto covers compiling Linux kernel version 2.6 under Debian GNU Linux. However, instructions remains same for any other distribution except for apt-get command.

Step # 1 Get Latest Linux kernel code

Visit and download the latest source code. File name would be linux-x.y.z.tar.bz2, where x.y.z is actual version number. For example file inux-2.6.23.tar.bz2 represents 2.6.23 kernel version. Use wget command to download kernel source code:
$ cd /tmp
$ wget

Note: Replace x.y.z with actual version number.

Step # 2 Extract tar (.tar.bz3) file

Type the following command:
# tar -xjvf linux-2.6.23.tar.bz2 -C /usr/src
# cd /usr/src

Step # 3 Configure kernel

Before you configure kernel make sure you have development tools (gcc compilers and related tools) are installed on your system. If gcc compiler and tools are not installed then use apt-get command under Debian Linux to install development tools.
# apt-get install gcc

Now you can start kernel configuration by typing any one of the command:

  • $ make menuconfig – Text based color menus, radiolists & dialogs. This option also useful on remote server if you wanna compile kernel remotely.
  • $ make xconfig – X windows (Qt) based configuration tool, works best under KDE desktop
  • $ make gconfig – X windows (Gtk) based configuration tool, works best under Gnome Dekstop.

For example make menuconfig command launches following screen:
$ make menuconfig

You have to select different options as per your need. Each configuration option has HELP button associated with it so select help button to get help.

Step # 4 Compile kernel

Start compiling to create a compressed kernel image, enter:
$ make
Start compiling to kernel modules:
$ make modules

Install kernel modules (become a root user, use su command):
$ su -
# make modules_install

Step # 5 Install kernel

So far we have compiled kernel and installed kernel modules. It is time to install kernel itself.
# make install

It will install three files into /boot directory as well as modification to your kernel grub configuration file:

  • config-2.6.23
  • vmlinuz-2.6.23

Step # 6: Create an initrd image

Type the following command at a shell prompt:
# cd /boot
# mkinitrd -o initrd.img-2.6.23 2.6.23

initrd images contains device driver which needed to load rest of the operating system later on. Not all computer requires initrd, but it is safe to create one.

Step # 7 Modify Grub configuration file – /boot/grub/menu.lst

Open file using vi:
# vi /boot/grub/menu.lst

title           Debian GNU/Linux, kernel 2.6.23 Default
root            (hd0,0)
kernel          /boot/vmlinuz root=/dev/hdb1 ro
initrd          /boot/initrd.img-2.6.23

Remember to setup correct root=/dev/hdXX device. Save the file. If you think editing and writing all lines by hand is too much for you then try out update-grub command to update the lines for each kernel in /boot/grub/menu.lst file. Just type command:
# update-grub
Neat. Huh?

Step # 8 : Reboot computer and boot into your new kernel

Just issue reboot command:
# reboot
For more information see:

  • Our Exploring Linux kernel article and Compiling Linux Kernel module only.
  • Official README file has more information on kernel and software requirement to compile it. This file is kernel source directory tree.
  • Documentation/ directory has interesting kernel documentation for you in kernel source tree.

For more technical articles, news and forum discussion logon

Categories: Kernel

Multiboot a mixture of Linux and Microsoft distributions Using Lilo and/or Grub [tested for Suse, Mandriva, Debian, Fedora, MSDos & Windows XP]

March 6, 2008 1 comment

This Post has been moved to

For more technical articles, news and forum discussion logon

Categories: Linux

How to access Windows Fat32 partition in Suse 10.3?

March 6, 2008 1 comment

This post has been moved to

For more technical articles, news and forum discussion logon

Categories: Linux