Friday, January 18, 2013

How to install SystemRescueCd on an USB-stick

Introduction

This chapter explains how to install SystemRescueCD on a USB stick manually. If you prefer, you can order a pre-configured USB stick with the latest SystemRescueCd already on it from the popular osdisc website
Installing SystemRescueCd on an USB stick allows you to use the system from a USB stick (mini hard disk) instead of using a CD-ROM. You need a recent SystemResuceCD, and a USB stick with enough space. You need at least 512 MB unless you have removed files from the official version. Your BIOS must be able to boot from USB hard disks, and the USB device must be defined before other devices in the boot devices order.
There is now an official SystemRescueCD installer for Windows that you should use. This page explains how to install SystemRescueCD on a USB stick. Many methods are possible. You should really follow one of the three recommended methods (sections A, B, C). The other methods are more complicated and are more likely to fail.
You may also be interested in making a backing store to keep your changes between reboots.

A) Recommended USB installation method from Linux

Overview

If you are running Linux on your computer it's very easy to install SystemRescueCD on a USB stick. You just have to download the ISO image of SystemRescueCD, and then run a script which is at the root of the CD-ROM. You don't have to burn the ISO image to a disc to do that, you just need to have the ISO image available from a running Linux system. Formatting the USB stick will remove all its content, so make sure you don't need the data or make a backup first.
  1. Download the SystemRescueCd-3.0.0 (or more recent) ISO image from the Download page
  2. Mount the ISO image using the -o loop and -o exec options of the mount command
  3. Plug in your USB stick and wait 5 seconds to allow enough time for the system to detect it
  4. Unmount the USB stick if auto-mount is enabled or if it was already mounted
  5. Run bash ./usb_inst.sh in a shell then select the correct USB device and press OK/Enter

Mount the CD-ROM ISO image

You first have to mount the ISO image (or a media where you have burned it). You just need an empty directory on your system on which the ISO image can be mounted. We will use /tmp/cdrom in this example but you can use any directory such as /mnt/cdrom:
mkdir -p /tmp/cdrom
mount -o loop,exec /path/to/systemrescuecd-x86-x.y.z.iso /tmp/cdrom

Plug in the USB stick

Just make sure the USB stick has been plugged in, and wait a few seconds to be sure the device has been detected by the system.

Execute the installer

Now you just have to execute the installation script which is at the root of the CD-ROM. This script requires several commands to run but it won't be a problem. To be sure the script will always work, these commands are part of the CD-ROM:
cd /tmp/cdrom
bash ./usb_inst.sh
This script will show you a list of USB sticks detected on your system. Only removable medias are in the list. This way it's not possible to destroy a persistent device by accident.

Unmount the ISO image

Now you can unmount the ISO image
cd ~
umount /tmp/cdrom

B) Recommended USB installation method from Windows

If you are running Windows on your computer you can download and execute a graphical installation program that will install SystemRescueCd on a removable device. You have to download the ISO image of SystemRescueCd since the installer needs it. It will extract all files from the ISO image to a temp directory (called work directory) and then you can customize these files, and finally use these files to either recreate a new ISO image or install it on an USB device. The USB stick must contain a FAT32 filesystem, which is the case in general if you use your USB stick from computers running Windows. If it's not the case you can just format the USB device again from the Windows explorer (it will remove all files it contains). You have to run this program with the Windows administrator privileges since the installer has to run syslinux to make the removable device bootable. The partition must have the "active" flag set for the boot to work.
The official SystemRescueCd installer for Windows is quite a compact self-contained EXE program. It can be executed directly as it requires no installation on the hard disk.
  1. Download SystemRescueCd-3.0.0 (or more recent) ISO image from the Download page
  2. Download SystemRescueCd installer for Windows (or the old version)
  3. Plug in your USB-stick and wait 5 seconds to allow enough time for the system to detect it
  4. Format the USB stick with a FAT32 filesystem from the explorer
  5. Create an empty work directory on the hard-disk (could be C:\Temp\sysresccd-workdir)
  6. Execute the installer that you have just downloaded
  7. Select the work directory which has been previously created
  8. Select the original ISO image that you have downloaded previously
  9. Select the USB stick in the removable device drop-down list
  10. Click on the Install button to run the installation
If you have problems with the SystemRescueCd USB installer for Windows you can try linuxliveusb

C) Alternative USB installation method from the CD-ROM

Overview

If you boot the CD-ROM edition of SystemRescueCD (3.0.0 or more recent), you can use it to install SystemRescueCD onto a USB stick. If you have a Linux system on your computer you can also use the first method, which does not require booting from a CD-ROM at all.
SystemRescueCD comes with a script to help you to detect the right USB device and to install SystemRescueCD onto it. Formatting the USB stick will remove all of its contents, so make sure you don't need that contents, or make a backup first.
  1. Download the most recent SystemRescueCD ISO image from the Download page
  2. Burn it onto a CD-ROM. You can use software such as Nero or ImgBurn on Windows or cdrecord/wodim/k3b under Linux.
  3. Boot from that CD-ROM with the default boot options.
  4. Plug in your USB stick and wait 5 seconds to allow enough time for the system to detect it.
  5. Type sysresccd-usbstick dialog in a shell then select the correct USB device and press OK/Enter

Instructions for manual installation

Instead of sysresccd-usbstick dialog you can also run the following commands by hand:
  1. Run sysresccd-usbstick listdev to see which devices are seen as USB-sticks
  2. Run sysresccd-usbstick writembr xxx where xxx is the name of the usb device
  3. Run sysresccd-usbstick format xxx where xxx is the name of the partition on your device
  4. Run sysresccd-usbstick copyfiles xxx where xxx is the name of the partition on your device
  5. Run sysresccd-usbstick syslinux xxx where xxx is the name of the partition on your device

Example of manual installation

root@sysresccd % sysresccd-usbstick listdev
Device [/dev/sdb] [Kingston DataTraveler U3 ] is removable and size=957MB
Device [/dev/sdb] is not mounted
Device [/dev/sdb] has one partition: /dev/sdb1

root@sysresccd % sysresccd-usbstick writembr /dev/sdb
The device [/dev/sdb] seems to be big enough: 957 MB.
--> install-mbr /dev/sdb --force
--> parted -s /dev/sdb mklabel msdos
--> parted -s /dev/sdb mkpartfs primary fat32 0 100%
--> parted -s /dev/sdb set 1 boot on

root@sysresccd % sysresccd-usbstick format /dev/sdb1
The device [/dev/sdb1] seems to be big enough: 956 MB.
mkfs.vfat 2.11 (12 Mar 2005)
Partition /dev/sdb1 has been successfully formatted

root@sysresccd % sysresccd-usbstick copyfiles /dev/sdb1
The device [/dev/sdb1] seems to be big enough: 956 MB.
/dev/sdb1 successfully mounted on /mnt/usbstick
Free space on /mnt/usbstick is 956MB
Files have been successfully copied to /dev/sdb1

root@sysresccd % sysresccd-usbstick syslinux /dev/sdb1
syslinux has successfully prepared /dev/sdb1

D) Installation from Linux using an ext3/ext4 filesystem

If you are a Linux user, you may prefer having a Linux filesystem such as ext3/ext4 instead of vfat on your USB stick. It should work with any filesystem supported by GRUB such as ext3, reiserfs, ... In that case you can use GRUB (legacy - version 0.9x) instead of syslinux to boot. Thanks to Christian Hesse who suggested these instructions.
  • Format the USB stick from Linux using the normal mkfs tool that comes with your favorite filesystem
If you are using SystemRescueCD-1.2 or more recent, it's recommended that you use an ext4 filesystem with the journal turned off (this is possible with Linux >= 2.6.29). USB sticks are Flash filesystems and this type of memory only supports a limited number of writes. Journaling filesystems will make many writes at the same location (where the journal is stored). Therefore, to extend the lifespan of the memory we should limit the number of writes. Here is how to use ext4 with the journaling turned off:
mke2fs -t ext4 -O ^has_journal /dev/sdf1
You could also use ext2 but it does not support extents, and then it requires more accesses to read/write large files to the disk.
  • Mount this filesystem to /media/usbstick and copy the files from your SystemRescueCD into this directory. (cf normal instructions)
  • Copy GRUB staging files from an existing GRUB installation: mkdir -p /media/usbstick/boot/grub ; cp -a /boot/grub/* /media/usbstick/boot/grub
  • Run grub-install --root-directory=/media/usbstick/ /dev/sdf (replace /dev/sdf with the name of your USB stick)
  • Create a menu.lst in /media/usbstick/boot/grub/. You have to replace (hd0,1) with the GRUB name of your USB partition.
timeout 5
color light-gray/black light-blue/black

title SystemRescueCd std-32bit
   kernel (hd0,1)/isolinux/rescuecd
   initrd (hd0,1)/isolinux/initram.igz

title SystemRescueCd std-64bit
   kernel (hd0,1)/isolinux/rescue64
   initrd (hd0,1)/isolinux/initram.igz

title SystemRescueCd alt-32bit
   kernel (hd0,1)/isolinux/altker32
   initrd (hd0,1)/isolinux/initram.igz

title SystemRescueCd alt-64bit
   kernel (hd0,1)/isolinux/altker64
   initrd (hd0,1)/isolinux/initram.igz

title MemTest+
    kernel (hd0,1)/isolinux/memtestp
    initrd (hd0,1)/bootdisk/initrd.cgz

title NT Password Editor
    kernel (hd0,1)/ntpasswd/vmlinuz
    initrd (hd0,1)/ntpasswd/initrd.cgz

title Gag
    kernel (hd0,1)/isolinux/memdisk
    initrd (hd0,1)/bootdisk/gag.img

title MHDD
    kernel (hd0,1)/isolinux/memdisk
    initrd (hd0,1)/bootdisk/mhdd.img

title Hardware Detection Tool
    kernel (hd0,1)/isolinux/memdisk
    initrd (hd0,1)/bootdisk/hdt.img

title Aida
    kernel (hd0,1)/isolinux/memdisk
    initrd (hd0,1)/bootdisk/aida.img

title Ranish Partition Manager
    kernel (hd0,1)/isolinux/memdisk
    initrd (hd0,1)/bootdisk/ranish.img

title FreeDOS
    kernel (hd0,1)/isolinux/memdisk
    initrd (hd0,1)/bootdisk/freedos.img
You should now be able to boot from this USB stick. You can also have a look at another usb-installation tutorial based on ext4 and grub.

E) Manual installation from Linux using cp (deprecated)

This method is a bit complicated so you should really consider using the automated installation script if you are running Linux. You can follow it anyway if you know what you are doing, or if you want to make extra customizations.

Step 1: Find the device name

You need the device of the USB stick. In most cases, Linux detects this device as an SCSI hard disk. In other words, it is detected as /dev/sda1 (first partition of first SCSI device), or /dev/sdb1 if you have another SCSI device. Since kernel 2.6.8 USB sticks may be seen as /dev/uba, /dev/ubb, ...
Here is how you can find the device name. First, start your computer under Linux with the USB stick unplugged. Then, load all USB modules (you may need to load other USB modules first). This command should not be required if the USB storage support is built-in in the kernel. If modprobe can't find this module, it might be normal.
modprobe usb-storage
Now, you have to plug in your USB stick, and have a look at the kernel messages. You may find the device name using either dmesg | tail -n 50 or fsarchiver probe
Here is an example of a report from the kernel:
kernel: usb 1-7: new high speed USB device using ehci_hcd and address 5
kernel: usb 1-7: New USB device found, idVendor=1516, idProduct=1213
kernel: usb 1-7: New USB device strings: Mfr=1, Product=2, SerialNumber=3
kernel: usb 1-7: Product: DISK 2.0
kernel: usb 1-7: Manufacturer: USB
kernel: usb 1-7: SerialNumber: 0018F3218E76A9C0D2CF846A
kernel: usb 1-7: configuration #1 chosen from 1 choice
kernel: scsi6 : SCSI emulation for USB Mass Storage devices
kernel: scsi 6:0:0:0: Direct-Access    USB DISK 2.0    1.00 PQ: 0 ANSI: 2
kernel: sd 6:0:0:0: Attached scsi generic sg6 type 0
kernel: sd 6:0:0:0: [sdf] 16035840 512-byte logical blocks: (8.21 GB/7.64 GiB)
kernel: sd 6:0:0:0: [sdf] Write Protect is off
kernel: sd 6:0:0:0: [sdf] Assuming drive cache: write through
kernel: sd 6:0:0:0: [sdf] Assuming drive cache: write through
kernel: sdf: sdf1
kernel: sd 6:0:0:0: [sdf] Assuming drive cache: write through
kernel: sd 6:0:0:0: [sdf] Attached SCSI removable disk
Here you can see that fsarchiver probe reports all devices and partitions found on your system:
# fsarchiver probe
[======DISK======] [=============NAME==============] [====SIZE====] [MAJ] [MIN]
[sda             ] [ST3808110AS                    ] [    74.53 GB] [  8] [  0]
[sdf             ] [DISK 2.0                       ] [     7.65 GB] [  8] [ 80]

[=====DEVICE=====] [==FILESYS==] [======LABEL======] [====SIZE====] [MAJ] [MIN] 
[sda1            ] [ext3       ] [boot             ] [   768.70 MB] [  8] [  1] 
[sda2            ] [LVM2_member] [<unknown>        ] [    65.78 GB] [  8] [  2] 
[sda3            ] [ext3       ] [spare            ] [     8.00 GB] [  8] [  3] 
[sdf1            ] [ext4       ] [usb8gb           ] [     7.64 GB] [  8] [ 81] 
Then, you should try to mount the device:
mkdir /mnt/usbstick
mount -t vfat /dev/sdf1 /mnt/usbstick
If there is not enough space left on the device (about 230 MB), you will have to erase the current files (all data will be lost):
rm -rf /mnt/usbstick/*
In the next sections we will assume your stick is /dev/sdf. It's very important that you use the right device name.

Step 2: Reinitialization of the stick

The following instructions may not be required, it depends on how your USB stick is configured. So you can try to skip this the first time. In case of problems getting the USB stick to boot, you should really try this. Confirm that you have a backup of the data that are on your stick before you do this. Thanks to jadjay in the forums for this addition to the instructions. We assume your device is /dev/sdf but you must replace it with the device name of your own USB stick. Be very sure that this is the correct device !
First, run cfdisk to check that the partition has the correct ID in the partition table of your USB stick. Select type LBA FAT32 may be 0B or 0C, to make it bootable.
cfdisk /dev/sdf
Use mkfs.vfat to format the partition. All data will be erased, so make sure you don't need the data which it contains.
mkfs.vfat -F 32 -n SYSRESC /dev/sdf1
The following dd command will overwrite the first 404 bytes of the MBR of your stick. It will erase the previous boot instructions with the default ones to make sure that it will work. It does not change anything in the partition table since the partition table starts at offset 446 in the MBR.
 dd if=/usr/share/syslinux/mbr.bin of=/dev/sdf
Synchronize to make sure that all the changes have been flushed to the disk.
sync

Step 3: Copy files from the CD-ROM

Now, you have to copy the most important files. The SystemRescueCD disc must be mounted on /mnt/cdrom. You can mount the ISO file too, in order to avoid burning a CD-R. The stick is mounted on /mnt/usbstick. Be careful, according to a user in the forums the order matters:
You should check that you are using syslinux-4.05 or newer.
cp -af /mnt/cdrom/* /mnt/usbstick/
rm -rf /mnt/usbstick/syslinux
mv /mnt/usbstick/isolinux/isolinux.cfg /mnt/usbstick/isolinux/syslinux.cfg
sed -i -e 's/scandelay=1/scandelay=5/g' /mnt/usbstick/isolinux/syslinux.cfg
mv /mnt/usbstick/isolinux /mnt/usbstick/syslinux

Step 4: Make the disk bootable

Now, you have to unmount the USB stick, and make it bootable with syslinux. Of course, you have to replace /dev/sdf1 with the device name of your stick:
umount /mnt/usbstick
syslinux /dev/sdf1
sync
A user reported that ms-sys -s /dev/sdX helps in case of problems. So you may consider that if you initially have a problem.

4 comments:

  1. I am very impressed with your post because this post is very beneficial for me and provide a new knowledge…
    I like your all post. You have done really good work. Thank you for the information you provide, it helped me a lot.

    SystemRescueCd Crack
    HandBrake CS2 Crack
    MacKeeper Crack
    NCH Express Zip Crack
    TeamViewer Crack
    HandBrake CS2 Crack
    WavePad Sound Editor Crack
    Adobe Lightroom Crack

    ReplyDelete
  2. I am surprised to see this software Because we download this application free and it is easy to use. There are many features and advantages. We may apply this software on our PC in a very easy way. That's Why I recommended this software to you. https://windowsactivators.org/reloader-activator-2019/

    ReplyDelete