View previous topic :: View next topic |
Author |
Message |
n0nuf n00b
Joined: 29 Apr 2005 Posts: 5 Location: MO USA
|
Posted: Tue Jun 17, 2014 12:32 pm Post subject: Help: install other linux in gentoo subfolder... |
|
|
Good morning.
I have a working install of gentoo 3.12.21-r1 x86_64. Is it possible to create a folder : /funtoo and untar a fully functional funtoo backup into that folder and then use Grub2 to 'boot' into that folder as if it were the main linux partition?
I am trying to install multiple additional linux distros onto the same partition using unique folders.
the /funtoo (/dev/sda4/funtoo) folder has the entire funtoo distro including its own /boot, /sys, /proc, etc folders.
Physical schema:
/dev/sda1 EFI +32M
/dev/sda2 /boot +1024M
/dev/sda3 swap +16G
/dev/sda4 / +482G (gentoo install)
This method should hide/mask the contents of the top level gentoo linux distro and appear as if the folder /funtoo is actually the root of /dev/sda4 .
Grub2 should load and use the /funtoo/boot/vmlinux-funtoo-debian and /funtoo/boot/initramfs-funtoo-debian kernels with this config.
Granted, I could chroot into this folder, but that is not what I am after as some functionality is unavailable in a chroot environment.
If possible, how do I setup grub.cfg, /funtoo/etc/fstab, etc config files to support this configuration?
Any information, guidance, step-by-step instruction appreciated. Alternatively, if this is not possible, please tell me how do do this effectively.
V/r,
Scott |
|
Back to top |
|
|
RazielFMX l33t
Joined: 23 Apr 2005 Posts: 835 Location: NY, USA
|
Posted: Tue Jun 17, 2014 7:08 pm Post subject: |
|
|
I'm going to assume grub under EFI works the same as grub under BIOS (I use rEFInd on my EFI box, so don't know much about grub and EFI interaction).
1) Copy your /dev/sda4 contents somewhere safe. Hopefully you are mounting drives by their partlabel (since you have this nice option with EFI and gpt partioning).
2) Delete /dev/sda4 using gfdisk.
3) Create /dev/sda4 with the same lable it used to have using gfdisk with some space for /funtoo.
4) Create /dev/sda5 for your funtoo install.
5) Drop the original contents of /dev/sda4 to /dev/sda4 and update fstab as required. Add an entry for /dev/sda5 with or without auto-mounting (probably with a mount point of /funtoo).
6) In your grub.conf, set a boot entry pointing to the partition for /funtoo (hd(0,4)/boot/...). Or, you can use /boot in Gentoo as /boot for funtoo as well and just have a nice kernel list there.
TL;DR: You need a separate physical partition for /funtoo to do what you want. |
|
Back to top |
|
|
NeddySeagoon Administrator
Joined: 05 Jul 2003 Posts: 54644 Location: 56N 3W
|
Posted: Tue Jun 17, 2014 8:01 pm Post subject: |
|
|
n0nuf,
The easy way is to run funtoo in a Virtual Machine of some sort.
If funtoo was in a file, you could have the initrd loopback mount the file as the root filesystem.
Thats what the liveCD does with a read only squashfs file. _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
|
n0nuf n00b
Joined: 29 Apr 2005 Posts: 5 Location: MO USA
|
Posted: Tue Jun 17, 2014 11:34 pm Post subject: additional information |
|
|
Thank you for your replies...
Basically, I want to know if it is possible to replace the root mount point: " /dev/sda4 / (root) " with a 'subfolder ON /dev/sda4 as in: /dev/sda4/funtoo or /dev/sda4/RHEL ... etc.
I do NOT want to use different partitions. That would be too easy.
I want to have multiple flavors of Linux on a single partition with one overarching 'master' linux install. I imagine the structure would look like this:
/dev/sda1 = EFI
/dev/sda2 = BOOT
/dev/sda3 = SWAP
/dev/sda4 = / (root) <- master OS which is currently Gentoo
... Child OS #1 ...
/dev/sda4/funtoo = / (root)
/dev/sda4/funtoo/boot = BOOT
... Child OS #2 ...
/dev/sda4/RHEL = / (root)
/dev/sda4/RHEL/boot = boot
... and so on ...
GRUB2 would be configured so that the Gentoo (master OS) boot was used, OR the Funtoo folder (child #1) /boot was used, OR the RHEL folder (child #2) /boot was used so the specific/unique Kernel (vmlinux + initramfs) for each distro could be activated at boot.
Yes, I could copy all the different Kernels to the master /boot partition and Grub them, but then I would have the issue of keeping all of the distro specific folders/files separated, and I do NOT want to share folders between distros. If I had subfolders, then that folder would essentially become the / (root) of the distro and operate from there with all of the necessary folders (/proc, /dev/, /bin, etc).
I have thought about 'chroot' and 'pivot_mount', but don't see how they would function like a partition mounted linux install. I have also thought about virtualization, but again, that would be the easy way out instead of finding a solution to the stated problem.
I hope this has made my intentions clearer.
V/r,
-S |
|
Back to top |
|
|
szatox Advocate
Joined: 27 Aug 2013 Posts: 3477
|
Posted: Wed Jun 18, 2014 11:28 am Post subject: |
|
|
Quote: | Basically, I want to know if it is possible to replace the root mount point: " /dev/sda4 / (root) " with a 'subfolder ON /dev/sda4 as in: /dev/sda4/funtoo or /dev/sda4/RHEL ... etc. |
this should do the trick
exec chroot <newroot> <init>
Must be run with PID 1 (e.g. from init script in initramfs, NOT from console launched by init script)
Now, talking aobut different flavours: you can use separate /boot with all kernels and all initramfs stuffed there. You only need 1 bootloader, so there are no conflicts, just add distribution tag to kernel and initramfs names. You can even use the same kernel and initramfs image in all your linux flavors, and it will work fine. At leas as long as you load kernel modules from initramfs rather than from system image. Keep in mind you will never be able to access any data from other distributions though, as they will be outside of your jail. To keep things convenient, it might be a better idea to go with LVM where every distribution would have it's own "partition" you can add, delete or resize at any time and since lvm appears like a regular block device it would allow you to mount different distribution. Also it would allow you boot them inside virtual machine.
Anyway, there are no really good and bad solutions, there are only those that match your needs and those that don't. |
|
Back to top |
|
|
NeddySeagoon Administrator
Joined: 05 Jul 2003 Posts: 54644 Location: 56N 3W
|
Posted: Wed Jun 18, 2014 5:37 pm Post subject: |
|
|
szatox,
How do you get write access to /dev/sda4/<some_dir> when /dev/sda4 is apparently not mounted?
n0nuf,
Is LVM cheating ? _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|