📜 ⬆️ ⬇️

Loading CentOS 6 from a flash drive: straight arms

Every time you read the recommendations for creating boot flash drives (in particular for Linux live USB flash), the author suggests formatting the removable device cleanly, and in the presence of perverted fantasy - formatting under ext2 / 3/4, and for especially perverted - it creates 2 sections , or even climbs into the flash controller controller firmware in order to create cdrom emulation there. Or the recommendation uses software that does the same thing - but automatically.

Excuse me, but I already have a bootable, combat flash drive, which is loaded with Grub4dos and a pair of direct hands, an entire arsenal of software - from windows XP PE to the VMWare ESXi hypervisor installation ... So, I wanted to port the Live CD to the Live Cent for it too 6

What I need:
1) in fact, a flash drive with FS FAT16 / 32 with the grub4dos bootloader installed and working (if you wish, you can install it without formatting anything), at least 1 GB in size
2) downloaded iso from CentOS 6 Live

The challenge we set ourselves is to get a grub4dos-compatible download method, while maintaining the download options menu, available on the original Live CD.
')
So let's go.

1. Create a CentOS folder in the root of the flash drive. We copy there from ISO folders of LiveOS and isolinux (in the latter only initrd0.img, memtest, vmlinuz0 are needed)

2. We check that the flash drive has a label as a disk, if we don’t have one yet, we’ll call it a label for example ZVER.

3. Pull isolinux.cfg out of isolinux one level up in CentOS. Rename it to centos.lst. Now you need to convert it from the isolinux format to the grub4dos format. We begin to rule it.
From the beginning to the label linux0 everything is deleted. All lines that begin with a label are commented with the # sign. The phrase Menu label - turn into title . Now the most difficult is the kernel and initrd parameters for grub4dos. See for yourself and “find 10 differences”:

It was:
label linux0
menu label Boot
kernel vmlinuz0
append initrd=initrd0.img root=live:CDLABEL=CentOS-6.2-i386-LiveCD rootfstype=auto ro liveimg quiet nodiskmount nolvmmount rhgb vga=791 rd.luks=0 rd.md=0 rd.dm=0

It became:
#label linux0
title Boot
kernel /CentOS/isolinux/vmlinuz0 root=live:LABEL=ZVER live_dir=/CentOS/LiveOS rootfstype=auto ro liveimg quiet nodiskmount nolvmmount rhgb vga=791 rd.luks=0 rd.md=0 rd.dm=0
initrd /CentOS/isolinux/initrd0.img

and at the end of the file should be like this:
#label memtest
title Memory Test
kernel /CentOS/isolinux/memtest

This is what should be contained in the centos.lst file.
 timeout 100 #label linux0 title Boot kernel /CentOS/isolinux/vmlinuz0 root=live:LABEL=NARYA live_dir=/CentOS/LiveOS rootfstype=auto ro liveimg quiet nodiskmount nolvmmount rhgb vga=791 rd.luks=0 rd.md=0 rd.dm=0 initrd /CentOS/isolinux/initrd0.img #title default #label linuxtext0 title Boot (Text Mode) kernel /CentOS/isolinux/vmlinuz0 root=live:LABEL=NARYA live_dir=/CentOS/LiveOS rootfstype=auto ro liveimg 3 quiet nodiskmount nolvmmount rhgb vga=791 rd.luks=0 rd.md=0 rd.dm=0 initrd /CentOS/isolinux/initrd0.img #label linux0 title Boot (Basic Video) kernel /CentOS/isolinux/vmlinuz0 root=live:LABEL=NARYA live_dir=/CentOS/LiveOS rootfstype=auto ro liveimg quiet nodiskmount nolvmmount rhgb vga=791 rd.luks=0 rd.md=0 rd.dm=0 xdriver=vesa nomodeset initrd=/CentOS/isolinux/initrd0.img #label install0 title Install kernel /CentOS/isolinux/vmlinuz0 root=live:LABEL=NARYA live_dir=/CentOS/LiveOS rootfstype=auto ro liveimg liveinst noswap nolvmmount rd.luks=0 rd.md=0 rd.dm=0 initrd=/CentOS/isolinux/initrd0.img #label textinstall0 title Install (Text Mode) kernel /CentOS/isolinux/vmlinuz0 root=live:LABEL=NARYA live_dir=/CentOS/LiveOS rootfstype=auto ro liveimg textinst noswap nolvmmount rd.luks=0 rd.md=0 rd.dm=0 initrd /CentOS/isolinux/initrd0.img #label memtest title Memory Test kernel /CentOS/isolinux/memtest title Back to main menu configfile /menu.lst 


4. In the root menu.lst add 2 lines:
title CentOS 6 LIVE
configfile /CentOS/centos.lst

Everything, you can try out our flash drive for downloadability! But before rebooting, I advise you to look in the direction of solutions based on the QEMU emulator, for example, this is a great time saver when debugging.

Loaded from a CentOS Live flash drive, it is beautifully installed on a hard disk in a regular way. Thus, we have 2 in 1 - also the installation distribution.

Source: https://habr.com/ru/post/148201/


All Articles