Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the method of mounting RAW and qcow2 virtual disks

2025-03-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article introduces the relevant knowledge of "what is the method of mounting RAW and qcow2 virtual disks". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

[preface]

Today, the kernel of a xen virtual machine was mistakenly modified to a normal kernel and could not be started after reboot. There is no way but to fix the problem by mounting the disk file and modifying the grub.conf of the virtual machine system.

1.0 method of mounting RAW disk

Unpartitioned image files directly use loop

Mount-o loop vdisk01.img / mnt/

Partitioned mounts:

Losetup / dev/loop0 vdisk01.img

Kpartx-a / dev/loop0

Mount / dev/mapper/loop0p1 / mnt/

The kpartx command is used to have the Linux kernel read the partition table on a device and then generate the device that represents the corresponding partition.

1.1 method of uninstalling

Umount / mnt

Kpartx-d / dev/loop0

Losetup-d / dev/loop0

2.1 method of mounting qcow2 disk

Modprobe nbd max_part=8

Qemu-nbd-c / dev/nbd0 vdisk01.img

Mount / dev/nbd0p1 / mnt/

Disk mount using lvm:

Vgscan

Vgchange-ay

Mount / dev/VolGroupName/LogVolName / mnt/

2.2 uninstall method

Umount / mnt/

Vgchange-an VolGroupName

Killall qemu-nbd

This entry was posted in Linux and tagged kpartx, mount, qcow2, raw, umount, xen, unmount, mount, virtual disk. Bookmark the permalink.

This is the end of the content of "how to mount RAW and qcow2 virtual disks". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

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.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report