About how to create a USB boot disk

Source: Internet
Author: User
About how to create a USB boot disk-Linux Release Technology-Debian in the stable version installation wizard of Debian4.0i386. For more information, see the following. 4. Prepare a file to create a USB boot disk.
To create a USB boot disk, you must first have a running GNU/Linux system and USB support. You should ensure that the usb Kernel module is guided (modprobe usb-storage) and the SCSI device USB disk is mapped (in this example,/dev/sda is used ). To enable the file to be correctly written to your disk, you can and must disable the write protection switch.
Note that the size of the USB disk should be at least 256 MB (smaller setting is possible. For details, see section 4.4.2 "Copy files-flexible mode" below ").

4.4.1. Copy files-easy way
This section contains all the hd-media/boot.img.gz installation files (including kernel files), SLINUX system files, and its configuration files. You only need to extract the USB disk that corresponds to you directly:
# Zcat boot.img.gz>/dev/sda

Warning
Using this method may destroy installed devices. Make sure that you are using the correct device name for your USB disk.
After a USB boot disk (mount/dev/sda/mnt) is mounted, a complete file system will be recorded and copied to it to copy the Debian netinst or businesscard ISO image (see Section 4.4.3, "Add ISO image "). Unmount the disk (umount/mnt ).

4.4.2. Copy files-flexible methods
If you prefer more flexibility or want to know what is going on, you should install the file on your disk using the following methods.
4.4.2.1. USB disk partition under Intel x86
We will show how to set the boot disk in the first partition to replace the entire device.

Description
Because most USB disks are originally set to a unique FAT16 partition, you probably won't repartition or reformat the disk. If you think this is required, use the command cfdisk or other partition tools to set the FAT16 partition, and then use the following command to set the file system:
# Mkdosfs/dev/sda1

Be careful when using the correct device name for your USB disk. The mkdosfs command is included in the dosfstools package of Debian.
After starting the USB disk, in order to correctly boot the kernel, we also put the boot loader on this disk. Although all the Boot Loader (LILO) can boot, it can easily use the LINUX system because it uses the FAT16 partition and can be reset Based on the edited text file. Any operating system supporting the FAT file system can be used and the configuration of the startup loader is changed.
Set syslinux in the FAT16 partition of your USB disk and install the syslinux and mtools software packages on your system. Run the following command:
# Syslinux/dev/sda1

You must be careful when using the correct device name. When SYSLINUX is started, partitions cannot be mounted. In this way, you can write a boot sector to the partition so that it contains the file for ldlinux. sys to start the loader code.
Mount a partition (mount/dev/sda1/mnt) and copy the following files from the Debian file:
Vmlinuz (kernel binary)
Initrd.gz (starts the ramdisk image)
Syslinux. cfg (SYSLINUX configuration file)
Kernel module options
If you want to rename a file, note that SYSLINUX may only process the DOS (8.3) file name.
The syslinux. cfg configuration file should include the following two types:
Default vmlinuz
Add initrdw.initrd.gz

4.4.3. Add an ISO Image
Installers often want to find a Debian ISO image on the disk to supplement the data during installation. In this way, your next step will be to copy a Debian ISO image (businesscard, netinst, or even a full disc image) to your disk (select a suitable one. The image file name must end with. iso.
Skip this step if you do not want to use an ISO image after installing it over the network. It is more likely that you must use the initial ramdisk started from netboot to replace the hd-media, because hd-media/initrd.gz is not supported by the network.
Then, unmount the USB boot disk (umount/mnt) and activate its write protection switch.

4.4.4 start a USB disk

Warning

If your system refuses to start from the boot disk, the disk may contain an invalid primary Boot Record (MBR ). To solve this problem, install the mbr software package and run the following command:
# Install-mbr/dev/sda

The original text is as follows:

4.4. Preparing Files for USB Memory Stick Booting
To prepare the USB stick, you will need a system where GNU/Linux is already running and where USB is supported. you shoshould ensure that the usb-storage kernel module is loaded (modprobe usb-storage) and try to find out which SCSI device the USB stick has been mapped to (in this example/dev/sda is used ). to write to your stick, you may have to turn off its write protection switch.
Note that the USB stick shocould be at least 256 MB in size (smaller setups are possible if you follow Section 4.4.2, "Copying the files-the flexible way ").
4.4.1. Copying the files-the easy way
There is an all-in-one file hd-media/boot.img.gz which contains all the installer files (including the kernel) as well as SYSLINUX and its configuration file. you only have to extract it directly to your USB stick:
# Zcat boot.img.gz>/dev/sda

Warning
Using this method will destroy anything already on the device. Make sure that you use the correct device name for your USB stick.
After that, mount the USB memory stick (mount/dev/sda/mnt), which will now have a FAT filesystem on it, and copy a Debian netinst or businesscard ISO image to it (see Section 4.4.3, "Adding an ISO image "). unmount the stick (umount/mnt) and you are done.
4.4.2. Copying the files-the flexible way
If you like more flexibility or just want to know what's going on, you should use the following method to put the files on your stick.
4.4.2.1. USB stick partitioning on Intel x86
We will show how to setup the memory stick to use the first partition, instead of the entire device.
Note
Since most USB sticks come pre-configured with a single FAT16 partition, you probably won't have to repartition or reformat the stick. if you have to do that anyway, use cfdisk or any other partitioning tool to create a FAT16 partition, and then create the filesystem using:
# Mkdosfs/dev/sda1

Take care that you use the correct device name for your USB stick. The mkdosfs command is contained in the dosfstools Debian package.
In order to start the kernel after booting from the USB stick, we will put a boot loader on the stick. although any boot loader (e.g. LILO) shoshould work, it's convenient to use SYSLINUX, since it uses a FAT16 partition and can be reconfigured by just editing a text file. any operating system which supports the FAT file system can be used to make changes to the configuration of the boot loader.
To put SYSLINUX on the FAT16 partition on your USB stick, install the syslinux and mtools packages on your system, and do:
# Syslinux/dev/sda1

Again, take care that you use the correct device name. the partition must not be mounted when starting SYSLINUX. this procedure writes a boot sector to the partition and creates the file ldlinux. sys which contains the boot loader code.
Mount the partition (mount/dev/sda1/mnt) and copy the following files from the Debian archives to the stick:
Vmlinuz (kernel binary)
Initrd.gz (initial ramdisk image)
Syslinux. cfg (SYSLINUX configuration file)
Optional kernel modules
If you want to rename the files, please note that SYSLINUX can only process DOS (8.3) file names.
The syslinux. cfg configuration file shoshould contain the following two lines:
Default vmlinuz
Append initrdw.initrd.gz

4.4.3. Adding an ISO image
The installer will look for a Debian ISO image on the stick as its source for additional data needed for the installation. so your next step is to copy a Debian ISO image (businesscard, netinst or even a full CD image) onto your stick (be sure to select one that fits ). the file name of the image must end in. iso.
If you want to install over the network, without using an ISO image, you will of course skip the previous step. moreover you will have to use the initial ramdisk from the netboot directory instead of the one from hd-media, because hd-media/initrd.gz does not have network support.
When you are done, unmount the USB memory stick (umount/mnt) and activate its write protection switch.
4.4.4. Booting the USB stick
Warning
If your system refuses to boot from the memory stick, the stick may contain in an invalid master boot record (MBR). To fix this, use the install-mbr command from the package mbr:
# Install-mbr/dev/sda

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.