Create bootable USB drive system, and DD command for Linux Ghost

Source: Internet
Author: User

1. Create a bootable USB drive system with ISO.

1.0. Format USB flash drive to FAT32 format

Commands can be used under Linux

Mkfs.vfat device path for USB flash drive

For example:

Mkfs.vfat/dev/sdb

Where the path to the USB drive can be viewed by command DF

1.1, the simplest method (but some cases will fail, and the USB stick can no longer put other files, need to format before you can use):

DD If=iso path to the device of the Of=u disk

For example:

DD If=centos-6.5-livedvd.iso OF=/DEV/SDB4

1.2, using the tool

A lot of tools can do this work, Windows UltraISO can, thank you Wang Tao, you understand.

UNetbootin is recommended here, it is a cross-platform open source gadget, the interface is very friendly, here do not repeat.

http://unetbootin.sourceforge.net/

This type of tool generally requires

1.3. Booting or installing the system via ISO

Restart the machine and choose to boot with a USB device.

If you are writing a live system (similar to WinPE), you can boot a CD/u disk system.


2. Create a disk image

Sometimes a large-scale installation of the same system (such as the installation of a Hadoop cluster), a machine installation of a machine is obviously unrealistic, can be installed in a machine configuration, and then create a mirror, on the other machine directly export the image.

You can use the third-party tool Ghost4linux, but it is very limited and sometimes ineffective, and here's how to use the Linux built-in command DD to do this task.

2.0. Start a system with a USB flash drive/disc

Theoretically you can not do this, and directly use the hard disk system to make the image, but when the image is created if the System key files are in an unstable state, the image you created may not start on other machines.

2.1, create mirror

Create a mirror and write to a file on a USB flash drive

sudo dd bs=bytes if= input disk of= output file

For example:

sudo dd bs=128k if=/dev/sda1 of=ghost.img

Where the BS parameter indicates how many bytes are to be manipulated at one time, the default is 512 bytes, and a larger one is more efficient, but it is important to note that a multiple of 512 is preferable, because the smallest unit of disk read and write is the sector, and a sector is 512 bytes. Specific parameters can be viewed using the command DD--help, the most important thing for the individual is "k=1024,kb=1000"

2.1.1, compress image

If the image is large, you can consider compression, which can be created after you use tar compression, or you can create a compression.

sudo dd bs=128k if=/dev/sda1 | gzip > ghost.img.gz

Or

sudo dd bs=128k if=/dev/sda1 | bzip2 > ghost.img.bz2

Gzip Fast, bzip2 small, see demand decision.

2.2, Restore image

Start the other machine with a USB flash drive/CD and write the image.

sudo dd bs=128k if=ghost.img of=/dev/sda1

2.2.1, recovering the compressed image

Of course, you can now unzip and then follow the above method to do, you can also unzip the write again:

GZIP-DC ghost.img.gz | DD bs=128k OF=/DEV/SDA1

Or

Bzcat ghost.img.bz2 | DD bs=128k OF=/DEV/SDA1



Originally contained in Http://blog.csdn.net/yanxiangtianji

Reprint please indicate the source



Following from: http://blog.csdn.net/shendl/article/details/7384755

Remind:
If you restore the image to another computer, you may find that your network card is eth1, not eth0. This is because
The/etc/udev/rules.d/70-persistent-net.rules file registers the network card of your mirrored computer as eth0.
If your network script handles eth0 and does not process the eth1, you may not be able to surf the web without modifying the network scripts.
You might want to delete the/etc/udev/rules.d/70-persistent-net.rules file before you make the image.   So when you restore the mirror, the name of the NIC is eth0. It won't cause you to be unable to surf the internet on your restored computer.



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.