Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Booting from a loopback root located on HFS+
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Gentoo on PPC
View previous topic :: View next topic  
Author Message
JettLogic
n00b
n00b


Joined: 04 Jan 2006
Posts: 15

PostPosted: Tue Jan 31, 2006 9:28 pm    Post subject: Booting from a loopback root located on HFS+ Reply with quote

Hi all,

What I want to do

Boot a Gentoo Linux root partition from a loopback device located on a whole-disk HFS+ partition. The system is an iBook G4 with Mac OS X 10.4 "Tiger". I would also want to mount swap, /var, /usr and so forth from loopback devices on the HFS+. If it works well, I just might keep it that way.

Motivation

"Look before you leap". This will be my first laptop install of Linux, and I don't want to go resizing partitions or deleting Mac OS X until I'm sure I know how to get everything working in Gentoo, how much space I want to give it, and whether I want to keep Mac OS X. Hence the loopback files.

Also, I have Googled for four hours now and can't find anyone who has done this (though I've found out much about resizing HFS+, Airport Extreme, DVI output, etc). Maybe I'm just bad at searching.

Open Question

How can one boot Linux from a loopback file located on an HFS+ partition?
Back to top
View user's profile Send private message
ttuegel
Apprentice
Apprentice


Joined: 18 Jan 2005
Posts: 176
Location: Illinois, USA

PostPosted: Wed Feb 01, 2006 12:04 am    Post subject: Re: Booting from a loopback root located on HFS+ Reply with quote

JettLogic wrote:
How can one boot Linux from a loopback file located on an HFS+ partition?


Actually, I did this for my first install on PPC. It's not fun at all. I'm sorry, I don't remember all the details, but you basically need to mount the partition from the Live CD, make the loopback filesystem, mount it, install there, put your kernel and stuff on the HFS+ partition (yaboot can boot from it) and (the tricky part) make an initrd that you can load from the HFS+ partition which will mount your loopback file (kinda like the LiveCD uses an initrd to mount it's squash'd loopback). If you can possibly avoid this, however, don't do it. Shut down, e.g., gets to be a pain. I never could figure out how to get it to unmount all the partitions (after you chroot from the initrd and run init, you can't seem to be able to un-chroot to unmount the root partition), so it complains, loudly.

That's about all I remember... I'm sorry I can't be more helpful, but that should get you off in the right direction, at least.
Back to top
View user's profile Send private message
JettLogic
n00b
n00b


Joined: 04 Jan 2006
Posts: 15

PostPosted: Wed Feb 01, 2006 11:00 am    Post subject: Reply with quote

Thank you for the advice ttuegel. It sounds quite hairy indeed but I get the general idea. I was really hoping to avoid rolling my own initrd though, and at least yaboot can use HFS+ (it's only a "planned feature" for GRUB).

I haven't examined the LiveCD initrd, but your point

Quote:

I never could figure out how to get it to unmount all the partitions (after you chroot from the initrd and run init, you can't seem to be able to un-chroot to unmount the root partition), so it complains, loudly.


Lead me to the pivot_root manpage

Quote:

pivot_root moves the root file system of the current process to the directory put_old and makes new_root the new root file system. Since pivot_root(8) simply calls pivot_root(2), we refer to the man page of the latter for further details.

Note that exec chroot changes the running executable, which is necessary if the old root directory should be unmounted afterwards. Also note that standard input, output, and error may still point to a device on the old root file system, keeping it busy. They can easily be changed when invoking chroot (see below; note the absence of leading slashes to make it work whether pivot_root has changed the shell's root or not).

EXAMPLES
Change the root file system to /dev/hda1 from an interactive shell:

mount /dev/hda1 /new-root
cd /new-root
pivot_root . old-root
exec chroot . sh <dev/console >dev/console 2>&1
umount /old-root


If I read this right, you should be able to pivot_root to the loopback, "exec /usr/sbin/chroot . /sbin/init" and then unmount the HFS+ while still in /linuxrc, eliminating the mounted-fs-on-shutdown problem. Any devs who can comment on this?

Maybe I'll "just" give Gentoo a few GB (I hate resizing without LVM, esp. the required full-disk backup) and keep all my data and distfiles symlinked onto the HFS+, but I'll give the yaboot+initrd+loopback a try first.[/url][/quote]
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gentoo on PPC All times are GMT
Page 1 of 1

 
Jump to:  
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