Mount qcow2 file

Tutorial to access the contents of a .qcow2 file on a Linux server.

NBD activation

# Installation of Qemu tools
sudo apt-get -y install qemu-utils

# NBD activation
sudo modprobe nbd max_part=8

# Connect the image as a nbd disc
sudo qemu-nbd --connect=/dev/nbd0 <image.qcow2>

To check the partitions available on the disk use the following command: sudo fdisk -l /dev/nbd0

Use an LVM type volume

# Refresh volumes
sudo pvscan
sudo vgscan
sudo lvscan

# Activate a new found volume
sudo vgchange -ay

# Mount the partition in /mnt
sudo mount /dev/mapper/<lvm-partition> /mnt

# List and display files on the mounted partition
ls /mnt

Deactivate the volume

# Unmount the LVM partition
sudo umount /mnt

# Unmount volume
sudo vgchange -an <lv-volume>

# Disconnect NBD Image
sudo qemu-nbd -d /dev/nbd0

Need help?

You did not found what your were looking for?

Speak with one of our specialists today.

By email

Other suggestions

Accéder au contenu d'un fichier qcow2

Linux Ubuntu

Tutoriel pour accéder au contenu d'un fichier .qcow2 sur un serveur Linux.

Commandes Linux utiles

CentOS Linux Ubuntu

Liste de commandes Linux utile tous les jours.

Comment supprimer des milliers de fichiers


Tutoriel pour supprimer des millions de fichiers sans utiliser 100% des resources disponible.