Tip: virt-rescue, not just for virtual machines!

Virt-rescue isn’t just for virtual machines. You can run it on any raw file or disk image.

We are trying to make virt-df use the same calculations and therefore display the same output as df. So today I wanted to find out what the real “df” command would show on some test filesystems I had prepared. Virt-rescue “to the rescue”:

$ virt-rescue tools/test.img
Welcome to virt-rescue, the libguestfs rescue shell.

Note: The contents of / are the rescue appliance.
You have to mount the guest's partitions under /sysroot
before you can examine them.

><rescue> mkdir /sysroot/lv1
><rescue> mkdir /sysroot/lv2
><rescue> mkdir /sysroot/lv3
><rescue> mount /dev/VG/LV1 /sysroot/lv1
><rescue> mount /dev/VG/LV2 /sysroot/lv2
><rescue> mount /dev/VG/LV3 /sysroot/lv3
><rescue> df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/dm-1              31M   28K   30M   1% /sysroot/lv1
/dev/dm-2              31M  395K   29M   2% /sysroot/lv2
/dev/dm-3              62M   36K   59M   1% /sysroot/lv3
><rescue> df -i
Filesystem            Inodes   IUsed   IFree IUse% Mounted on
/dev/dm-1               8192      11    8181    1% /sysroot/lv1
/dev/dm-2               8192      11    8181    1% /sysroot/lv2
/dev/dm-3              16384      11   16373    1% /sysroot/lv3
><rescue> df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/dm-1                31728        28     30064   1% /sysroot/lv1
/dev/dm-2                31729       395     29696   2% /sysroot/lv2
/dev/dm-3                63472        36     60160   1% /sysroot/lv3

Leave a comment

Filed under Uncategorized

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 )

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.