In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces "how to make bootable img/iso files under linux". In daily operation, I believe many people have doubts about how to make bootable img/iso files under linux. Xiaobian consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer the doubts of "how to make bootable img/iso files under linux". Next, please follow the editor to study!
There are three ways to make an image file, cp, cat, dd and other special tools. Cp, cat, and dd can all copy files from the device to create an image. The dd command is more powerful, and you can create a mirror directly by specifying the block size and the number of blocks.
IMG file:
Because cp, cat can only make images from devices, but there is no special tool to do IMG files, so here use the dd command to make IMG files.
1, production
Dd if=/dev/zero of=fdimage.img count=2880
Or
Dd if=/dev/zero of=fdimage.img bs=1024 count=1440
2, formatting
Mkfs.msdos fdimage.img
3, modify
After using the following command mount, you can modify it directly
Mount-o loop * .img / mnt
4, startable
Because a virtual machine must be used to make a bootable image, it is recommended to use Virtualbox, and first go to the next DOS boot disk on the Internet to boot. Use DOS's sys command to transfer the system. FreeDOS is recommended as free software. You can also use the dd command to pass the boot information and copy the files needed for startup to make the boot disk. Take FreeDOS as an example, the following command is used to transmit startup information, where the downloaded boot disk is a balder10.img file
Dd if=balder10.img of=fdimage.img bs=512 count=1 conv=notrunc
Grub4dos for multi-system
1), booting multiple systems with grub.exe
2) install grub to MBR and boot multiple systems with grldr. Of course, you can also write boot information directly with dd in the same way as above.
Bootlace.com-floppy-chs 0x00
Note: I found that using the dd command can only start copy from the logical sector. I wondered if I could use dd to write grldr.mbr to U disk. I tried it with my own U disk, but I couldn't open it. Because my U disk is in fat16 format, the logical sector starts with OBR, and then the FAT table. As a result, I covered the FAT1 table. I didn't think of FAT2 at that time. I'm depressed when I think of it now. A lot of things are gone.
Why is a floppy disk OK? because it doesn't have the 63 sectors in front of it, it starts directly from the logical sector 0.
ISO file:
Because of the file system, you can't use dd to do ISO images directly (of course, it can still make ISO images from devices). There are special tools for making ISO files.
1, production
Mkisofs-r-o cdimage.iso / home/XXX/cddir
2, formatting
Iso existing file system iso9660 made with mkiso
3, startable
Whether you boot a single system or boot multiple systems, you still use mkisofs as a tool, except that the boot loader loaded into the CD is different. Of course, you can also put the DOS bootstrap (that is, its boot sector) or the windows bootstrap (ntldr in the XP system) to boot the CD. The use of grub4dos is only discussed below.
1), booting multiple systems with grub.exe
Using DOS to load grub.exe to boot multiple systems
2), install grub to CD MBR
During production, you can use the following command to generate a bootable image directly, in which grldr and menu.lst should be placed in the cddir directory, that is, in the cd root directory.
Mkisofs-R-b grldr-no-emul-boot-boot-load-seg 0x1000-o cdimage.iso cddir
Mkisofs-R-b grldr-no-emul-boot-boot-load-size 4-o cdimage.iso cddir
PS, the following is the description of the dd command and mkisofs parameters
Dd (convert and copy files)
Dd is a very useful command under Linux/UNIX, which is used to copy a file with a block of the specified size and perform the specified conversion at the same time.
The main options for dd:
If the place of the specified number ends with the following characters multiplied by the corresponding number:
Baked 512, cased 1, kappa 1024, walled 2, xm=number m
If=file
Enter the file name, which defaults to standard input.
Of=file
Output file name, which defaults to standard output.
Ibs=bytes
Read bytes bytes at a time (that is, a block size is bytes bytes).
Obs=bytes
Write bytes bytes at a time (that is, a block size is bytes bytes).
Bs=bytes
At the same time, the size of the read and write block is set to bytes, which can replace ibs and obs.
Cbs=bytes
Convert bytes bytes at a time, that is, convert the buffer size.
Skip=blocks
Skip blocks blocks from the beginning of the input file before you start copying.
Seek=blocks
Skip blocks blocks from the beginning of the output file before you start copying. (usually valid only if the output file is a disk or tape)
Count=blocks
Only blocks blocks are copied, and the block size is equal to the number of bytes specified by ibs.
Conv=conversion [, conversion...]
Converts the file with the specified parameters.
Conversion parameters:
Ascii converts EBCDIC to ASCII.
Ebcdic converts ASCII to EBCDIC.
Ibm converts ASCII to alternate EBCDIC.
Block converts each line to a record of length cbs, with gaps filled in.
Unblock
Make the length of each line cbs, and fill the insufficient parts with blanks.
Lcase converts uppercase characters to lowercase characters.
Ucase converts lowercase characters to uppercase characters.
Swab swaps each pair of bytes entered. Unlike the
Unix dd, this works when an odd number of
Bytes are read. If the input file contains
An odd number of bytes, the last byte is
Simply copied (since there is nothing to
Swap it with).
Noerror
Don't stop when something goes wrong.
Notrunc
The output file is not truncated.
Sync fills each input block into ibs bytes, and the deficiency is filled with NUL characters.
Because the dd command allows binary reading and writing, it is particularly suitable for input / output on raw physical devices. For example, you can use the following command to create an image file for a floppy disk:
Dd if=/dev/fd0 of=disk.img bs=1440k
Interestingly, this image file can be read by HD-Copy, Winimage and other tools. Another example is to save the first 512 bytes of the first hard disk as a file:
Dd if=/dev/hda of=disk.mbr bs=512 count=1
Mkisofs (make iso file system)
Function description: create ISO 9660 image file.
Grammar: mkisofs [- adDfhJlLNrRTvz] [- print-size] [- quiet] [- A] [- abstract] [- b] [- biblio] [- c] [- C] [- copyright] [- hide] [- hide-joliet] [- hide-joliet] [- m] [- M] [- o] [- p] [- P] [- sysid] [- V] [- volset] [- volset-size] [- volset-seqno] [- x] [directory or file]
Additional note: mkisofs can make the specified directory and file into an image file in ISO 9660 format for burning CD.
Parameters:
-an or-- all mkisofs usually does not handle backup files. Use this parameter to add the backup file to the image file.
-An or-appid specifies the application ID of the CD.
-abstract specifies the file name of the summary file.
-b or-eltorito-boot specifies the boot image file required when making a bootable CD.
-biblio specifies the file name of the ISBN file. The ISBN file is located in the root directory of the CD and records the ISBN of the CD.
-c when making a bootable CD, mkisofs will make all the contents of the full-eltorito-catalog in the boot image file into one file.
-C must use this parameter when synthesizing many sections into one image file.
-copyright specifies the file name of the copyright information file.
-d or-omit-period the full stop after the file is omitted.
-D or-disable-deep-relocation ISO 9660 can only handle directories with up to 8 layers, and RRIP will automatically set them to an ISO 9660 compatible format for those more than 8 layers. Use the-D parameter to turn off this feature.
-f or-follow-links ignore symbolic links.
-h displays help.
-hide hides the specified directory or file from the system of ISO 9660 or Rock RidgeExtensions.
-hide-joliet hides the specified directory or file in the Joliet system.
-J or-joliet uses directory and file names in Joliet format.
-l or-full-iso9660-filenames uses the file name of ISO 9660 32 characters.
-L or-allow-leading-dots allows the first character of the file name to be a period.
-if there is an error message during the execution of log-file, the preset will be displayed on the screen.
The directory or file name specified by-m or-exclude will not be entered into the image file.
-M or-prev-session is merged with the specified image file.
-N or-omit-version-number omits the version information in the ISO 9660 file.
-o or-output specifies the name of the image file.
The data processor of the-p or-preparer recording disc.
-print-size displays the estimated file system size.
-quiet executes without displaying any information.
-r or-rational-rock uses Rock Ridge Extensions and opens read permissions for all files.
-R or-rock uses Rock Ridge Extensions.
-sysid specifies the system ID of the CD.
-T or-translation-table establishes a conversion table of file names for systems that do not support Rock Ridge Extensions.
-v or-verbose displays detailed information when it is executed.
-V
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.