Scroll to navigation

virt-cat(1) Virtualization Support virt-cat(1)

名前

virt-cat - 仮想マシンにあるファイルの表示

書式

 virt-cat [--options] -d domname file [file ...]
 virt-cat [--options] -a disk.img [-a disk.img ...] file [file ...]

古い形式:

 virt-cat domname file
 virt-cat disk.img file

説明

"virt-cat""file" の内容を表示するためにコマンドラインツールです。ここで "file" は仮想マシン (またはディスクイメージ) の中に存在します。

Multiple filenames can be given, in which case they are concatenated together. Each filename must be a full path, starting at the root directory (starting with '/').

"virt-cat" can be used to quickly view a file. To edit a file, use "virt-edit". For more complex cases you should look at the guestfish(1) tool (see "USING GUESTFISH" below).

Display /etc/fstab file from inside the libvirt VM called "mydomain":

 virt-cat -d mydomain /etc/fstab

どのパッケージが最新インストールされたかを見つけるには:

 virt-cat -d mydomain /var/log/yum.log | tail

どのユーザーが仮想マシンにログインしているかを見つけるには:

 virt-cat -d mydomain /var/run/utmp > /tmp/utmp
 who /tmp/utmp

または、だれがログオンしたかを見つけるには:

 virt-cat -d mydomain /var/log/wtmp > /tmp/wtmp
 last -f /tmp/wtmp

オプション

簡単なヘルプを表示します。
Add file which should be a disk image from a virtual machine. If the virtual machine has multiple block devices, you must supply all of them with separate -a options.

ディスクイメージの形式は自動検知されます。 これを上書きして強制的に特定の形式を使用する場合、 --format=.. オプションを使用します。

リモートディスクを追加します。 "リモートストレージの追加" in guestfish(1) 参照。
This parameter sets the sector size of the disk image. It affects all explicitly added subsequent disks after this parameter. Using --blocksize with no argument switches the disk sector size to the default value which is usually 512 bytes. See also "guestfs_add_drive_opts" in guestfs(3).
libvirt を使用していると、指定された URI に接続します。 省略すると、デフォルトの libvirt ハイパーバイザーに接続します。

ゲストのブロックデバイスを直接指定していると((-a))、libvirt は何も使用されません。

名前付きの libvirt 仮想マシンからすべてのディスクを追加します。 名前の代わりに仮想マシンの UUID を使用できます。
キーやパスフレーズを入力するとき、通常 virt-cat はエコーを無効化します。 そのため、入力内容を確認できません。 テンペスト攻撃の心配がなく、 部屋に誰も居なければ、 入力内容を確認するためにこのフラグを指定できます。
-a オプションは標準状態でディスクイメージの形式を自動検知します。 これを使用することにより、コマンドラインで後続の -a オプションのディスク形式を強制的に指定できます。 引数なしで --format を使用することにより、 後続の -a オプションに対して自動検知に戻せます。

例:

 virt-cat --format=raw -a disk.img file
    

forces raw format (no auto-detection) for disk.img.

 virt-cat --format=raw -a disk.img --format -a another.img file
    

forces raw format (no auto-detection) for disk.img and reverts to auto-detection for another.img.

仮想マシンのディスクイメージが信頼できない raw 形式である場合、 ディスク形式を指定するためにこのオプションを使用すべきです。 これにより、悪意のある仮想マシンにより起こり得る セキュリティ問題を回避できます (CVE-2010-3851)。

Specify a key for LUKS, to automatically open a LUKS device when using the inspection. "ID" can be either the libguestfs device name, or the UUID of the LUKS device.
Use the specified "KEY_STRING" as passphrase.
Read the passphrase from FILENAME.
Read key or passphrase parameters from stdin. The default is to try to read passphrases from the user by opening /dev/tty.

If there are multiple encrypted devices then you may need to supply multiple keys on stdin, one per line.

指定されたマウントポイントにある、 名前付きパーティションまたは論理ボリュームをマウントします。

If the mountpoint is omitted, it defaults to /.

Specifying any mountpoint disables the inspection of the guest and the mount of its root and all of its mountpoints, so make sure to mount all the mountpoints needed to work with the filenames given as arguments.

If you don’t know what filesystems a disk image contains, you can either run guestfish without this option, then list the partitions, filesystems and LVs available (see "list-partitions", "list-filesystems" and "lvs" commands), or you can use the virt-filesystems(1) program.

マウントパラメーターの三番目の (ほとんど使用されない) 項目は、 バックエンドのファイルシステムをマウントするために使用される マウントオプションの一覧です。 これが指定されていない場合、 マウントオプションは空文字列または "ro" (--ro フラグが使用されている場合) になります。

 -m /dev/sda1:/:acl,user_xattr
    

このフラグを使用することは、 "mount-options" コマンドを使用することと同等です。

パラメーターの四番目の項目は使用するファイルシステムドライバー ("ext3""ntfs" など) です。 これはほとんど必要ありません。 しかし、複数のドライバーがファイルシステムに対して有効である場合 (例: "ext2""ext3")、 または libguestfs がファイルシステムを誤検知している場合、 これは有用です。

デバッグ用の冗長なメッセージを有効にします。
バージョン番号を表示して、終了します。
libguestfs API 呼び出しのトレースを有効にします。

旧形式のコマンドライン引数

以前のバージョンの virt-cat はどちらの書き込みもできます:

 virt-cat disk.img [disk.img ...] file

または

 virt-cat guestname file

whereas in this version you should use -a or -d respectively to avoid the confusing case where a disk image might have the same name as a guest.

互換性のため古い形式がまだサポートされています。

LOG FILES

To list out the log files from guests, see the related tool virt-log(1). It understands binary log formats such as the systemd journal.

To follow (tail) text log files, use virt-tail(1).

Windows のパス

"virt-cat" has a limited ability to understand Windows drive letters and paths (eg. E:\foo\bar.txt).

仮想マシンが Windows を実行している場合に限り:

  • Drive letter prefixes like "C:" are resolved against the Windows Registry to the correct filesystem.
  • Any backslash ("\") characters in the path are replaced with forward slashes so that libguestfs can process it.
  • The path is resolved case insensitively to locate the file that should be displayed.

There are some known shortcomings:

  • Some NTFS symbolic links may not be followed correctly.
  • NTFS junction points that cross filesystems are not followed.

guestfish の使用法

guestfish(1)"virt-cat" がうまく機能しないときに使用できる、より強力な、より低レベルなツールです。

"virt-cat" を使用することは、次のこととほぼ同等です:

 guestfish --ro -i -d domname download file -

ここで "domname" は libvirt 仮想マシンの名前です。また、"file" はファイルの完全パスです。最後の "-" ("標準出力に出力" を意味します) に注意してください。

The command above uses libguestfs’s guest inspection feature and so does not work on guests that libguestfs cannot inspect, or on things like arbitrary disk images that don't contain guests. To display a file from a disk image directly, use:

 guestfish --ro -a disk.img -m /dev/sda1 download file -

where disk.img is the disk image, /dev/sda1 is the filesystem within the disk image, and "file" is the full path to the file.

終了ステータス

このプログラムは、成功すると 0 を、エラーがあると 0 以外を返します。

関連項目

guestfs(3), guestfish(1), virt-copy-out(1), virt-edit(1), virt-log(1), virt-tail(1), virt-tar-out(1), http://libguestfs.org/.

著者

Richard W.M. Jones http://people.redhat.com/~rjones/

COPYRIGHT

Copyright (C) 2010-2012 Red Hat Inc.

LICENSE

BUGS

To get a list of bugs against libguestfs, use this link: https://bugzilla.redhat.com/buglist.cgi?component=libguestfs&product=Virtualization+Tools

To report a new bug against libguestfs, use this link: https://bugzilla.redhat.com/enter_bug.cgi?component=libguestfs&product=Virtualization+Tools

When reporting a bug, please supply:

  • The version of libguestfs.
  • Where you got libguestfs (eg. which Linux distro, compiled from source, etc)
  • Describe the bug accurately and give a way to reproduce it.
  • Run libguestfs-test-tool(1) and paste the complete, unedited output into the bug report.
2021-03-31 libguestfs-1.44.2