Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2235896
  • 博文数量: 292
  • 博客积分: 10016
  • 博客等级: 中将
  • 技术积分: 3381
  • 用 户 组: 普通用户
  • 注册时间: 2005-11-06 11:26
文章分类

全部博文(292)

文章存档

2011年(1)

2010年(4)

2009年(3)

2008年(6)

2007年(47)

2006年(63)

2005年(168)

分类:

2007-03-19 16:18:38

1、何谓虚拟系统

  "虚拟系统"的意思是"假的系统",亦即当一个使用者使用的是"虚拟系统"时,他所看到的系统档案及程式,并不是者所使用的档案。

  例如管理者键入"ls -al /usr/bin/ls"的命令时,看到的档案大小为32767 bytes,而其他使用者键入"ls -al /usr/bin/ls"的命令时,看到的却为65535 bytes,表示为两个档案的路径虽然相同,但却为不同的档案。

2、虚拟系统的功能为何

  (1) 避免其它使用者使用重要资料

  若您不愿意让使用者观看或执行某些档案,那你可以使用虚拟系统,让使用者看不到特定的档案,或是创造另一个与真正档案内容不同的档案。

  (2) 增加系统安全性

  若您必须开放使用者登入机器,又害怕使用者利用系统内部的漏洞取得额外的权限,破坏系统设定与窃取资料,使用虚拟系统将可以保护系统的资料与系统运作,让恶意的使用者只能做到有限的破坏。

3、如何以架设虚拟系统

  其实所谓的"虚拟系统",主要是利用chroot(Change Root)来达成,亦即改变根目录的位置,而使得系统对应到一新的系统设定中。

  要达到这个目的,大致上可分为两种方法,一是修改程式码,另外一个则是用系统本身的命令来达成。

  在此我们并不打算详细说明有关修改程式码的部份如何做,简单的说,程式部份主要是利用chroot()这个C函式来改变根目录的位置,较为麻烦的地方在於你可能要修改inetd程式或其它网路服务程式,当然你也可以自己写这些程式,不过不是每个管理者都对攒写程式有兴趣的。


  机器:IBM ThinkPad T30, 40GHD 512MRam
分区:1)primary 8G,xp 2)20G,data 3)Solaris
用PQ给Solaris分区,或等到安装过程中用Solaris的fdiskf分区。
重要的一点: 在Solaris分区前、后(如果后面还有的分区)留上一点间隔(由于solaris的fdisk分区后容易出问题)。
顺序:先xp,后solaris
安装完后,由solaris的bootloader启动。当然你也可以让xp的分区active,由NT loader启动。

下面是一个参考文章:
*************************************************************************************************
Quick summary of steps:

1. Install Windows.

2. Install in an extended partition.

3. Install Solaris.

4. Fix LILO.

I'll go through the formula below and explain at the end why some of the steps are done this way. The crux of the problem is that Solaris really slices up a hard drive during installation, leaving it in a state that Linux can't handle. Using this formula, I've set up triple-boot machines in less than six hours.

Disk Partitioning 101

There are some basic things to know about how a hard drive can be partitioned, which means dividing it into different areas. Always back up your data before doing any partitioning. Each has a tool to partition a hard drive. Windows, Linux, and Solaris all have a tool called fdisk, although they have different capabilities and interfaces. Use the fdisk tool from the particular OS you're installing. Windows can have a primary partition and an extended partition. The extended partition can be sliced up further into smaller logical partitions. The primary partition on the first hard drive will become c:, and the other partitions will pick up drive letters according to Windows rules.

Many versions of Linux, except for the newest ones, and Solaris must have a boot partition that is below the 1023th cylinder on the hard drive. The fdisk from Linux can set up four primary partitions or three primary and one extended. Like Windows, the extended partition can be further divided. The master IDE drive on the first channel is hda. Solaris requires a primary partition during installation that it will divide into two primaries. The first partition can be divided up into slices 0 through 7, with 2 being the overlap slice that shouldn't be modified by the user. Both Linux and Solaris have very powerful fdisk tools and can specify what type each partition will be. They can even say that a partition will be for Windows.

Formula

Step 1: Installing Windows

Do a regular installation according to the manual. Consider the 1023 cylinder limitations for the boot manager when you are partitioning the hard drive so don't make it too big. Since the hard drive has no partitions on it, the first time you boot it up, you will run fdisk, specify a partition, and exit fdisk. You will have to reboot, then format your partition by typing format c:, and then run the Windows setup program. Windows will be on partition 1.

Step 2: Installing Linux

Further partition the hard drive. Set up the extended partition on partition 4, dividing it as you desire for the Linux installation. You need at least two logical partitions, one for / and a swap partition. Many people set up several more, /home being the most common. Do the install. Make a floppy boot disk (this is critical). You will use the boot floppy in a later step to reestablish LILO. My habit is to install Linux at the high end of the hard drive so that after the installations are complete, the partitions are in numerical order according to the cylinders. A better reason for doing this is so you can modify Linux to live above cylinder 1023. Solaris can't do that, so I put it lower on the hard drive. For this article, I assume you're using two partititions: / in 5, swap in 6.

Step 2a: Modifying Linux

Some files on Linux need to be modified before we can move onto the Solaris install. First, modify /etc/lilo.conf as root. Change the line with /dev/hda5 in it for booting Linux to /dev/hda9. See Listing 1 for a sample /etc/lilo.conf file. Next, modify /etc/fstab. The line for hda5 needs to become hda9 and the swap line from hda6 to hda10. Listing 2 shows a modified /etc/fstab file. These changes are because of the way Solaris will install. Finally, trust me on this next part. Run fdisk /dev/hda and delete the extended partition, which will also delete your / and swap partitions. This is because of the way Solaris will install. We will re-establish these partitions later, so you won't lose any data. Make sure that you record the exact start and stop cylinders of the / and swap partitions. If done correctly, the only partition visible on the hard drive right now is Windows in partition 1.

Step 3: Installing Solaris 8

Put in the Solaris installation media and boot. The Solaris installation sequence should come right up. Run fdisk to establish partition 2 for Solaris. A catch in this step is the boundary cylinders on the hard drive. Give yourself a couple of cylinders buffer between the end of the your Windows partition and where you start the Solaris partition. Also allow some buffer between the end of your Solaris partition and the start of your Linux partition. I use a rule of thumb of two cylinders on each side. If you don't add this buffer, your installation will fail. Install what you want on partition 2. Note that Solaris will divide partition 2 into partitions 2 and 3 during the install. Late in the install process, you will have a chance to look at the filesystem layout. Partition 2 will be sliced up into / in s0, swap in s1, overlap will be in s2, and /export/home in s7. These four slices are the reason that in Step 2a we added four to several lines. After the Solaris install, Linux will see hda5 as hda9. If you use more than four slices in Solaris, you will have to modify Step 2a as appropriate. Reboot. Study Listing 3 to see what the partition table looks like after the Solaris installation, especially the cylinder buffers around the Solaris partitions.

Step 4: Boot Manager

Now you have three operating systems on your computer, but you can only Windows and Solaris. We'll fix this by configuring LILO to give you all three. First, start a Linux install again and bring it to the point of partitioning the hard drive. Use fdisk and re-establish the partitions you previously deleted. Make sure you put the exact cylinder numbers in. You will probably have an option to use disk druid but use fdisk. Disk druid is a friendly disk partitioner, but it doesn't give you the cylinder control you need right now. You will see several messages about partitions having different logical and physical beginnings. This doesn't matter to us. Save the updated disk partitions and reboot using the boot floppy you made. Type linux root=/dev/hda9 at the LILO: prompt and log in. Edit /etc/lilo.conf, adding the lines other=/dev/hda3 and label=solaris to the end of it. Then run LILO using a special option: lilo -P ignore. The -P ignore option tells LILO to ignore any partition tables that it considers corrupt, which we have because of Solaris.

Using Your Triple-Boot Machine

Now you have a machine that can run Windows, Linux, and Solaris. When you turn it on, you will see the normal BIOS prompts and finally get a prompt LILO:. If you hit the tab key quickly, you will see the different operating systems available. Type in which one you want, and hit enter. The machine will then boot as if that OS is the only one on the machine. You will have to reboot to get to a different one. Still, this approach gives you three machines in the space of one, and it is free. You have only used tools that were part of the various operating systems.

Many of the steps may look like the ravings of a madman, but once you understand the impact of the various operating systems, especially Solaris, they make more sense. It's easy to set up a system to dual boot. Windows and Linux or Windows and Solaris set up easily, provided the hardware is supported. The hard part is when you want to combine Linux and Solaris 8. As a historical note, I've been setting up machines to triple boot for years. With Solaris 7, it was easier in some regards. Linux didn't give the error messages that you see working with Solaris 8, and it stayed in one primary partition. The biggest catch was that a native Solaris partition looks like a swap partition to Linux. This normally isn't a problem, but with Red Hat 6.2 and some other distributions, you have no control over which swap space is used.

The Linux install will reformat any swap partition it finds. This means that your Solaris distribution is gone and is being used as a Linux swap space, so I hope you have a backup. With Solaris 2.7, I would install Windows, then Solaris, and then Linux. During the Linux install, I would change the partition type of Solaris to something like FAT32 and complete the install. That way, the Linux installation would leave that fake Windows partition containing Solaris alone. After I finished and rebooted, I would change it back and set up LILO to boot the three systems. Solaris 8 invalidates this trick. If you change anything about the Solaris partitions using fdisk, you mess up Solaris' boot signature and it won't come up. As a sidenote, this last statement might not be totally true. I've used Linux's fdisk to manage the partitions. Some versions of Linux also have cfdisk and sfdisk. These are more powerful and also harder to use partitioning tools. These tools might be able to reslice the partition so that Solaris still works. Since they aren't universal, I didn't explore using them. Also, Linux can't install on a disk with the type of cylinder boundary problems that Solaris 8 creates. In other words, Solaris can't be installed before Linux.

Another new catch with Solaris 8 is that it requires two partitions on the hard drive. Remember that in this setup, partition 1 is Windows, and I specified that 4 be set up as an extended partition for Linux. There can only be four partitions, so this scheme leaves 2 and 3 for Solaris. Set it up for 2, and during the install it will add 3. Summarizing, partition 1 is Windows, 2 and 3 are Solaris, and partition 4 is extended and subdivided into logical partitions for Linux. All of these are below cylinder 1023 unless your Linux distribution can overcome this problem. Finally, remember the way that Solaris subdivides partition 2 internally. This means that some boot files need to be modified by the number of slices you set up during the Solaris installation. But, when you're using fdisk, you see those Solaris slices as one partition. It's a little confusing, but you can keep track of it by remembering the way the boot process works.

Alternatives

I've also done this basic procedure on a system with two hard drives, and it's considerably simpler. I put Linux on the second hard drive by itself and tweaked the procedure. First, put Windows in partition 1 on the first drive and Solaris in partition 2, which will become 2 and 3. Then, put Linux on hdb. Since you're not going to install Linux on hda, you don't have to worry about the problematic partition table.

Conclusion

The procedure I've described will result in a machine that can boot into three different operating systems. This can save you considerable desk space in the or a lot of weight if you're on the road. The procedure is fairly complicated but doesn't cost anything. Be careful, because messing up a step can mean that you have to back up several steps or start from the beginning to recover. Always back up your data before trying anything like this.

***********************************************************************************
 

阅读(3879) | 评论(1) | 转发(0) |
给主人留下些什么吧!~~