how to mount a disk image rw with liveCD?

nta

Active Member
Jan 21, 2017
13
0
41
66
How to mount a disk image (/dev/pve/vm-100-disk-1 or /dev/mapper/pve-vm--100--disk--1) as rw to work on files inside it when booting from liveCD?
 
You don't need do mount /dev/pve/vm-XXX. You boot with an livecd? Then mount the virtual harddrive normaly. For example: /dev/sdax, /dev/vdax
 
Hi,
live-CD on the host or VM?
On the VM - like fireon wrote.
On host - depends on your Storage (lvm, dir, zfs).

Udo
I booted a Ubuntu live CD and the images are on the LVM thin volume that the PVE installation created.
 
You need to get the partitions to show themselves with kpartx

Code:
root@proxmox4 ~ > ls -l /dev/mapper/san--dx100-vm--8003--disk--1*
lrwxrwxrwx 1 root root 9 Jan 13 09:09 /dev/mapper/san--dx100-vm--8003--disk--1 -> ../dm-102
root@proxmox4 ~ > kpartx -a /dev/mapper/san--dx100-vm--8003--disk--1
root@proxmox4 ~ > ls -l /dev/mapper/san--dx100-vm--8003--disk--1*
lrwxrwxrwx 1 root root 9 Jan 13 09:09 /dev/mapper/san--dx100-vm--8003--disk--1 -> ../dm-102
lrwxrwxrwx 1 root root 7 Jan 22 10:06 /dev/mapper/san--dx100-vm--8003--disk--1p1 -> ../dm-0

Then you can mount it directly:

Code:
root@proxmox4 ~ > mount /dev/mapper/san--dx100-vm--8003--disk--1p1 /media
root@proxmox4 ~ > df -hT /media
Dateisystem                                Typ  Größe Benutzt Verf. Verw% Eingehängt auf
/dev/mapper/san--dx100-vm--8003--disk--1p1 ntfs  4,0G    1,5G  2,5G   38% /media

And if you want to unmount it properly, this does the trick:

Code:
root@proxmox4 ~ > umount /dev/mapper/san--dx100-vm--8003--disk--1p1
root@proxmox4 ~ > kpartx -d /dev/mapper/san--dx100-vm--8003--disk--1
root@proxmox4 ~ > ls -l /dev/mapper/san--dx100-vm--8003--disk--1*
lrwxrwxrwx 1 root root 9 Jan 13 09:09 /dev/mapper/san--dx100-vm--8003--disk--1 -> ../dm-102