Linux to create a bootable USB disk system and use the DD command for Linux Ghost

Source: Internet
Author: User
Tags bz2 linux

1, through the ISO to create a bootable U disk system.

1.0, format the U disk for FAT32 format

Linux can use the command

Mkfs.vfat u disk's device path

For example:

Mkfs.vfat/dev/sdb

where the U disk path can be viewed by command DF

1.1, the simplest method (but some cases will fail, and the U disk can not put other files, need to be formatted before use):

DD If=iso path of=u disk's device path

For example:

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

1.2, using tools

Many tools can do this job, Windows UltraISO can, thank you, Wang Tao, you understand.

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

http://unetbootin.sourceforge.net/

This type of tool generally requires

1.3, through the ISO to guide or install the system

Reboot the machine and choose to boot using a USB device.

If you write to a live system (like WinPE), you can boot a CD/u disk system.

2, create a disk image

Sometimes it is necessary to install the same system on a large scale (such as installing the Hadoop Machine Fleet), one machine installation configuration is obviously not realistic, can be installed on a machine well configured, and then create a mirror, on other machines directly export the mirror on it.

You can use a Third-party tool ghost4linux, but it's very restrictive and sometimes ineffective, and here's how to use the Linux built-in command DD to accomplish this task.

2.0, use U disk/CD to start a system

Back to the column page: http://www.bianceng.cnhttp://www.bianceng.cn/OS/Linux/

In theory you can not do this, but directly using the hard disk system to make a mirror, but when the image is created when the System key files in an unstable state, you create a mirror on the other machine may not start.

2.1, create mirror

Create a mirror and write to a file on a USB disk

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 represents the number of bytes at a time, the default is 512 bytes, the appropriate larger can improve efficiency, but need to pay attention to the best is a multiple of 512, because the disk read and write the smallest unit is a sector, and a sector is 512 bytes. Specific parameters can be viewed using the command DD--help, and the most important thing for individuals is "k=1024,kb=1000."

2.1.1, compressed mirrors

If the mirror is large, you can consider compression, you can create it after using tar compression, or you can create a time 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 mirroring

Start the other machine with a U disk/CD, and write The mirror.

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

2.2.1, restoring compressed mirrors

Of course, you can extract and then follow the above method to do, you can also extract 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

The following comes 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 NIC of the computer you are mirroring as eth0.

If your web script handles eth0 and does not deal with eth1, you may not be able to surf the Internet without modifying the Web script.

You may want to delete the/etc/udev/rules.d/70-persistent-net.rules file before mirroring.   So when you restore the mirror, the name of the NIC is eth0. It will not cause you to be unable to access the Internet after the 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.