You are not logged in.
Pages: 1
Hi,
I'm currently trying to Boot an Archlinux installation from a file, e.g. I have a file ~/sdb that contains an ext4 partition with Arch installed.
How can I boot the System from this partition?
I'd like to boot my regular kernel (/dev/sda1), but mount ~/sdb as my root partition. Is this somehow possible in Grub(-legacy) ?
It would have to be like: Load kernel, mkdir -p /mnt/, mount /dev/sda2 to /mnt/, mount /mnt/home/sdb to /
In case you ask: I want to try some stuff, but not in a VM, and I don't want to resize/move/create partitions.
Help much appreciated!
DIDI2002
Last edited by DIDI2002 (2010-01-29 13:55:35)
Offline
i think you would need a custom mkinitcpio hook that would mount your /dev/sda2 inside the initramfs, then mount your sdb file on the loopback. you would then tell the kernel to boot /dev/loop0
what am i but an extension of you?
Offline
These steps should do it, although they are untested:
- Create /lib/initcpio/install/specialroot containing
install() {
MODULES="brd"
SCRIPT="specialroot"
BINARIES="/sbin/losetup /bin/mount /bin/mkdir"
}
- Create /lib/initcpio/hooks/specialroot containing
run_hook() {
/sbin/modprobe brd
/bin/mkdir /mnt/actualroot
/bin/mount /dev/device-with-sdb /mnt/actualroot
/sbin/losetup /dev/loop0 /mnt/actualroot/path/to/sdb
}
- Add "specialroot" to HOOKS in /etc/mkinitcpio.conf right after "udev"
- Run "mkinitcpio -p kernel26" to regenerate your initcpio
- Edit /etc/fstab and set / to /dev/loop0
- Set root=/dev/loop0 in /boot/grub/menu.lst
I think that's all. As you can tell this is a pain to reverse if you mess up, so be sure you have a livecd ready.
Last edited by tavianator (2010-01-30 02:05:11)
Offline
that looks pretty sound, but what is brd module? i thought module was called "loop", but idk
all in all, the whole thing looks pretty... eh...
if you muck it up, you can disable the hook by add this to the kernel command line at the grub prompt:
disablehooks=specialroot
and also change the root back to sda or whatever
what am i but an extension of you?
Offline
Thanks a lot, didn't know it's so easy to create custom hooks for mkinitcpio (I'm not even using an initrd atm).
I'll try this right now, maybe with mkinitcpio -g /boot/sdbroot.img -k 2.6.32-ARCH
hmm seems to work in theory, but I get the error "mount: no such device", using "mount -r -t ext4 /dev/sda2 /mnt/actualroot" and also using /dev/disk/by-uuid/...
Does this mount have a different syntax?(mount -v gives "unidentified parameter").
/dev/sda2 is detected just a few lines above.
btw, do you have a better solution for testing purposes? Maybe include a different /etc/fstab with the initrd, so it is used to mount loop0 instead of sda1.
Last edited by DIDI2002 (2010-01-30 11:26:21)
Offline
hmm seems to work in theory, but I get the error "mount: no such device", using "mount -r -t ext4 /dev/sda2 /mnt/actualroot" and also using /dev/disk/by-uuid/...
Does this mount have a different syntax?(mount -v gives "unidentified parameter").
/dev/sda2 is detected just a few lines above.
You should probably stick specialroot at the very end of HOOKS, not right after udev. Sorry.
btw, do you have a better solution for testing purposes? Maybe include a different /etc/fstab with the initrd, so it is used to mount loop0 instead of sda1.
Um, well the /etc/fstab you should change is the one inside "sdb", not the one inside /dev/sda2. For testing, I would change fallback_options to "-S autodetect,specialroot" in /etc/mkinitcpio.d/kernel26.preset, and keep the correct root= option on the fallback kernel in /boot/grub/menu.lst. That way the fallback kernel should boot your normal system.
Offline
OOPS my bad, that everywhere I wrote "brd" it should say "loop". brd is the ramdisk module. Thanks extofme.
Offline
Pages: 1