[clue] [tech] Ubuntu: how to make a bootable boot CD for my system?

Will will.sterling at gmail.com
Wed Feb 8 14:19:39 MST 2012


Glad to hear that you have found a way to get the job done that worked for
you.  I'm just going to through this out there for posterity's sake.


"  The only thing that would have made that impractical was the VM actually
had a 60GB hard drive but was only using 1.7GB of disk space. "

If the file on the virtual host is only 1.7GB then it is reasonably safe to
say the virtual guest has not written data past 1.7GB into the disk image.
 So step 3 would look like my example below and you will still have a
functioning system with a 60GB hard drive that is stored in a 1.7GB sparse
file.

3. on new VM 'ssh root at oldvm "dd if=/dev/sda bs=512 count=356519"|dd
of=/dev/sda'

On Wed, Feb 8, 2012 at 10:52 AM, Jim Ockers <ockers at ockers.net> wrote:

> **
> Hi Will,
>
> That's an interesting idea.  The only thing that would have made that
> impractical was the VM actually had a 60GB hard drive but was only using
> 1.7GB of disk space.  I didn't want to install a newer Linux version and
> try to migrate the applications and data because it was work-time I didn't
> want to waste because the applications were working perfectly fine in the
> existing VM.  The only reason to move it was the old & busted hypervisor.
>
> Here's what I actually did to move this VM without needing a Ubuntu boot
> CD that could boot this VM:
>
> 1. Boot the old VM from CentOS 6 x86_64 netinstall CD, in rescue mode.
> 2. Make a tarball of the entire filesystem.
> 3. Copy the tarball to a 3rd system.
> 4. Boot the new VM from the CentOS 6 x86_64 netinstall CD, in rescue mode.
> 5. Create the same disk partitions and filesystems structure that the old
> VM had, and mount them as required.
> 6. Untar the tarball into the root filesystem of the new VM.
> 7. While still booted from the CD, I changed to the VM's root filesystem
> root directory and did chroot .  Once I did 'exec /bin/bash' and 'mount
> /proc' I was effectively in the VM's operating system environment with most
> everything fully operational, even though I had originally booted from the
> live CD.
> 8. Edit /etc/fstab to reflect the new device names, because the Ubuntu
> installer had set UUIDs on the partitions and I just wanted to use
> /dev/sda1 etc. for the device names, mostly because I didn't care to figure
> out or learn how to assign a UUID to each device & partition.
> 9. I had to create /dev/sda and /dev/sda1 device nodes because I guess
> Ubuntu was populating the /dev directory block devices automatically.
> 'mknod /dev/sda b 8 0' and so on.
> 10. Once the device nodes existed, I ran grub-install and it installed the
> boot loader in the boot sector of the VM disk.
> 11. It turned out I had to edit a grub configuration file to set the boot
> device and root filesystem to be /dev/sda1 (hd0,0) instead of the UUID
> baloney.  Then I re-ran grub-install, and it booted from the new VM's disk.
> 12. I had to edit the udev 70-persistent-net-rules because the MAC
> addresses of the ethernet interfaces were different in the new VM.
>
> This took about an hour and a half total, and most of that time was spent
> trying to understand grub's obscure error messages which were totally
> unhelpful to understand that it was refusing to boot because the disk &
> partitions didn't have the UUIDs that it expected.  Once I got rid of all
> traces of UUIDs from the grub config file then grub worked as expected.
>
> Thanks everyone for the ideas & advice, I really appreciate it.
>
>
> Jim
> --
> Jim Ockers, P.E., P.Eng. (ockers at ockers.net)
> Contact info: http://www.ockers.net/msi.html
>
>
>
> Will wrote:
>
> Instead of moving the existing disk images just make new images using DD.
>  Most hyper visors can use DD created disk images and if they can not just
> create a empty disk image boot the VM from CD and then use DD to copy the
> disk image over to the empty drive.
>
>
>    1. Boot old VM from media, get it on the LAN.
>    2. Boot new VM from media get it on the LAN
>    3. on new VM 'ssh root at oldvm "dd if=/dev/sda"|dd of=/dev/sda'
>    4. Boot new VM from sda
>
>
> On Mon, Feb 6, 2012 at 12:21 PM, Jim Ockers <ockers at ockers.net> wrote:
>
>> Hi CLUEbies,
>>
>> I'm moving a Ubuntu 8.10 system from one VM hypervisor to another.  Since
>> the VM disk formats are incompatible I have to recreate the filesystem on
>> the new VM and I thought I would just copy the filesystem over the
>> network.  The only thing that won't be copied over is the ability of the
>> new VM to boot from the hard disk.
>>
>> Red Hat/CentOS makes this easy because there's the mkbootdisk utility
>> with --iso command line.  Using that, I can make a bootable CD that will
>> boot my system without anything set up on the hard disk.  Once booted from
>> the ISO, I can re-run grub and am good to go.  The only issue is getting
>> the new VM booted in the first place.
>>
>> The Ubuntu 'mkboot' utility is stupid and busted.  One of its bugs is
>> from the man page for mkboot(8) is "mkboot only works on floppy diskette
>> drives."  Since this is a VM there is no floppy disk drive, real or
>> virtual, on the server or hypervisor.  Frankly I'm really un-impressed with
>> Ubuntu, but then again I'm from the Red Hat/CentOS school of general
>> awesomeness, so maybe I'm missing something. :)  Feel free to flame away
>> but the only thing that will really impress me is if there is some
>> Ubuntu-ish easy way of doing the same thing (such as moving/cloning
>> systems) that Red Hat has let me do for years.
>>
>> Is there some other EASY way to make this Ubuntu system boot exactly its
>> kernel, with its own initrd, from a CD-ROM (ISO image, really)?  This is a
>> headless server with no GUI.  I also don't want to a make bootable USB
>> flash drive which is what most of my googling indicates that most Ubuntu
>> users are trying to do.  I'm also not going to reinstall Ubuntu and
>> reconfigure all of the services and custom stuff that's installed in this
>> VM.
>>
>> You might think I should have to go try to dig up a USB floppy disk drive
>> and assign it to the VM to try to get this to work.  For one thing, that
>> level of old-schoolness is not really my style, but for another thing this
>> VM hypervisor has "issues" with assigning USB devices to VMs, and so it
>> wouldn't work anyway.  (Which is a big part of why I'm moving the whole
>> thing to a different VM hypervisor.)
>>
>> Thanks,
>> Jim
>>
>> --
>> Jim Ockers, P.E., P.Eng. (ockers at ockers.net)
>> Contact info: http://www.ockers.net/msi.html
>>
>>
>
>
> _______________________________________________
> clue mailing list: clue at cluedenver.org
> For information, account preferences, or to unsubscribe see:
> http://cluedenver.org/mailman/listinfo/clue
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://cluedenver.org/pipermail/clue/attachments/20120208/88c9f6e0/attachment.html 


More information about the clue mailing list