|
[20051205]
|
qemu saving the day: Extracting an ISO file w/o root
I had an ISO image from which I wanted to get at the files, but
writing to CD wasn't doable (too big for my 700MB CD-R), and mounting
was not possible as I don't have root on this machine. And I didn't
want to bother with moving the files to a machine where I have root.
So here's how qemu saved my day:
The initial plan was to use qemu to boot NetBSD from a CD(image), and then
mount my ISO, copy the files to a harddisk(image) and then move then over from
there using qemu's builtin network.
The two problems that I expected were: 1) how do I access a second
CDROM when I've booted from a first one (as I remembered qemu only being
able to handle one CDROM) and 2) will the qemu networking be fast enough
to move over a whole CD in finite time.
After some frobbing, the solution was even easier: I created a 2GB
harddisk file (just in case ;), and then ran qemu to boot from a NetBSD
install CD, with the harddisk file for wd0 and my ISO as wd1 (who said I
can't have a harddisk in ISO format :-):
% qemu -hda harddisk.qemu -hdb 4y.iso -cdrom i386cd.iso -boot d -m 32
After ^C'ing out of NetBSD's installer, I was able to mount the
ISO (on wd1) to work around the first problem outlined above:
# mount -o ro -t cd9660 /dev/wd1d /mnt
ls(1) etc. work fine, so how to get the files to the host side?
Frobbing qemu's internal networking is probably easy, but here's an
even easier solution:
# tar vcf /dev/wd0d /mnt/.
Who said I can't write a tar archive to the raw device? And as I
can access that "raw" device from the host side as my harddisk image,
all I need to do to unpack it is:
% tar vxf harddisk.qemu
Easy!
qemu rocks!!!
[Tags: iso, qemu]
|