Libguestfs-tools: Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
(Die Seite wurde neu angelegt: „ ==Install== *apt-get install libguestfs-tools ==virt-df== *virt-df Filesystem 1K-blocks Used Available Use% orion:/dev/sd…“) |
|||
| Zeile 35: | Zeile 35: | ||
auto ens3 | auto ens3 | ||
iface ens3 inet dhcp | iface ens3 inet dhcp | ||
| + | </pre> | ||
| + | |||
| + | =virt-edit= | ||
| + | *virsh shutdown orion | ||
| + | Maschine muss ausgeschaltet sein. | ||
| + | *virt-edit -d orion /etc/network/interfaces | ||
| + | <pre> | ||
| + | source /etc/network/interfaces.d/* | ||
| + | |||
| + | auto lo | ||
| + | iface lo inet loopback | ||
| + | |||
| + | auto ens3 | ||
| + | iface ens3 inet static | ||
| + | address 10.81.1.133 | ||
| + | netmask 255.255.0.0 | ||
| + | gateway 10.81.0.1 | ||
| + | dns-nameservers 8.8.8.8 | ||
| + | </pre> | ||
| + | ==virt-tar-out== | ||
| + | ===Kompletter Inhalte packen=== | ||
| + | *virt-tar-out -a orion.img / orion.tar | ||
| + | ===Kompletter Inhalte packen inklusive zippen=== | ||
| + | *virt-tar-out -a orion.img / - | gzip > orion.tgz | ||
| + | ==virt-make-fs== | ||
| + | *virt-make-fs --type=ext3 --size=+2G orion.tgz wega.img | ||
| + | =guestfish= | ||
| + | *guestfish -a /mnt/local/kvm/orion.img | ||
| + | <pre> | ||
| + | Welcome to guestfish, the guest filesystem shell for | ||
| + | editing virtual machine filesystems and disk images. | ||
| + | |||
| + | Type: 'help' for help on commands | ||
| + | 'man' to read the manual | ||
| + | 'quit' to quit the shell | ||
| + | |||
| + | ><fs> run | ||
| + | 100% [#################################################################################################################################################################################] --:-- | ||
| + | ><fs> list-filesystems | ||
| + | /dev/sda1: ext4 | ||
| + | /dev/sda2: unknown | ||
| + | /dev/sda5: swap | ||
| + | ><fs> mount /dev/sda1 / | ||
| + | ><fs> cat /etc/fstab | ||
| + | # /etc/fstab: static file system information. | ||
| + | # | ||
| + | # Use 'blkid' to print the universally unique identifier for a | ||
| + | # device; this may be used with UUID= as a more robust way to name devices | ||
| + | # that works even if disks are added and removed. See fstab(5). | ||
| + | # | ||
| + | # <file system> <mount point> <type> <options> <dump> <pass> | ||
| + | # / was on /dev/sda1 during installation | ||
| + | UUID=15fc6185-e3be-4c2b-96f3-19f8a6960827 / ext4 errors=remount-ro 0 1 | ||
| + | # swap was on /dev/sda5 during installation | ||
| + | UUID=46867ea0-7d5c-43d4-8fda-2ae8cd5c6cc5 none swap sw 0 0 | ||
| + | |||
| + | ><fs> quit | ||
| + | </pre> | ||
| + | =virt-rescue= | ||
| + | *virt-rescue -a wega.img | ||
| + | <pre> | ||
| + | . | ||
| + | . | ||
| + | . | ||
| + | <rescue> | ||
| + | ><rescue> mkdir /mnt | ||
| + | ><rescue> mount /dev/sda1 mnt/ | ||
| + | [ 130.979612] EXT4-fs (sda1): mounted filesystem with ordered data mode. Opts: (null) | ||
| + | ><rescue> cd mnt/ | ||
| + | ><rescue> mount -o bind /proc/ proc/ | ||
| + | ><rescue> mount -o bind /sys sys/ | ||
| + | ><rescue> mount -o bind /dev/ dev/ | ||
| + | ><rescue> chroot /mnt/ /bin/bash | ||
| + | root@(none):/# vi /etc/fstab | ||
| + | root@(none):/# vi /etc/hostname | ||
| + | root@(none):/# vi /etc/network/interfaces | ||
| + | root@(none):/# update-grub | ||
| + | Generating grub configuration file ... | ||
| + | Found linux image: /boot/vmlinuz-4.4.0-21-generic | ||
| + | Found initrd image: /boot/initrd.img-4.4.0-21-generic | ||
| + | /run/lvm/lvmetad.socket: connect failed: No such file or directory | ||
| + | WARNING: Failed to connect to lvmetad. Falling back to internal scanning. | ||
| + | done | ||
| + | root@(none):/# grub-install /dev/sda | ||
| + | Installing for i386-pc platform. | ||
| + | Installation finished. No error reported. | ||
| + | root@(none):/# exit | ||
| + | exit | ||
| + | ><rescue> pwd | ||
| + | /mnt | ||
| + | ><rescue> umount dev/ | ||
| + | ><rescue> umount sys/ | ||
| + | ><rescue> umount proc/ | ||
| + | ><rescue> cd .. | ||
| + | ><rescue> umount /mnt/ | ||
</pre> | </pre> | ||
Version vom 22. Juni 2021, 15:58 Uhr
Install
- apt-get install libguestfs-tools
virt-df
- virt-df
Filesystem 1K-blocks Used Available Use% orion:/dev/sda1 8914984 1388808 7050272 16%
virt-filesystems
- virt-filesystems -a /mnt/local/kvm/orion.img --all --long --uuid
Name Type VFS Label MBR Size Parent UUID /dev/sda1 filesystem ext4 - - 9410969600 - 15fc6185-e3be-4c2b-96f3-19f8a6960827 /dev/sda2 filesystem unknown - - 1024 - - /dev/sda5 filesystem swap - - 1071644672 - 46867ea0-7d5c-43d4-8fda-2ae8cd5c6cc5 /dev/sda1 partition - - 83 9410969600 /dev/sda - /dev/sda2 partition - - 05 1024 /dev/sda - /dev/sda5 partition - - 82 1071644672 /dev/sda - /dev/sda device - - - 10485760000 -
virt-inspector
- virt-inspector /mnt/local/kvm/orion.img > orion-disk.xml
virt-cat
- virt-cat -d orion /etc/network/interfaces
# This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). source /etc/network/interfaces.d/* # The loopback network interface auto lo iface lo inet loopback # The primary network interface auto ens3 iface ens3 inet dhcp
virt-edit
- virsh shutdown orion
Maschine muss ausgeschaltet sein.
- virt-edit -d orion /etc/network/interfaces
source /etc/network/interfaces.d/* auto lo iface lo inet loopback auto ens3 iface ens3 inet static address 10.81.1.133 netmask 255.255.0.0 gateway 10.81.0.1 dns-nameservers 8.8.8.8
virt-tar-out
Kompletter Inhalte packen
- virt-tar-out -a orion.img / orion.tar
Kompletter Inhalte packen inklusive zippen
- virt-tar-out -a orion.img / - | gzip > orion.tgz
virt-make-fs
- virt-make-fs --type=ext3 --size=+2G orion.tgz wega.img
guestfish
- guestfish -a /mnt/local/kvm/orion.img
Welcome to guestfish, the guest filesystem shell for
editing virtual machine filesystems and disk images.
Type: 'help' for help on commands
'man' to read the manual
'quit' to quit the shell
><fs> run
100% [#################################################################################################################################################################################] --:--
><fs> list-filesystems
/dev/sda1: ext4
/dev/sda2: unknown
/dev/sda5: swap
><fs> mount /dev/sda1 /
><fs> cat /etc/fstab
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
# / was on /dev/sda1 during installation
UUID=15fc6185-e3be-4c2b-96f3-19f8a6960827 / ext4 errors=remount-ro 0 1
# swap was on /dev/sda5 during installation
UUID=46867ea0-7d5c-43d4-8fda-2ae8cd5c6cc5 none swap sw 0 0
><fs> quit
virt-rescue
- virt-rescue -a wega.img
. . . <rescue> ><rescue> mkdir /mnt ><rescue> mount /dev/sda1 mnt/ [ 130.979612] EXT4-fs (sda1): mounted filesystem with ordered data mode. Opts: (null) ><rescue> cd mnt/ ><rescue> mount -o bind /proc/ proc/ ><rescue> mount -o bind /sys sys/ ><rescue> mount -o bind /dev/ dev/ ><rescue> chroot /mnt/ /bin/bash root@(none):/# vi /etc/fstab root@(none):/# vi /etc/hostname root@(none):/# vi /etc/network/interfaces root@(none):/# update-grub Generating grub configuration file ... Found linux image: /boot/vmlinuz-4.4.0-21-generic Found initrd image: /boot/initrd.img-4.4.0-21-generic /run/lvm/lvmetad.socket: connect failed: No such file or directory WARNING: Failed to connect to lvmetad. Falling back to internal scanning. done root@(none):/# grub-install /dev/sda Installing for i386-pc platform. Installation finished. No error reported. root@(none):/# exit exit ><rescue> pwd /mnt ><rescue> umount dev/ ><rescue> umount sys/ ><rescue> umount proc/ ><rescue> cd .. ><rescue> umount /mnt/