A linux partition supports both dual-boot and vmwarevm.
Source: Internet
Author: User
A linux partition supports both dual-boot and vmwarevm.I originally installed Windows XP and Linux dual-boot on my hard disk. I divided two hard disks into Linux, one for root and the other for swap. In this way, you can choose to enter windows or Linux when the machine is started. Later, I installed the vmwarevirtual Machine Software in windows and wanted to install a set of Linux in VMware. In general, this requires a disk space (about 5 Gb) in windows. However, I am very stingy with the disk space. Therefore, I hope that Linux in VMware can directly use existing Linux partitions without allocating space. In this way, in the same LINUX partition, you can choose to directly enter Linux when the machine starts, or run VMware in windows and then start to enter, saving a lot of disk space. In addition, the current Linux version needs to be updated frequently from the Internet. If it is divided into two different partitions, it needs to be updated twice, which is very inconvenient. To use the same LINUX partition, you only need to update it once. This installation method, although there are two different ways to use, is actually using the same set of Linux. Next, I will introduce the installation method. I am only a beginner player in VMware. I have been using it for less than half a month. If anything is wrong, please advise me.
Step 1:Install linux on an independent PartitionTaking my machine as an example, I installed Fedora Core 5, which is divided into two Linux partitions. One ext3 partition is used for root and one swap partition. During installation, note that when you choose to install the startup tool grub, do not install grub in MBR, but in the ext3 partition. Others are free. After the installation is complete, you can only enter windows at the time of restart, and you cannot choose Linux, because the Startup Program on MBR is still windows. My solution is: Use the Linux installation disk to start it again, enter the rescue mode, and press the prompt to enter Linux, then mount the ext3 partition, And then mount a Windows FAT32 partition (by default, linux cannot access NTFS partitions, so a FAT32 partition is required for data exchange ). Then, use dd to copy the 0 sector of the ext3 partition to a file in the FAT32 partition. If the ext3 partition is hda3 and the FAT32 partition is mounted to/mnt/share, the command is: dd If =/dev/hda3 of =/mnt/share/bootfc5.img BS = 512 COUNT = 1 after the Startup File is ready, restart the machine to Windows, copy the prepared bootfc5.img file to the system disk C :/. Then, use the editor to modify the boot under the system disk C. INI file, add a line at the end of the file: C:/bootfc5.img = "Fedora Core 5" so that you can choose to enter windows or fc5 after the machine starts. This method works for Windows 2000/XP, but not for Windows 98/ME.
Step 2: install Linux in VMwareI will not repeat the process of installing VMware in windows, nothing special. Now that VMWare has been installed, it is necessary to install Linux in VMware. The installation process is not special either. I will post the main points of attention. The default configuration is available and does not need to be modified. Then configure the new virtual machine. The most important thing is to add a software drive and set the bootfc5.img file prepared in the previous step as a floppy disk image file for startup. In fact, it is also very simple. Let's look at it: Now, this new virtual machine can be started and directly use the original ext3 partition and swap partition, it occupies almost no space in Windows partitions (if you look for it under the my virtual machines directory, it only occupies more than 100 K, but if you have started this virtual machine, the occupied space will increase by several hundred MB, which is as large as the memory allocated to it ).
Step 3: Solve the problem after startupNow, although the Linux virtual machine can be started, there is still a problem: it cannot enter XWindow and can only be operated on the Character interface, in the past, bare metal Direct start was used to access XWindow. The reason is: LINUX started with bare metal directly shows a real display card, so the XWindow configuration is also configured according to the real display card. LINUX started in VMware, what we can see is the virtual display card (known as the VMware display card) from VMWare, so the XWindow cannot be driven at startup. This is simple. You can configure XWindow again. Then there is the installation of VMware Tools, this is a bit of trouble, but there are a lot of articles to check online, I do not much to say (in the virtual machine home www.xuniji.com forum, I have a post (http://www.xuniji.com/forum_view.asp? Forum_id = 1 & view_id = 3025) describes in detail the troubles and solutions I encountered when installing VMware Tools. For more information, see ). Another step is to set up shared folders to facilitate file exchange with windows. Now, you can run fc5 smoothly under VMware. However, if you restart the host (note that it is not to restart the virtual machine, but to restart the host) and want to use a bare metal to directly start the host in Linux, sorry, you will find that you cannot enter XWindow again. The reason is the same as above. The current XWindow configuration is based on the VMware display card and cannot be used under the real display card. Of course, you can reconfigure XWindow again. However, it is too troublesome to reconfigure XWindow every time after switching the startup mode. To solve this problem, it took me a little time to make the two startup Methods smoothly enter XWindow. To put it simply, it is to prepare two configuration files for XWindow, and then execute a script at startup to determine whether the file is started on a bare metal or in a virtual machine, specify the corresponding configuration file for XWindow based on the judgment result. We know that the XWindow configuration file is in the/etc/X11 directory and the file name is Xorg. conf. We set the Xorg. conf copy Xorg. conf. VMWare, and then Xorg. conf copy Xorg. conf. raw, so that two configuration files are ready. Next, we are going to write the script. The most difficult thing is how to determine whether the current environment is bare metal or virtual machine? There may be many methods. I think of/dev/fd0. In bare metal environments, data cannot be read from/dev/fd0. in Virtual Machine environments, grub startup files can be read from/dev/fd0. The specific program can be written in C or shell, so I will not be ugly. The final script is roughly as follows :#! /Bin/bashdeclare xorgconf_dir =/etc/x11cp-F $ xorgconf_dir/Xorg. conf. raw $ xorgconf_dir/Xorg. confif [/dev/fd0 can read grub]; then CP-F $ xorgconf_dir/Xorg. conf. VMware $ xorgconf_dir/Xorg. at last, put the script in/etc/rc. d/RC/rc5.d. You can install and set up in the preceding three steps to obtain a LINUX partition that can be started from both bare metal and virtual machine. VMware is still a new thing for me. I am just a newbie to VMware. Please advise me if I have any mistakes.
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.