Skip to contentSkip to conversation

qemu and already installed OS

Qemu-devel [email protected] 5 participants 12 messages Mar 19, 2004 – Mar 23, 2004

lore
Share & tools
lore
#0 lore raw

I used dd on a working partition, created a file and lauched qme... dd if=/dev/hda1 of=/home/me/partitionhda.img
but the boot fails :
Disk I/O error
Replace the disk, and then prees any key

should I have added some extra options to dd ? (like bs= count= ?)
Did it work for you ?

#1 lore raw

Hi,

Quoted 1 line

dd if=/dev/hda1 of=/home/me/partitionhda.img

In order to boot from this you need a boot sector (partitiontable).

Which means you have to a dd if=/dev/hda of=/path/to/img

                                     ~~~ -> without the appended '1'
Quoted 1 line

should I have added some extra options to dd ? (like bs= count= ?)

Specifying a bigger blocksize could speedup things but don't specifying one shouldn't do any harm but killing your time. :-)

Thomas

#2 lore raw
Quoted 3 lines · Thomas Glanzmann

In order to boot from this you need a boot sector (partitiontable). Which means you have to a dd if=/dev/hda of=/path/to/img

                                     ~~~ -> without the appended '1'

Good, good !
It means that I have to copy the whole disk, or approximatively a file bigger than my partition.
Of course there must be some tools to save only the boot sector and the partition wanted.
But I don't need to do a very clean job today, so that should be perfect for this time.
thank you Thomas.

#3 lore raw
Quoted 6 lines · On Friday 19 March 2004 12:46, [email protected] wrote:
Quoted 3 lines · Thomas Glanzmann

In order to boot from this you need a boot sector (partitiontable). Which means you have to a dd if=/dev/hda of=/path/to/img

                                     ~~~ -> without the appended '1'

It means that I have to copy the whole disk, or approximatively a file bigger than my partition.

dd if=/dev/hda of=/home/me/disk.img bs=1024 count=1600000 It does not boot either...
the only message is "L"
I must be wrong somewhere...

#4 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 2 lines · On Friday 19 March 2004 14:24, [email protected] wrote:

the only message is "L"
I must be wrong somewhere...

what are you complaining about? most programs give you one letter less than that in case of an error ;o)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFAWuvj1nTg39QS/TsRAlLeAJ0Ya79ACiCH6DN4vgJ6LpASEycglwCfUxin hq/2MnveUCSbQ6xyFJzErEk=
=KY4J
-----END PGP SIGNATURE-----

#11 lore raw

[Qemu-devel] [small help] dd, mbr, fdisk

In reply to [email protected]

where myhdsize is your harddisk size in Mo :

HDS = myhdsize / 512

$ dd if=/dev/zero of=virtualhardisk.hd bs=2048 count=HDS
$ install-mbr virtualhardisk.hd # apt-get install mbr ...
$ cfdisk virtualhardisk.hd

[Do what you want with your hard disk & qemu ...]

Then you can use (for your "hda1") :
losetup -o 32256 /dev/loop0 virtualhardisk.hd
mount /dev/loop0 /mnt/temp
[...]
umount /mnt/temp
losetup -d /dev/loop0

Bye.

Signature · 2 lines
Sebastien Bechet <[email protected]>
av7.net
#8 lore raw
In reply to [email protected]
Quoted 4 lines · [email protected] wrote:

dd if=/dev/hda of=/home/me/disk.img bs=1024 count=1600000 It does not boot either...
the only message is "L"
I must be wrong somewhere...

That would be your lilo, grab the kernel from the partition, put it somewhere, load that kernel image with qemu (with the appropriate parameters, you can get them from lilo conf, it's the append line) and fire away.

once you get it to boot, reinstall lilo.

i can't really tell you the commands how to do this, as i'm not at home to check them.

Regards, Sami

#6 lore raw
In reply to Thomas Glanzmann
Quoted 2 lines · Thomas Glanzmann
Quoted 1 line

dd if=/dev/hda of=/home/me/disk.img bs=1024 count=1600000

drop that count parameter.

It means I will save my whole (and only) hard disk ? ?

#9 lore raw
In reply to Sami Haahtinen
Quoted 10 lines · Sami Haahtinen
Quoted 4 lines

dd if=/dev/hda of=/home/me/disk.img bs=1024 count=1600000 It does not boot either...
the only message is "L"
I must be wrong somewhere...

That would be your lilo, grab the kernel from the partition, put it somewhere, load that kernel image with qemu (with the appropriate parameters, you can get them from lilo conf, it's the append line) and fire away.

How do you "grab the kernel" ?
I tried "dd if=/dev/hda", but as I said, lilo crash....

#10 lore raw
Quoted 9 lines · [email protected] wrote:
Quoted 5 lines · Sami Haahtinen

That would be your lilo, grab the kernel from the partition, put it somewhere, load that kernel image with qemu (with the appropriate parameters, you can get them from lilo conf, it's the append line) and fire away.

How do you "grab the kernel" ?
I tried "dd if=/dev/hda", but as I said, lilo crash....

Ok, i found a neater way for you to do that.. ;)

go to: http://www.lnx-bbc.org/download.html fetch the iso image.

boot with the image, log in as root. mount your partition, and chroot to it:
mount /dev/hda1 /tmp
chroot /tmp /bin/sh

If you have other filesystems you are forced to mount, you shouldn't really do this unless you have to. If you do this, you need to clean up before you go:
mount -a

Re-install lilo by running lilo.

Back out once again:
exit (exit back to lnx-bbc)
umount /tmp
sync (i like to play it safe)

shutdown the system and boot up without the bootable CD-Image.

That's the quick tour on recovering from a HD failure, there are better howtos for this, but if you are clever you should be able to do it with this.

-- Sami

#7 lore raw
In reply to [email protected]
Quoted 7 lines · On Saturday 20 March 2004 10:09, [email protected] wrote:
Quoted 3 lines · Thomas Glanzmann
Quoted 1 line

dd if=/dev/hda of=/home/me/disk.img bs=1024 count=1600000

drop that count parameter.

It means I will save my whole (and only) hard disk ? ?

Thomas, you were right !
In order to copy the partition with dd, and to manage to boot, we have to copy :
-the boot sector (if=/dev/hda and not if=/dev/hda1)
-the target partition for qemu (of course)
-AND the linux partition where grub comes from.

I managed to store these 3 things in the begining of the hard disk, so it takes me only 2.5Gb. correct.