Sysresccd-manual-en How to install SystemRescueCd on an USB-stick
From SystemRescueCd
Introduction
This chapter explains how to manually install SystemRescueCd on an USB-stick. It allows to use this system from an USB stick (mini hard disk) instead of using a CDRom. You need a recent SystemResuceCd, and an USB stick with enough space. If you use the official version, you need at least 512 MB. Of course, you need a computer that supports USB, with almost a free USB socket. You BIOS must be able to boot on USB hard disks, and it must be defined before other devices in the boot devices order.
If you are a Windows user, you can also use unetbootin or linuxliveusb. These two programs can automatically download it and install it on your USB stick for you. This page explains how to install SystemRescueCd on a USB stick by hand from either Windows or Linux, multiple methods are provided.
Manual installation
You need a recent version syslinux (3.35 or newer) to be installed on your system. If you are doing the installation from Windows, you can just find syslinux.exe in a zipfile on the cdrom. If you are doing the installation from linux, you can either install syslinux on your system, or just install from the cdrom edition of SystemRescueCd.
You may also be interested in making a backing store to keep your changes between reboots.
Installation from Linux is recommended since several programs such as cfdisk may be required in some situations, and these tools are not available on Windows. If you have no Linux installed on your computer, you can just install SystemRescueCd on an USB from the system you get when you boot the CDRom version of SystemRescueCd.
First manual method: scripted installation from SystemRescueCd
Overview
If you boot the cdrom edition of SystemRescueCd (1.1.4 or more recent), you can use it to install SystemRescueCd on an USB stick. SystemRescueCd comes with a script to help you to detect the right USB device and to install SystemRescueCd on it. Formatting the USB-stick will remove all its content, so make sure you don't need it or make a backup first.
- Download the most recent SystemRescueCd ISO image
- Burn it on a cdrom. You can use software such as Nero on Windows or cdrecord under Linux.
- Boot on that cdrom with the default boot options.
- Plug your USB-stick and wait 5 seconds to leave enough time for the system to detect it
- Run
sysresccd-usbstick listdevto see which devices are seen as USB-sticks - Run
sysresccd-usbstick writembr xxxxwherexxxis the name of the usb device - Run
sysresccd-usbstick format xxxwherexxxis the name of the partition on your device - Run
sysresccd-usbstick copyfiles xxxwherexxxis the name of the partition on your device - Run
sysresccd-usbstick syslinux xxxwherexxxis the name of the partition on your device
Example of installation
root@sysresccd % sysresccd-usbstick listdev Device [/dev/sdb] detected as [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
Second manual method: installation by hand from Linux
If you don't have Linux installed, you can burn SystemRescueCd on a CDRom, and perform the install from this system itself.
step-01: 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 know 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 build-in the kernel. If modprobe can't find this module, it might be normal.
modprobe usb-storage
Now, you have to plug your USB stick, and have a look at the kernel messages. You may find the device name.
dmesg | tail -n 50
Here is a example of report from the kernel:
usb 2-6: new high speed USB device using ehci_hcd and address 7 usb 2-6: configuration #1 chosen from 1 choice scsi5 : SCSI emulation for USB Mass Storage devices usb-storage: device found at 7 usb-storage: waiting for device to settle before scanning scsi 5:0:0:0: Direct-Access Kingston DataTraveler U3 6.50 PQ: 0 ANSI: 0 CCS sd 5:0:0:0: [sdf] 1961695 512-byte hardware sectors (1004 MB) sd 5:0:0:0: [sdf] Write Protect is off sd 5:0:0:0: [sdf] Mode Sense: 45 00 00 08 sd 5:0:0:0: [sdf] Assuming drive cache: write through sd 5:0:0:0: [sdf] 1961695 512-byte hardware sectors (1004 MB) sd 5:0:0:0: [sdf] Write Protect is off sd 5:0:0:0: [sdf] Mode Sense: 45 00 00 08 sd 5:0:0:0: [sdf] Assuming drive cache: write through sdf: sdf1 sd 5:0:0:0: [sdf] Attached SCSI removable disk sd 5:0:0:0: Attached scsi generic sg2 type 0 usb-storage: device scan complete
Then, you should try to mount the device:
mkdir /mnt/usbstick mount -t vfat /dev/sdf1 /mnt/usbstick
If there is no space enough 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 really important that you use the right device name.
step-02: 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 it the first time. Anyway in case of problem to get the USB stick to boot, you should really try that. Check 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 have to replace it with the device name of your own USB stick. Be really sure this is the right device !
First, run cfdisk to check that the partition has the right 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 are on it.
mkfs.vfat -F 32 -n SYSRESC /dev/sdf1
The 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 changes anything to the partition table since the partition table is starting at offset 446 in the MBR.
dd if=/usr/share/syslinux/mbr.bin of=/dev/sdf
Synchronizes to make sure the all the changes have been flushed to the disk.
sync
step-03: Copy files from the CDRom
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 an user in the forums the order matters:
New instructions to copy the files
You should use these instructions which are the new method to install SystemRescueCd if you are using syslinux-3.52 or newer.
cp -af /mnt/cdrom/* /mnt/usbstick/ rm -rf /mnt/usbstick/syslinux mv /mnt/usbstick/isolinux/isolinux.cfg /mnt/usbstick/isolinux/syslinux.cfg mv /mnt/usbstick/isolinux /mnt/usbstick/syslinux
Old instructions to copy the files
You should install using these instructions only if you are using a version of syslinux which id older than 3.52, or you can try that if the new instruction do not work.
cp /mnt/cdrom/syslinux/syslinux.cfg /mnt/usbstick/ cp -af /mnt/cdrom/isolinux/* /mnt/usbstick/ cp -af /mnt/cdrom/bootdisk/* /mnt/usbstick/ cp -af /mnt/cdrom/ntpasswd/* /mnt/usbstick/ cp /mnt/cdrom/sysrcd.dat /mnt/usbstick/
step-04: 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/sda1 with the device name of your stick:
umount /mnt/usbstick syslinux /dev/sdf1 sync
An user reported that ms-sys -s /dev/sdX helps in case of problems. So you may think about it if it does not work.
Third manual method: installation from Windows
step-01: Find the device letter
You have to plug your USB stick while Windows is running. In the explorer, a new drive letter will appear, and you can access the file of this USB stick. In this manual, we will suppose your USB stick letter is E:. Don't forget to change this letter in the commands if required.
step-02: Format the USB-stick as FAT
First, format the device. You can just right-click on the USB-device in the Explorer, and then select "Format...", and choose a FAT filesystem (it won't work with NTFS).
step-03: Copy files from the CDRom
Now, you have to copy the most important files from the CDRom. If you don't want to burn the CDRom, you can read the files from the ISO by mounting the disc with a tool such as Daemon-tools.
- Copy all the files of the cdrom edition of SystemRescueCd to the root of the USB device
- Rename the file in
isolinuxwhich is calledisolinux.cfgtosyslinux.cfg - Remove the old
syslinuxdirectory if it exists (it has been removed in sysresccd-1.1.4) - Rename the directory called
isolinuxtosyslinux
step-04: Make the disk bootable
Now, you have to make your stick bootable with syslinux. You will have to run this program from a prompt console (cmd.exe). Don't forget to change this letter in the commands if required.
syslinux -ma E:
You can find the syslinux program on the CDRom. Please, check you have syslinux version 3.52 or newer. The Windows version is provided as a ZIP archive. You just need syslinux.exe from the archive.
Users have reported that the option ma may be necessary with syslinux to get it to work. That's why we provides these options in that handbook. It works only on Windows:
- -m means write mbr
- -a means make drive partition active (aka bootable).
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 instead of syslinux to boot. Thanks for Christian Hesse who suggested these instructions.
- Format the usb stick from linux using the normal mkfs tool that comes with your favourite filesystem
If you are using SystemRescueCd-1.2 or more recent, it's recommended to use an ext4 filesystem with the journal turned off (it's possible with linux >= 2.6.29). USB sticks are flash filesystems so the memory only supports a limited number of writes. To preserve the lifespan of the memory we should then limit the number of writes and journalling filesystems will make many writes access at the same location (where the journal is stored). Here is how to use ext4 with the journalling turned off:
mke2fs -t ext4 -O ^has_journal /dev/sdf
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 rescue cd into this directory. (cf normal instructions)
- Run
grub-install --root-directory=/media/usbstick/ /dev/sdf(replace/dev/sdfwith the name of your usbstick) - 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 32bit kernel (hd0,1)/isolinux/rescuecd initrd (hd0,1)/isolinux/initram.igz title SystemRescueCd 64bit kernel (hd0,1)/isolinux/rescue64 initrd (hd0,1)/isolinux/initram.igz
You should now be able to boot from this usbstick.
Booting from the USB stick
First, check the "USB hard disk" is defined as the first boot device in your BIOS. If that works, you should see the SystemRescueCd boot splash with the prompt. It must not be required to add option "usbstick" to the command line, since it has been added in syslinux.cfg. But if you have problems, try it anyway. For example, if you want to boot with the default boot image and with a british keybaord, you should type this at prompt:
rescuecd setkmap=uk
You should press F2, F3, F4 for more help about boot options. Then, press enter. If must work as a regular SystemRescueCd from a CDRom drive.
USB keys models known to work
It's sometimes a pain to get syslinux to work on an USB key. Here are some models reported by users that are known to work well with syslinux, and on which you must be able to install SystemRescueCd:
- Kingston DataTraveler 1GB
- COSK'EY Silver (exists in 2GB or 4GB or 8GB).
- PQI, U310, 1 Go
- 2GB Cruzer Titanium (SanDisk U3 Titanium 3.27 PQ: 0 ANSI: 2)
