In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
Editor to share with you how to use Libguestfs to repair damaged virtual machines, I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's learn about it!
Using Libguestfs to find out the corrupted virtual machine files
Libguestfs allows any type of file system to be mounted on a virtual machine to fix startup failures. As a native Linux tool for managing virtual machines in a KVM environment, it is not available for all VMware platforms by default. So administrators won't use it as a tool, but it's worth the time to configure and use it.
To use Libguestfs, you first need to use Libvirt. Libvirt is a management interface that can be connected to KVM, Xen, and other Liunx-based virtual machines. Libguestfs is more powerful to open files on the Windows virtual machine. This means that in addition to being able to use libguestfs, you also need some knowledge about the internal architecture of the virtual machine operating system. But first you need to migrate the virtual machine to the environment available for libguestfs, that is, the Linux environment.
In order to migrate the virtual machine to Linux, you can use SSH to connect to the ESXi host, which means that you first need to enable SSH access on the ESXi host. When finished, run the following scp command on the Linux platform:
Scp-r 192.168.178.30 VmfsUnix VmfsUniVmfsUnix VmfsUniVmfsUniVmfsUniVmfsUnix scp-r 192.168.178.30
Use guestfish to manipulate virtual machines
After you have copied the virtual machine disk image file, you can open it in libguestfs using a tool such as guestfish, so that you can operate directly on the vmdk file. Use the guestfish-rw-a / path/to/windows.vmdk command to create an interactive shell connected to the file system in the virtual machine. In the new window, you can use specific commands to manipulate virtual machine files.
* the task is to find an available file system:
> run > list-filesystems / dev/sda1: ntfs / dev/sda2: ntfs
When you use guestfish shell to find the available file system types, you can mount them. Use the command mount / dev/sda2 / to mount the contents of the two partitions-- in Linux, / dev/sda2-- to the guestfish root. In guestfish, you cannot manipulate directories as you would in other shell environments. The mounted partition is the root directory. You cannot use the cd command to switch directories, which means that all paths must be fully qualified, starting with the root directory. In guestfish shell, you can use commands such as ls, cat, more, and download to view and download files and directories. Type help to see the complete command information. You can use exit to close guestfish shell after all operations have been completed.
Virt-rescue provides direct access.
There are many other tools available in the libguestfs tool. The virt-rescue command-- a * * command that uses normal Linux file system tools to implement ad-hoc changes-- can start a virtual machine in a secure shell. You can manipulate these files in the virtual machine, just as you do on the mounted file system, which provides more direct access to the contents of the virtual machine.
To use the virt-rescue command on the virtual machine, use virt-rescure plus the client hostname to open virt-rescue shell, and then enter > mode.
If you need to mount system files in a virtual machine, you can use the fdisk-l / dev/sda command to check the partition of the virtual machine, and then use the command mount / dev/sda1 / sysroot to mount the partition you want to access. This way you can fix the contents of the virtual machine by changing it.
After the virtual machine is repaired, close virt-rescue shell and move the virtual machine back to the data store of the ESXi server. After the virtual machine returns to its original location, if all goes well, you should be able to access it.
The above is all the contents of the article "how to use Libguestfs to repair damaged virtual machines". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.