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
ディスクイメージの形式は自動検知されます。 これを上書きして強制的に特定の形式を使用する場合、 --format=.. オプションを使用します。
ゲストのブロックデバイスを直接指定していると((-a))、libvirt は何も使用されません。
例:
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)。
Use the specified "KEY_STRING" as passphrase.
Note that if any such option is present on the command line, QEMU user networking will be automatically enabled for the libguestfs appliance.
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 がファイルシステムを誤検知している場合、 これは有用です。
以前のバージョンの 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.
互換性のため古い形式がまだサポートされています。
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).
"virt-cat" has a limited ability to understand Windows drive letters and paths (eg. E:\foo\bar.txt).
仮想マシンが Windows を実行している場合に限り:
There are some known shortcomings:
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 (C) 2010-2023 Red Hat Inc.
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:
2024-10-03 | guestfs-tools-1.52.2 |