Some gossip during Linux Startup

Source: Internet
Author: User
Some gossip during Linux Startup-general Linux technology-Linux technology and application information. The following is a detailed description. I. startup conflict
There is often only one cause of startup conflict, and MBR overwrites. For example, if you install XP first and then install Linux, Linux overwrites the data written to MBR during XP installation. If you install Ubuntu first and then install Fedora, GRUB of Fedora will be installed on MBR to overwrite GRUB of Ubuntu. These situations may cause some operating systems to fail to start.

Fortunately, Linux is still user-friendly in this regard. After it overwrites XP data in MBR, it will automatically search for Windows partitions that can be started and write XP startup information to its GRUB menu. lst, so that the original Windows startup Item (usually the last item) can be seen on the boot menu after Linux is installed ).

Sometimes, you may accidentally break Windows and need to reinstall Windows. After Windows is re-installed, Linux cannot be started because Windows updates MBR again. Conflicts between Windows and Linux over MBR have been intensifying.

So how can we prevent two systems from quarreling? Two methods.

The first is post-event repair. Use any boot disk that can be directed to grub (for example, your LiveCD) to go to grub. If you first enter a terminal, enter

Grub

You can enter the terminal and perform grub repair and installation. If you know your disk Number X (usually 0) and Linux Partition Number (Partition Number) Y (starting from 0 ), then you can run:

Root (hdX, Y)
Setup (hd0)

Hd0 in the following sentence indicates that grub is written to MBR.

You can also make a simple sentence:

Setup (hd0) (hdX, Y)

If the call succeeds, successful is returned.

If you do not know or forget the Linux partition number (you should know the disk number, enter 0 if you are not sure ),

Root (hdX,

Press the TAB key and the auto-completion information will appear. Now you should know the serial number of the Linux partition.

After the input is complete, perform setup again. In this way, GRUB will be restored after restart.

The second method is to save the information written on Linux in MBR before reinstalling XP and save it as a file. Generally, the file size must be 512 bytes. Run the following command:

Sudo dd if =/dev/sda f = ~ /Linux bs = 512 count = 1

(Sda for SCSI hard disks and hda for IDE hard disks. Of = The following path is the output path, and the path and file name can be arbitrary .)

You can save the first 512 bytes of information in MBR to a file named linux in the user folder.

Then reinstall XP and place the linux file in the Winodws partition. To facilitate management, we are used to placing it in the C root directory.

Next, modify the boot. ini of XP and add the following statement in the last line:

C: \ linux = "Ubuntu Linux Operation System"

And modify the duration of the boot menu.

After the restart, try to enter the DOS rewrite partition table:

Fdisk/mbr

After restarting, you can see that the XP startup manager has a dual boot menu, and selecting "Ubuntu Linux Operation System" is the same as before when you entered MBR. The principle of this method is also very clear, the MBR header 512 bytes (including the first 512 bytes of the startup information) is saved as a file, let the Windows system call this file and process the startup.

After Windows is reinstalled, you only need to transfer the 512-Byte "linux" file to another place. After installation, you can move it back and modify the boot. ini file.

Coordination is also required between different Linux releases to achieve peaceful coexistence. If Ubuntu is installed and a Fedora is to be installed, it is installed in independent partitions on the hard disk. After the result is installed, Ubuntu cannot enter. The thought must be that Fedora overwrites its startup information to MBR and overwrites Ubuntu information.

Therefore, I want to modify menu. lst, because menu. lst can display the processing Start menu. After mounting the Ubuntu partition, find menu. lst in Ubuntu, copy the startup statement related to it to menu. lst in Fedora, and restart the computer.

Ii. About menu. lst

Menu. lst is used to manage menu items. Including whether to hide the Start Menu, Start Menu countdown, start item display, and other options. General operations, as the name suggests, can understand what they mean.

It is worth mentioning that Linux is started through the guidance of these two files: kernel vmlinuz-XXXXX and initrd. img. In other words, if you need to boot an operating system, inform the partition where the two files are located in the grub menu, and add the paths of the two files to start.

For example:

Title Ubuntu
Root (hd0, 0)
Kernerl/boor/vmlinuz-2.6.22-14-generic root = UUID = XXXXXX ro quiet splash locale = zh_CN
Initrd/boot/initrd. img-2.6.22-14-generic

Iii. Mount during startup

It is too troublesome to manually mount a partition, so I want to use fstab for automatic mounting.

Each non-Comment row of fstab hangs a partition to the corresponding path, and its parameters are respectively: the Mounting Mode of the mounted device mount point file format (I do not know much about this large segment)

In "mounted devices", I tried the format/dev/sda1 and found it difficult to use it. Then, look at the UUID, manually mount the required disk, and type

Ls-l/dev/disks/by-uuid

Display the uuid of each partition, a mess of numbers, written in fstab:

UUID = xxxxxxxxxxxxxx/media/sda8 vfat user, noauto, utf8, umask = 000, gid = 46 0 0

Done.
Related Article

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.