How do you install Linux on a USB flash drive?

Source: Internet
Author: User
You do not know how to install a Linux system using two USB flash drives. The first is to install the SDK on the network. The second method is to copy the CD image to the USB flash drive as the source of the software package and combine it with other images. The second method is more common... you do not know how to install a Linux system using a USB flash drive. the official website of the U disk to start and install the system provides you with two methods. The first is to install the SDK on the network. The second is to copy the CD image to the U disk as the source of the software package, and can be combined with other images. The second method is more commonly used. For the first installation method, you need to download the installation image from the netboot directory and copy the file to the U Disk according to the "flexible method" described below. The installation image of the second installation method is placed in the hd-media Directory. you can copy the image to the U disk using the "simple method" or "flexible method. In this installation method, you also need to download a CD image. The installation image and CD image should be the same debian-installer release version. If they are different, an error occurs during installation. in order to prepare the U disk, you need a running GNU/Linux system that supports USB. The current GNU/Linux system will automatically identify when you insert a U disk. If not, check whether the usb-storage kernel module has been loaded. After the U disk is inserted, it is mapped to a device named/dev/sdX, where "X" is a-z letter. You can run dmesg to confirm whether the data is correctly mapped after the U disk is inserted. To write information, enable the write protection switch on it. Xiaobian warned that using this method will destroy any existing content on the device! Make sure that you have used the correct U disk device name. If you make a mistake, such as writing a hard disk, all information on the device will be lost. Note that the U disk must have at least 256 MB capacity (smaller size installation is also possible, see section 2nd "copy files-flexible methods "). 1. copy the file-there is a collection of files easily. hd-media/boot.img.gz contains all the installer files (including the kernel), syslinux, and the corresponding configuration files. It should be noted that, although convenient, this method has a major drawback: even if the U disk is large, the logical size of the device is limited to 256 MB. If you want to use the U disk for other purposes, you need to repartition it and create a new file system for the remaining capacity. The secondary disadvantage is that you cannot copy the complete CD image to the U disk. you can only use a small businesscard or netinst CD image. To use this image, you only need to extract it directly to the U disk: # zcat boot.img.gz>/dev/sdX and then mount the U disk (mount/dev/sdX/mnt ), now there is a FAT file system on it. copy the Debian netinst or businesscard ISO image to it. Unmount the U disk (umount/mnt. 2. copy files-if you need more flexibility or want to know what happened in the process, you should use the following method to put the files on the U disk. 2.1 Partitioning the U disk. we will show you how to use the first partition of the U disk instead of the entire device. Note that most U disks are pre-configured with a separate FAT16 partition, you may not need to re-partition or format the U disk. If necessary, use cfdisk or other partitioning tools to create a FAT16 partition, and then create a file system: # mkdosfs/dev/sdX1 note, please use the correct U disk device name. The mkdosfs command is included in the dosfstools package of Debian. To start the kernel after the boot of the U disk, we need to put a boot loader on the U disk. Although any boot loader (such as lilo) should be competent, it is more convenient to use syslinux. The main reason is that it can use the FAT16 partition, and you only need to edit a text file to configure it. Any operating system that supports the FAT file system can be used to change the configuration file of the boot loader. To place syslinux on the FAT16 partition of the U disk, install the syslinux and mtools software packages in your system, and then execute: # syslinux/dev/sdX1 ghost XP system download, make sure that you are using the correct device name. When syslinux is started, the partition cannot be mounted, because this process will write data to the boot sector of the partition and create a ldlinux. sys file containing the boot loader code. 2.2 add the installer image mount partition (mount/dev/sdX1/mnt) and copy the following installer image file to the U disk: vmlinuz (kernel binary) initrd.gz (initial ramdisk image) you can choose to use the text interface or graphical installation interface installer. The latter can be obtained from the gtk subdirectory. If you need to change the file name, note that syslinux only follows the DOS (8.3) naming method. Next, you need to create a syslinux. the cfg configuration file contains at least two lines: default vmlinuz append initrdw.initrd.gz. for graphics installation programs, you need to add video = vesa: ywrap, mtrr vga = 788 to the end of the second line. If you are using a hd-media image, you should copy the Debian ISO image (businesscard, netinst, or a complete CD image) to the U disk. Then, detach the U disk (umount/mnt ). 3 boot from the U disk warning if your system rejects boot from the U disk, it may be because it contains an invalid primary boot sector record (MBR ). You can use the install-mbr command to fix this problem. The Command comes from the mbr software package: # install-mbr/dev/sdX.
Related Article

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.