分类: LINUX
2009-04-16 08:22:47
Contents[] |
This chapter explains how to install SystemRescueCd on an USB-stick. It allows to use this system from an USB stick (mini hard disk) instead of using a CDRom. First, you need SystemResuceCd 0.2.18 or newer, 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.
You also 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.
If you install SystemRescueCd on an USB stick, you may also be interested in making a 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, just can just install SystemRescueCd on an USB from the system you get when you boot the CDRom version of SystemRescueCd.
If you don't have Linux installed, you can burn SystemRescueCd on a CDRom, and perform the install from this system itself.
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.
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 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, to 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 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/lib/syslinux/mbr.bin of=/dev/sdf
Synchronizes to make sure the all the changes have been flushed to the disk.
sync
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 the order matters:
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
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/
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 that ms-sys -s /dev/sdX
helps in case of problems. So you may think about it if it does not work.
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.
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).
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.
isolinux
which is called isolinux.cfg
to syslinux.cfg
syslinux
directory if it exists (it has been removed in sysresccd-1.1.4)
isolinux
to syslinux
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 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:
If you boot the cdrom edition of SystemRescueCd, you can use it to install SystemRescueCd on an USB stick. SystemRescueCd-1.1.4 comes with a new 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.
sysresccd-usbstick listdev
to see which devices are seen as USB-sticks
sysresccd-usbstick writembr xxxx
where xxx
is the name of the usb device
sysresccd-usbstick format xxx
where xxx
is the name of the partition on your device
sysresccd-usbstick copyfiles xxx
where xxx
is the name of the partition on your device
sysresccd-usbstick syslinux xxx
where xxx
is the name of the partition on your device
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
If you are a linux user, you may prefer having a linux filesystem such as ext3 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.
grub-install --root-directory=/media/usbstick/ /dev/sdf
(replace /dev/sdf
with the name of your usbstick)
/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.
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.
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: