[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Installing grub into the mbr of a disk image
From: |
Iwan Vosloo |
Subject: |
Installing grub into the mbr of a disk image |
Date: |
Thu, 17 Apr 2008 14:53:22 +0200 |
Hi there,
I'm trying to build a disk image, partitioned and with grub (0.97 on
ubuntu gutsy) in its mbr. But my installing grub always overwrites the
partition table.
The idea is to boot the disk image in a VM, then to land in grub's
commandline and take things from there. What am I misinderstanding?
These are the steps I follow to create a typical 4GiB image:
1) Create the disk: dd if=/dev/zero of=/diskimage bs=516096c count=8000
(from: http://www.osdev.org/osfaq2/index.php/Disk%20Images%20Under%
20Linux )
(assuming disk geometry of 8000 cylinders, 16 heads, 63
sectors/track, 512 bytes/sector)
2) Partition the disk:
parted /diskimage -s mklabel msdos
parted /diskimage -s mkpart primary ext3 32257B 1040cyl
parted /diskimage -s mkpart primary linux-swap 1041cyl 9230cyl
parted /diskimage -s mkpart primary ext3 9231cyl 100%
3) In order to install grub, I do:
(from
http://www.gnu.org/software/grub/manual/grub.html#Creating-a-GRUB-boot-floppy )
dd if=/usr/lib/grub/i386-pc/stage1 of=/diskimage bs=512 count=1
dd if=/usr/lib/grub/i386-pc/stage2 of=/diskimage bs=512 seek=1
Thanks
- Iwan
- Installing grub into the mbr of a disk image,
Iwan Vosloo <=