Unix and Linux Discussions Tagged with wordpress |
|
Thread / Thread Starter |
Last Post |
Replies |
Views |
Forum |
|
|
|
0 |
2,027 |
What is on Your Mind? |
|
|
|
0 |
1,640 |
Red Hat |
|
|
|
6 |
2,143 |
Web Development |
|
|
|
1 |
2,907 |
Web Development |
|
|
|
3 |
3,417 |
Web Development |
|
|
|
0 |
2,205 |
Linux |
|
|
|
0 |
4,746 |
Web Development |
|
|
|
0 |
2,796 |
OS X (Apple) |
|
|
|
0 |
2,503 |
Software Releases - RSS News |
|
|
|
0 |
1,065 |
Software Releases - RSS News |
|
|
|
0 |
1,691 |
OS X OpenSource RSS |
|
|
|
0 |
953 |
Software Releases - RSS News |
|
|
|
0 |
1,811 |
UNIX and Linux RSS News |
|
|
|
0 |
1,064 |
Software Releases - RSS News |
|
|
|
0 |
1,003 |
Software Releases - RSS News |
|
|
|
0 |
1,857 |
OS X OpenSource RSS |
|
|
|
0 |
1,162 |
Software Releases - RSS News |
|
|
|
0 |
1,094 |
Software Releases - RSS News |
|
|
|
0 |
1,291 |
Software Releases - RSS News |
|
|
|
0 |
1,036 |
Software Releases - RSS News |
|
|
|
0 |
1,042 |
Software Releases - RSS News |
|
|
|
0 |
789 |
Software Releases - RSS News |
|
|
|
0 |
909 |
Software Releases - RSS News |
|
|
|
0 |
1,662 |
OS X OpenSource RSS |
|
|
|
0 |
806 |
Software Releases - RSS News |
|
|
|
0 |
761 |
Software Releases - RSS News |
|
|
|
0 |
776 |
Software Releases - RSS News |
|
|
|
0 |
1,142 |
UNIX and Linux RSS News |
|
|
|
0 |
820 |
Software Releases - RSS News |
|
|
|
0 |
962 |
Software Releases - RSS News |
|
|
|
0 |
1,218 |
UNIX and Linux RSS News |
|
|
|
0 |
1,303 |
UNIX and Linux RSS News |
|
|
|
0 |
892 |
Software Releases - RSS News |
|
|
|
0 |
1,227 |
Software Releases - RSS News |
|
|
|
0 |
1,535 |
UNIX and Linux RSS News |
|
|
|
0 |
871 |
Software Releases - RSS News |
|
|
|
0 |
976 |
Software Releases - RSS News |
|
|
|
0 |
1,132 |
UNIX and Linux RSS News |
|
|
|
0 |
1,537 |
UNIX and Linux RSS News |
|
|
|
0 |
992 |
Software Releases - RSS News |
guestfs-recipes(1) Virtualization Support guestfs-recipes(1)
NAME
guestfs-recipes - libguestfs, guestfish and virt tools recipes
DESCRIPTION
This page contains recipes for and links to things you can do using libguestfs, guestfish(1) and the virt tools.
Audit a virtual machine for setuid files
The link below contains a small program which can be used to audit a Linux virtual machine to see what setuid and setgid files it contains.
https://rwmj.wordpress.com/2010/12/15/tip-audit-virtual-machine-for-setuid-files/#content
Change the background image in a Windows XP VM
The links below explain how to use guestfish(1) to change the background image for a user of a Windows XP VM. Unfortunately the technique
appears to be substantially different for each version of Windows.
https://lists.fedoraproject.org/pipermail/virt/2011-May/002655.html https://lists.fedoraproject.org/pipermail/virt/2011-May/002658.html
Cloning a virtual machine (Linux)
The guestfish technique described in the link below works well for most Linux VMs. Depending on the Linux distro you may need to change
the paths slightly.
https://rwmj.wordpress.com/2010/09/24/tip-my-procedure-for-cloning-a-fedora-vm/#content
Avoid virt-clone(1). Currently what to do about virt-clone is under discussion.
https://www.redhat.com/archives/virt-tools-list/2011-May/msg00019.html
Cloning a virtual machine (Windows)
It is possible to do a "sysprep" using libguestfs alone, although not straightforward. Currently there is code in the Aeolus Oz project
which does this (using libguestfs). As part of our review of the virt-clone tool, we may add sysprepping ability.
https://github.com/clalancette/oz https://www.redhat.com/archives/virt-tools-list/2011-May/msg00019.html
Convert a CD-ROM / DVD / ISO to a tarball
This converts input "cd.iso" to output "cd.tar.gz":
guestfish --ro -a cd.iso -m /dev/sda tgz-out / cd.tar.gz
To export just a subdirectory, eg. "/files", do:
guestfish --ro -a cd.iso -m /dev/sda tgz-out /files cd.tar.gz
Create empty disk images
You can use the guestfish(1) -N option to create empty disk images. The useful guide below explains the options available.
https://rwmj.wordpress.com/2010/09/08/new-guestfish-n-options-in-1-5-9/#content
Dump raw filesystem content from inside a disk image or VM
You can use the guestfish(1) "download" command to extract the raw filesystem content from any filesystem in a disk image or a VM (even one
which is encrypted or buried inside an LV):
guestfish --ro -a disk.img run : download /dev/sda1 sda1.img
guestfish --ro -d Guest run : download /dev/vg_guest/lv_root lv.img
To list the filesystems in a disk image, use virt-filesystems(1).
Edit grub configuration in a VM
You can use this to:
o Fix a virtual machine that does not boot.
o Change which kernel is used to boot the VM.
o Change kernel command line options.
Use virt-edit(1) to edit the grub configuration:
virt-edit -d BrokenGuest /boot/grub/grub.conf
or for general tinkering inside an unbootable VM use virt-rescue(1) like this:
virt-rescue -d BrokenGuest
Export any directory from a VM
To export "/home" from a VM into a local directory use virt-copy-out(1):
virt-copy-out -d Guest /home .
Notes:
o The final dot of the command is not a printing error. It means we want to copy out to the current directory.
o This creates a directory called "home" under the current directory.
If the guest is a Windows guest then you can use drive letters and backslashes, but you must prefix the path with "win:" and quote it to
protect it from the shell, like this:
virt-copy-out -d WinGuest 'win:c:windowssystem32config' .
To get the output as a compressed tarball, do:
virt-tar-out -d Guest /home - | gzip --best > home.tar.gz
Although it sounds tempting, this is usually not a reliable way to get a backup from a running guest. See the entry in the FAQ:
http://libguestfs.org/FAQ.html#backup
Find out which user is using the most space
This simple script examines a Linux guest to find out which user is using the most space in their home directory:
#!/bin/sh -
set -e
vm="$1"
dir=/home
eval $(guestfish --ro -d "$vm" -i --listen)
for d in $(guestfish --remote ls "$dir"); do
echo -n "$dir/$d"
echo -ne ' '
guestfish --remote du "$dir/$d";
done | sort -nr -k 2
guestfish --remote exit
Get DHCP address from a VM
The link below explains the many different possible techniques for getting the last assigned DHCP address of a virtual machine.
https://rwmj.wordpress.com/2011/03/31/tip-code-for-getting-dhcp-address-from-a-virtual-machine-disk-image/#content
In the libguestfs source examples directory you will find the latest version of the "virt-dhcp-address.c" program.
Get the operating system product name string
Save the following script into a file called "product-name.sh":
#!/bin/sh -
set -e
eval "$(guestfish --ro -d "$1" --i --listen)"
root="$(guestfish --remote inspect-get-roots)"
guestfish --remote inspect-get-product-name "$root"
guestfish --remote exit
Make the script executable and run it on a named guest:
# product-name.sh RHEL60x64
Red Hat Enterprise Linux Server release 6.0 (Santiago)
You can also use an XPath query on the virt-inspector(1) XML using the "xpath" command line tool or from your favourite programming
language:
# virt-inspector RHEL60x64 > xml
# xpath '//product_name' < xml
Found 1 nodes:
-- NODE --
<product_name>Red Hat Enterprise Linux Server release 6.0 (Santiago)</product_name>
Get the default boot kernel for a Linux VM
The link below contains a program to print the default boot kernel for a Linux VM.
https://rwmj.wordpress.com/2010/10/30/tip-use-augeas-to-get-the-default-boot-kernel-for-a-vm/#content
It uses Augeas, and the technique is generally applicable for many different tasks, such as:
o listing the user accounts in the guest
o what repositories is it configured to use
o what NTP servers does it connect to
o what were the boot messages last time it booted
o listing who was logged in recently
http://augeas.net/
Install RPMs in a guest
The link below contains a method to install RPMs in a guest. In fact the RPMs are just uploaded to the guest along with a "firstboot"
script that installs them next time the guest is booted. You could use this technique to install vital security updates in an offline
guest.
https://rwmj.wordpress.com/2010/12/01/tip-install-rpms-in-a-guest/#content
List applications installed in a VM
Save the following to a file "list-apps.sh":
#!/bin/sh -
set -e
eval "$(guestfish --ro -d "$1" --i --listen)"
root="$(guestfish --remote inspect-get-roots)"
guestfish --remote inspect-list-applications "$root"
guestfish --remote exit
Make the file executable and then you can run it on any named virtual machine:
# list-apps.sh WinGuest
[0] = {
app_name: Mozilla Firefox (3.6.12)
app_display_name: Mozilla Firefox (3.6.12)
app_epoch: 0
app_version: 3.6.12 (en-GB)
app_release:
app_install_path: C:Program FilesMozilla Firefox
app_trans_path:
app_publisher: Mozilla
app_url: http://www.mozilla.com/en-GB/
app_source_package:
app_summary:
app_description: Mozilla Firefox
}
[1] = {
app_name: VLC media player
app_display_name: VLC media player 1.1.5
app_epoch: 0
app_version: 1.1.5
app_release:
app_install_path: C:Program FilesVideoLANVLC
app_trans_path:
app_publisher: VideoLAN
app_url: http://www.videolan.org/
app_source_package:
app_summary:
app_description:
}
If you want to run the script on disk images (instead of libvirt virtual machines), change "-d "$1"" to "-a "$1"". See also
virt-inspector(1).
List files and directories in a VM
This involves using the guestfish(1) "find0" command like this:
guestfish --ro -d Guest -i find0 / - | tr '