Reset root pass on xen guest using physical disk

xen

I've found a few tutorials to reset the password on a xen guest using image files, such as this one:
http://www.howtoforge.com/forums/showthread.php?t=28779

However I haven't had any luck with examples of modifying this to work with physical disks.

This guest is currently running. I'd appreciate it if you could start from listing the command to shutdown the guest from the host, all the way through to restarting the xen guest after it's root password has been changed.

also, not sure what this means, but on my local machine "xm" is the command used to interact with xen, not xe like I've seen in most tutorials.

Here is the disk line of the xen config file:

disk = [ "phy:/dev/sdb1,xvda,w" ]

Thanks,

-Eric

Best Answer

Shutdown the guest using something like

xm shutdown <guest>

Check so it is shutdown

xm top

That path hints that it's not an LVM, but a physical disk. This is a job for libguestfs. Make sure you have it installed. First you check what filesystems you have in that block device:

virt-filesystems -a /dev/sdb1

Then you mount the root filesystem:

guestmount -a /dev/sdb1 -m /dev/<whateverhappenstoberoot> --rw /mnt

Change root directory:

chroot /mnt/

Update your passwords

passwd root

And then you restore everything

logout
unmount /mnt/
xm create /etc/xen/vm/<guest>