Allows you to switch between Windows and Linux systems.

Source: Internet
Author: User
Article Title: achieve free switching between Windows and Linux systems. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.

Using the techniques described in this article, we can automatically switch from one operating system to another on a dual-boot machine without any manual intervention. You can use the script provided in this article to copy the setting for running Linux and Windows at the same time on your machine.

Since we can switch the operating system directly and manually, why do we still want to automate this operation? The simple answer is that automated processes make it much easier to use multiple operating systems. For example, if you want to test software on multiple operating system platforms, this function is particularly useful.

This article introduces these tips, assuming that you have installed the operating system and configured multiple boot with GRUB. GRUB is short for GRand uniied Bootloader. It is loaded when the machine starts, and the control of the machine is transferred to the OS Kernel software. For more information about how to deploy GRUB, see references later in this article.

The skills described in this article can be applied to: Microsoft Windows XP Professional; Microsoft Windows Server 2003; Debian Linux 3.1 (Sarge); Red Hat Enterprise Server (RHES) 3 GRUB 0.97; although GRUB of this version is successfully used, other bootloaders cannot be used.

Step 1. Set Disk Partitions

Before you start configuring the system, make sure that you have an up-to-date system backup and a CD for assistance. If a problem occurs during these steps, the machine may fail to start. If you find that your risks are unacceptable, do not proceed with the following steps.

Create a Bootcontrol Partition

Create a Small Partition on a hard disk. A file system must be created in this partition: all operating systems to be switched can load the file system and write the file. We chose FAT32. Although the entire Bootcontrol system only requires less than 1 MB of disk space, the default FAT32 limit is 256 MB, which wastes some space.

If you do not have enough unallocated space, you can narrow down or delete existing partitions to create this space. In Linux, you can use the GNU parted command to implement this function. If the order of the existing partitions changes after the parted operation is executed, you may need to update the/etc/fstab file. For more information, see the parted documentation.

When you use parted to create the required partition on the test machine, you will see the results shown in Listing 1:

List 1. Create required partitions

      
       

repton:~# cat /etc/fstab

# /etc/fstab: static file system information.

#

proc /proc proc defaults 0 0

/dev/hda2 / ext3 defaults 0 1

/dev/hda6 /home ext3 defaults 0 2

/dev/hda7 /opt ext3 defaults 0 2

/dev/hda5 none swap sw 0 0

/dev/hdc /media/cdrom0 iso9660 ro,user,noauto 0 0

/dev/fd0 /media/floppy0 auto rw,user,noauto 0 0

repton:~# umount /home

repton:~# parted

Using /dev/hda

(parted) print

Disk geometry for /dev/hda: 0.000-57231.562 megabytes

Disk label type: msDos

Minor Start End Type Filesystem Flags

1 0.031 18412.734 primary ntfs boot

2 18418.271 25085.874 primary ext3

3 25085.874 57231.562 extended

5 25085.905 26458.615 logical linux-swap

6 26458.646 49999.174 logical ext3

7 49999.206 57231.562 logical ext3

(parted) resize 6 26458 49739

(parted) mkpartfs logical fat32 49739 49999

(parted) print

Disk geometry for /dev/hda: 0.000-57231.562 megabytes

Disk label type: msDos

Minor Start End Type Filesystem Flags

1 0.031 18412.734 primary ntfs boot

2 18418.271 25085.874 primary ext3

3 25085.874 57231.562 extended

5 25085.905 26458.615 logical linux-swap

6 26458.646 49740.314 logical ext3

8 49740.346 49999.174 logical fat32

7 49999.206 57231.562 logical ext3

(parted) q

repton:~# mount /home


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.