Previously, I introduced How to Install Vista through a USB flash drive. This article will introduce how to install the UbuntuLinux system on a USB flash drive. although Ubuntu is used in this article, it is also feasible to install other LinuxliveCD releases based on this method. running Linux on a USB flash disk enriches the liveCD experience and allows you to install Vista through a USB flash disk before running Linux on any machine, this article describes how to install Ubuntu Linux on a USB flash drive. although Ubuntu is used in this article, it is feasible to install other Linux live CD distributions using this method.
Running Linux on a USB flash drive enriches the live CD experience, allowing you to run Linux on any machine, which is much easier than carrying a CD with you.
1. preparations
Before you start, you must at least make the following preparations:
* A Ubuntu live CD or. iso image file
* At least 1 gb u disk
* Running Linux OS
2. set the USB flash drive
First, insert the USB flash drive to check whether the device is recognized. To locate the device, run the following command:
$ Sudo fdisk-l
In my system, the drive letter of this device is/dev/sdb. This article uses/dev/sdb as an example to explain how to change the drive letter according to the actual situation of your system (which may be sda, sdc ...).
After the system discovers the U disk, it will create a partition.
Note: incorrect drive letters may damage your hard drive partition, so please input them with caution.
Create a partition
Detach an attached U disk:
$ Sudo umount/dev/sdb1
Then use fdisk, a partition editing tool:
Sudo fdisk/dev/sdb
After deleting the partition of the U disk, we create two new partitions: one fat file system partition with a capacity of MB, which is used to save the files in the live CD image and the other partition.
Then, the input format is "d x", and x is the drive letter of the partition. the input is as follows:
* N create a new partition
* P is set as the primary partition.
* 1 is set to the first primary partition.
* Accept the default option or input "1" to start from the first cylindrical disk
* + 750 M set the space to 750 MB
* A sets the partition as an active partition that can be started.
* 1 select this partition
* T change the partition format
* 6 set to FAT16 partition
When the first partition is set, perform the second one:
* N to create yet again a new partition
* N create a partition again
* P is set as the primary partition.
* 2 set as the second partition
* Press enter to accept the default selection
* Accept the default selection and use up all capacity
* Finally, enter w to enable the USB flash drive to complete the above changes.
Format the partition.
Format partitions
The first partition will be in the format of FAT16 file system, and the U disk is set to self-start.
$ Sudo mkfs. vfat-F 16-n liveusb/dev/sdb1
The second partition will be formatted as the ext2 file system, the block length (blocksize) is 4096 bytes, and the volume is casper-rw (otherwise the target will not be successfully completed !)
$ Sudo mkfs. ext2-B 4096-L casper-rw/dev/sdb2
Now, you need to copy the live CD image to the USB drive.
3. install Ubuntu from a USB flash drive
Mount the Ubuntu live CD image
First, you need to mount the ubuntu image. There are two ways to use a ". iso" file or a CD.
Attach from CD
If you insert a Ubuntu or other release CD into your computer, it will be automatically mounted. Otherwise, mount the disk as follows.
$ Sudo mount/media/cdrom
Mount from. iso image file
Create a temporary folder, take/tmp/ubuntu-livecd as an example, and mount it:
Insert the USB flash drive again. The two partitions are/media/liveusb and/media/casper-rw. If this problem does not occur, you need to manually mount it:
All required partitions have been mounted, and the copied file is now.
Copy the file to the USB drive.
Find the path of the CD image (which may be/tmp/ubuntu-livecd, or/media/cdrom), and then copy it to the first partition of the U disk as the root partition:
Examples, README. diskdefines, ubuntu. ico, casper/vmlinuz, casper/initrd.gz, and install/mt86plus.
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