Chinaunix首页 | 论坛 | 博客
  • 博客访问: 917193
  • 博文数量: 194
  • 博客积分: 7991
  • 博客等级: 少将
  • 技术积分: 2067
  • 用 户 组: 普通用户
  • 注册时间: 2007-12-09 22:03
文章分类

全部博文(194)

文章存档

2010年(8)

2009年(71)

2008年(109)

2007年(6)

我的朋友

分类: LINUX

2009-10-09 15:39:52

Installing Fedora 11 and Fedora 12 in the same patition
Chinese title: 将Fedora 11和Fedora 12安装在同一个分区上

By beta-song, 2009-10-09

Sometimes you want to experience more than one linux distributions, and want to switch among them freely by grub, but it turns out that the the number of distributions you can install is limited by the number of partitions. The occasion is often that you have to spilt one partition into two if you don't have unpartitioned spare disk space.

Here in this article I will give you some hints on how to install two+ linux distributions in exactly one partition. It's simple, just move the whole operating system into separate directories!

I do not issue any guarantee that this will work for you! Please do backup your data before any procedure taken into practice! Do this at your own risk!

Let's take Fedora 11 and Fedora 12 as the example. Asume that we already got Fedora 11 installed in partition /dev/sda1, and now you want to install Fedora 12 into that partition too.

The following steps should be performed:

1. Get a usable linux shell:
Boot your computer into recuse mode using Fedora 12 DVD, in this process, when asked whether or not to search and mount the existing linux OS, choose no. We will do that manually later on.

2. Move all filesystem of Fedora 11 into one directory, let's say F11:
bash# cd /; mkdir /sysimage_f11
bash# mount /dev/sda1 /sysimage_f11
bash# cd /sysimage_f11
bash# ls
bin   dev  home  lib    lost+found mnt  proc  sbin  srv  tmp  var
boot  etc  lib64 media  opt  root  selinux  sys  usr
bash# mkdir F11
bash# mv bin dev home lib lost+found mnt proc sbin srv tmp var boot etc lib64 media opt root selinux sys usr F11/
bash# ls
F11

At this moment, there is only one directory "F11" in top level of /dev/sda1.

3. Install Fedora 12 into /dev/sda1:
Boot your computer to start the installation process using Fedora 12 DVD, when asked where to install the OS, choose /dev/sda1, and what is most important here is that you should not format that partition! Step forward to complete the installation.

4. Move all filesystem of Fedora 12 into one directory, let's say F12:
Do this just like we did for Fedora 11, the difference here is, you can leave some directories outside of F12 directory just for simpicity:
/dev, /home, /mnt, /proc, /tmp, /boot, /media, /sys, /lost+found

Those directories can be used by both Fedora 11 and Fedora 12, now the file system layout of /dev/sda1 look like this:
bash# cd /sysimage_f12
bash# ls
boot dev F11 F12 home lost+found media mnt proc sys tmp

Move F11's boot-related files to "boot" directory, except F11/boot/grub:
bash# rm -rf F11/boot/grub
bash# cp -dpR F11/boot/* boot/
bash# rm -rf F11/boot F11/dev F11/home F11/mnt F11/proc F11/tmp F11/media F11/sys F11/lost+found

Add grub entry for Fedora 11 by editing boot/grub/grub.cfg.

5. Make symbol links at boot time to switch between F11 and F12:
The file system layout of F11 and F12 is now the same:
bash# cd F11
bash# ls
bin etc lib lib64 opt root sbin selinux srv usr var

All we have to do now, is to make symbol links for the above directories dynamically. This is done by modifying initrd-xxx under "boot" directory both for F11 and F12.

Add the following lines in initrd-xxx's init scripts, just after root filesystem is mounted and before it is switched to:
rm -f bin etc lib lib64 opt root sbin selinux srv usr var
ln -s F1X/bin bin      # X is 1, or 2
ln -s F1X/etc etc
ln -s F1X/lib lib
ln -s F1X/lib64 lib64
ln -s F1X/opt opt
ln -s F1X/root root
ln -s F1X/sbin sbin
ln -s F1X/selinux selinux
ln -s F1X/srv srv
ln -s F1X/usr usr
ln -s F1X/var var


The method to modify initrd-xxx is beyond the scope of this article, please reference other materials.

Now you are done! Good luck!

6. Links
* This article: http://blog.chinaunix.net/u/8754/showart_2066377.html
* Beta-song' blog: http://sxg.cublog.cn

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