JP Vossen on 20 Dec 2008 14:52:10 -0800

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

[PLUG] Converting a VMware SCSI to IDE virtual disk

So I created a "typical" VMware VM using the VMware (Workstation 5.5.9) 
recommended settings for "Linux, Ubuntu" but it was in fact for Debian 
Lenny.  Now, due to an initrd-tools bug (I think) the latest kernel 
2.6.26-1-686 will not boot.  I get stuck at a "Begin: Waiting for root 
file system ..." message during boot.  It eventually times-out to 
initramfs busybox prompt.  When I poke around in there:
	echo $ROOT  = /dev/sda1		# As expected/desired
	ls -l /dev  = missing sd*	# This is bad!

When I try my previous kernel 2.6.18-6-686, it works fine.  I am about 
to report this as a bug.

I should have used a virtual IDE disk instead of SCSI when planning to 
use Debian.  (I'm pretty sure I've learned this the hard way before, but 
it obviously didn't stick.)

So long story short(er), the following is the process I used to fix my 
mistake.  Anyone aware of anything better (besides "Use KVM or Virtual 
Box" :)?

* Created new IDE Disk, using the VMware console
* Booted via Ubuntu 8.10 LiveCD
* Partitioned IDE disk, same as old SCSI disk
* Rebooted into Debian to see what the new disk will be called (Ubuntu 
8.10 LiveCD had it as sdb2).  Sure enough, Debian Lenny called it hda as 
I would have expected.  I dunno what Ubuntu is doing calling an IDE disk 
* Rebooted via Ubuntu 8.10 LiveCD
* Run terminal and 'sudo bash' to become root
* Mounted both file systems [1]:
	cd /mnt
	mount /dev/sda1 scsi
	mount /dev/sdb1 ide	# NOTE Ubuntu 8.10 is using sdb even though this is 
an IDE disk (AKA hda)
* time rsync --archive --numeric-ids /mnt/scsi/bin /mnt/scsi/boot 
/mnt/scsi/etc /mnt/scsi/home /mnt/scsi/initrd /mnt/scsi/lib 
/mnt/scsi/media /mnt/scsi/mnt /mnt/scsi/opt /mnt/scsi/root 
/mnt/scsi/sbin /mnt/scsi/srv /mnt/scsi/usr /mnt/scsi/var /mnt/ide
	= took 43 minutes for 3.9G
* Recreated other stuff deliberately omitted from rsync
	cd /mnt/ide
	mkdir -m 0755 dev mnt sys srv lost+found
	mkdir -m 0555 proc
	mkdir -m 1777 tmp
	ln -s boot/initrd.img-2.6.18-6-686 initrd.img
	ln -s boot/vmlinuz-2.6.18-6-686 vmlinuz
* grub-install --recheck --root-directory=/mnt/ide /dev/sdb	# NOTE 
Ubuntu 8.10 is using sdb even though this is an IDE disk (AKA hda)
+ Also note that --recheck munges up /boot/grub/, e.g., by 
setting things to what the booted Ubuntu LiveCD thinks they are.  You 
need to fix that below, e.g., sda --> hda.
* Edit "IDE" files:
	vi /mnt/ide/etc/fstab
	vi /mnt/ide/etc/mtab
	vi /mnt/ide/boot/grub/menu.lst
	vi /mnt/ide/boot/grub/
		(hd0)	/dev/hda
* Halt
* Remove SCSI disk via VMware console
* Reboot and test = worked AFAICT

[1] Note that this was a very simple install, with everything on 1 big 
'/' partition.  Having more partitions just makes the mount, rysnc and 
editing parts more tedious, but this will still work if you get all 
those parts right.

Silly note: I sometimes create VMs on VMware Workstation to allow for 
full snapshot trees, then do a full clone of the appropriate snapshot 
and actually use/run the VM on VMware Server elsewhere.  That's true in 
this case.  So basically, this all worked in VMware Workstation 5.5.9 
and VMware Server 1.0.8.

JP Vossen, CISSP            |:::======|        jp{at}jpsdomain{dot}org
My Account, My Opinions     |=========|
"Microsoft Tax" = the additional hardware & yearly fees for the add-on
software required to protect Windows from its own poorly designed and
implemented self, while the overhead incidentally flattens Moore's Law.
Philadelphia Linux Users Group         --
Announcements -
General Discussion  --