help-grub
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Installing GRUB to drive image


From: Charles Yost
Subject: Re: Installing GRUB to drive image
Date: Thu, 29 Mar 2012 01:32:49 -0400

On Thu, Mar 29, 2012 at 1:09 AM, Jordan Uggla <address@hidden> wrote:
> On Mar 28, 2012 6:29 PM, "Charles Yost" <address@hidden> wrote:
>
>> > I will make the alterations and see if I can get the image to boot.
>> >
>>
>>
>> Progress has been made, I think, but the image, when copied on to
>> disk, is not booting. It displays: (error: no such device:
>> 69ee516d-d9b4-4075-84e4-8d71d31f3061) I don't have any partitions with
>> this block id on the system I used to create the image, so I can only
>> guess that it was the block id of the device created by kpartx? It
>> then dumps me to the rescue prompt. When at the rescue prompt, I can
>> type ls and it shows (hd0), but insmod normal produces: (error:
>> unknown filesystem.).
>> What should I try next?
>
> What are the exact commands you're currently running after
> partitioning with parted, including the mount commands? Also, to save
> time rather than dding the image to an actual device and rebooting to
> test it you can simply run "kvm -hda /path/to/disk.img".
>

Thanks for the tip. I didn't think to use kvm. I'll install it and
give it a try right after I send this e-mail.

Here are the commands I used.

#!/bin/bash
# disk is a 1GB image, with 4 primary partitions, starting at: 1049kB,
50M, 71M, 547M
# grub is compiled and waiting in the the grub directory next to disk.img
IMAGE_FILE=disk.img
IMAGE_FILE_LOOP=$(losetup --find)
IMAGE_FILE_LOOP_BASE=$(basename ${IMAGE_FILE_LOOP})
losetup --verbose ${IMAGE_FILE_LOOP} ${IMAGE_FILE}
kpartx -a -v ${IMAGE_FILE_LOOP}
mkfs.ext3 -b 1024 -L boot -v /dev/mapper/${IMAGE_FILE_BASENAME}p1
mkfs.msdos -F 32 -n part2 -v /dev/mapper/${IMAGE_FILE_BASENAME}p2
mkfs.ext3 -b 1024 -L part3 -v /dev/mapper/${IMAGE_FILE_BASENAME}p3
mkfs.ext3 -b 1024 -L part4 -v /dev/mapper/${IMAGE_FILE_BASENAME}p4
mkdir --parents --verbose /mnt/disk_image-boot
BOOT_LOOP=$(losetup --find)
losetup --verbose ${BOOT_LOOP} /dev/mapper/${IMAGE_FILE_BASENAME}p1
mount --verbose --types ext3 ${BOOT_LOOP} /mnt/disk_image-boot
mkdir --parents --verbose /mnt/disk_image-os
OS_LOOP=$(losetup --find)
losetup --verbose ${OS_LOOP} /dev/mapper/${IMAGE_FILE_BASENAME}p3
mount --verbose --types ext3 ${OS_LOOP} /mnt/disk_image-os
cp grub/* /mnt/disk_image-os
/mnt/disk_image-os/usr/sbin/grub-install --modules=serial
--boot-directory=/mnt/disk_image-boot --no-floppy ${IMAGE_FILE_LOOP}

Thanks,
=> Charles



reply via email to

[Prev in Thread] Current Thread [Next in Thread]