virt-rescue –scratch

virt-rescue is a useful “rescue tool” (like a rescue CD) for virtual machines.

New in libguestfs ≥ 1.17.36 is the virt-rescue --scratch[=N] option which lets you create scratch disks to play with.

Firstly it’s useful for playing around with Linux utilities that you might not normally get to use, such as mdadm and btrfs. For example, suppose you want to try spanning a btrfs filesystem over 4 devices. This is now simple and you don’t even need root:

$ virt-rescue --scratch=4
><rescue> mkfs.btrfs /dev/vda /dev/vdb /dev/vdc /dev/vdd
><rescue> mount /dev/vda /sysroot
><rescue> btrfs filesystem show
Label: none  uuid: da1693d6-a89f-4cb6-8405-d277869e289b
	Total devices 4 FS bytes used 28.00KB
	devid    1 size 10.00GB used 2.02GB path /dev/vda
	devid    2 size 10.00GB used 2.00GB path /dev/vdb
	devid    3 size 10.00GB used 1.01GB path /dev/vdc
	devid    4 size 10.00GB used 1.01GB path /dev/vdd

Secondly it’s a way to get a second temporary disk attached to an ordinary guest while you’re rescuing it, for example if you need to temporary copy some data off the guest while you’re fixing it.

# virt-rescue -d Fedora16 --scratch
><rescue> fdisk /dev/vdb
(use fdisk and mkfs to partition the scratch disk
and then use it for temporary data)

2 Comments

Filed under Uncategorized

2 responses to “virt-rescue –scratch

  1. Looks really useful.
    Rich, Thanks for your tireless efforts on building these virt-tools.
    It was good to meet(albeit, very brief) you at FOSDEM 2012. Next time if I get to meet you, I’m buying you a drink !

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s