[SOLVED] Installing two linux systems on the same partition
Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Installing two linux systems on the same partition
I would like to try more than just Ubuntu (which was my first linux system and still reigns my hard drive) but I have no more primary partitions and lack the patience and necessary materials (and disk space) to repartition. I have experimented with different ways of installing two systems on the same partition. I tried overcomplicated bind mounting, but that didn't work and it was a miracle I got Ubuntu running again. I tried installing to a usb, then running
sudo cp -r -p /media/usblinux/* ~/usblinux/
but I couldn't pass the right kernel argument through grub2 and I don't think it's possible.
Anyway, if anyone has any ideas, I'm wide open to suggestions.
I'm very aware that I can use extended partitions. Although I may not have made it very clear, my hard drive is nearly full, I already have four primary partitions, I have no access to an external drive. All I have is a stack of CDs and an 8 GB USB stick. atm, I am copying all the files of a linux install on my usb stick, I will boot into my usb, then chroot into the copied files. The reason I am chrooting is that I'm hoping it will trick grub2 into making a correct menu entry, as I don't know how I would do it. Although I severely doubt that this will work.
And no, that failed miserably. On a related note, is it possible to at least create a fake partition that is compatible with grub2 and that I could install a working linux system so that I don't have to borrow an external hard disk and spend hours repartitioning?
Last edited by mahkoe; 12-09-2011 at 09:28 PM.
Reason: previous version was ambiguous
I can't offer any concrete help with the two-OS-one-partition scenario...
You haven't mentioned why you want the second OS. And frankly, it's none of my business. However, if you just want to try out the other OS, then maybe VirtualBox or some other virtual machine package will get what you need.
Even if you need the OS for some specific functional reason (e.g. some special data-processing app written specifically for one distro), VirtualBox can open up the host filesystem to the virtualized OS. The host's device files are probably off-limits; so driver development, driver testing, or raw hardware access is probably not available (or unpredictable if a work-around is attempted).
Originally Posted by mahkoe
On a related note, is it possible to at least create a fake partition that is compatible with grub2
The only thing I'm aware of that would be anything like a "fake partition" would be a loopback file. I doubt that's what you'd want. Though, creating an OS within a loopback is (or was) common practice for creating bootable CD images. It's been a while since I've looked at all that though.
Originally Posted by mahkoe
so that I don't have to borrow an external hard disk and spend hours repartitioning
I've used gparted to do repartitioning. The first time I used it, the human interaction time was less than 10 minutes. The filesystem resizing, partition modification, etc. was all automated and took less than an hour. It's a piece of cake.
Originally Posted by mahkoe
and lack the patience and necessary materials (and disk space) to repartition
Please don't take this the wrong way, because it's not meant to be combative. You've spent a lot of time trying some creative approaches to get the two-OS-one-partition setup working. Probably as much or more than the time to invest in repartitioning--the physical disk space issue aside.
Just 10 minutes ago, I scrapped a script that would check for duplicate files lingering from old attempts to merge old backups. 10 minutes ago, I realized my effort for the script would take 10x longer than other simpler methods. I'm not saying you should try repartitioning--just make sure you don't unnecessarily pull out gobs of hair
All that aside, I'll do some Google'ing to see if I can find something of use. I'll pass along anything of interest.
Maybe this would be of interest: Install Knoppix Inside Another Version of Linux
The instructions also claim to generalize for other distros. Though, I haven't tested it myself... nor am I 100% positive it's what you're looking for.
Pup, mentioned above, is a viable option. I like it.
Another is TinyCore linux. These can be installed as a single folder on an existing partition and a stanza for loading added to your grub configuration.
pup and Tiny are very small, so they do not take up much drive space. They are NOT a general answer to your question, but are specific and special use solutions.
The more general solution to be able to install another Linux distribution under your conditions would require the installation of a virtualization package, addition of additional disk, or wipe out and totally reconfigure your storage (which may leave you with less storage than required for your existing data).
I advise you to leave your main machine functional, and pick up a cheap second machine when one is available to use for testing, reloading, and generally banging on to see what you can break and fix.
Thanks for the replies, also, I have tried loopback OSes but I can never get them to boot, because I don't which kernel arguments are necessary. (For example, the "root=" kernel argument I'm fairly sure only takes /dev/sdxy and UUIDs, and I don't know how the "init=" argument would respond to a loopback). If anyone has any more insight, I'll take it. If not, I'll consider buying an external drive and just installing a whole bunch of distros to that.
Also, the reason I don't just use virtualbox or an easier solution is just because this is the sort of thing I do for fun (and I don't care what anyone has to say about that, its the main reason the only OS I can use anymore is Linux).
I'm going to mark this thread as solved, but feel free to reply.
You can just mount the new distro as root to say a new folder instead of root /.
The issue is no matter how you look at it, the file space will be almost the same either way. If you are out of space then you are out of space.
I'd get some more usb flash drives to load extra OS's on instead of this but you can try just a new root folder. Installer ought to fix it correctly. They'd all have to share a common loader or you'd have to chain back and forth.