From e844d081db10ff3e920c698f8a0c6ece57a9883c Mon Sep 17 00:00:00 2001 From: Yukikoo Date: Tue, 9 Apr 2019 22:13:17 +0200 Subject: [PATCH 1/4] Create mount-hvm-disk.md How to mount a HVM disk. Not directly related to Qubes OS ( related to LVM only) But useful to know --- debugging/mount-hvm-disk.md | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 debugging/mount-hvm-disk.md diff --git a/debugging/mount-hvm-disk.md b/debugging/mount-hvm-disk.md new file mode 100644 index 00000000..b486c97d --- /dev/null +++ b/debugging/mount-hvm-disk.md @@ -0,0 +1,35 @@ +--- +layout: doc +title: Mount HVM disk +permalink: /doc/mount-hvm-disk/ +--- + +# How to mount HVM disk + +You want to read your HVM disk (ex: you did some errors and can't start the HVM ). + +First, read the partition table: + +```bash +sudo parted /dev/YOUR_VG/YOUR_VM unit B print +``` + +Example: + +``` +$:sudo parted /dev/windows-vg/vg-game-root unit B print +Model: Linux device-mapper (thin) (dm) +Disk /dev/dm-138: 314572800000B +Sector size(logical/physical): 512B/512B +Partition Table: msdos +Disk Flags: +Number Start End Size Type File system Flags +1 1048576B 105906175B 104857600B primary ntfs boot +2 105906176B 314571751423B 314465845248B primary ntfs +``` + +Then mount the partition you want: + +```bash +sudo mount -o loop,offset=105906176 -t ntfs /dev/windows-vg/vg-game-root /mnt/ +``` From 4cc13a768a864398d3c0d9b695c0eee82e03424c Mon Sep 17 00:00:00 2001 From: Yukikoo Date: Fri, 12 Apr 2019 22:54:56 +0200 Subject: [PATCH 2/4] Update mount-hvm-disk.md --- debugging/mount-hvm-disk.md | 54 +++++++++++++++++++++---------------- 1 file changed, 31 insertions(+), 23 deletions(-) diff --git a/debugging/mount-hvm-disk.md b/debugging/mount-hvm-disk.md index b486c97d..e7c9963e 100644 --- a/debugging/mount-hvm-disk.md +++ b/debugging/mount-hvm-disk.md @@ -1,35 +1,43 @@ --- layout: doc -title: Mount HVM disk -permalink: /doc/mount-hvm-disk/ +title: Mount LVM image +permalink: /doc/mount-lvm-image/ --- -# How to mount HVM disk +# How to mount LVM image -You want to read your HVM disk (ex: you did some errors and can't start the HVM ). - -First, read the partition table: +You want to read your LVM image (ex: you did some errors and can't start the VM ). + +1: make the image available for qubesdb. (dom0) ```bash -sudo parted /dev/YOUR_VG/YOUR_VM unit B print +# Example: /dev/qubes_dom0/vm-debian-9-tmp-root +dev=$(basename $(readlink /dev/YOUR_LVM_VG/YOUR_LVM_IMAGE)) +qubesdb-write /qubes-block-devices/$dev/desc "YOUR_LVM_IMAGE" ``` -Example: - -``` -$:sudo parted /dev/windows-vg/vg-game-root unit B print -Model: Linux device-mapper (thin) (dm) -Disk /dev/dm-138: 314572800000B -Sector size(logical/physical): 512B/512B -Partition Table: msdos -Disk Flags: -Number Start End Size Type File system Flags -1 1048576B 105906175B 104857600B primary ntfs boot -2 105906176B 314571751423B 314465845248B primary ntfs -``` - -Then mount the partition you want: +2: Create a new disposable VM (dom0) ```bash -sudo mount -o loop,offset=105906176 -t ntfs /dev/windows-vg/vg-game-root /mnt/ +qvm-run -v --dispvm=YOUR_DVM_TEMPLATE --service qubes.StartApp+xterm & ``` + +3: Mount the partition you want to, and do what you want with it (disp) + +```bash +mount /dev/xvdiX /mnt/ +``` + +4: Umount and kill the VM (disp) +``` +umount /mnt/ +``` + +5: Remove the image from qubesdb (dom0) +``` +qubesdb-rm /qubes-block-devices/$dev/ +``` + +# References + +https://github.com/QubesOS/qubes-issues/issues/4687#issuecomment-451626625 From 79c63539c4fb2ecbd41443fd7e56206359169094 Mon Sep 17 00:00:00 2001 From: Yukikoo Date: Sat, 13 Apr 2019 06:25:57 +0000 Subject: [PATCH 3/4] Update and rename mount-hvm-disk.md to mount-lvm-image.md --- debugging/mount-hvm-disk.md | 43 ------------------------------- debugging/mount-lvm-image.md | 50 ++++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 43 deletions(-) delete mode 100644 debugging/mount-hvm-disk.md create mode 100644 debugging/mount-lvm-image.md diff --git a/debugging/mount-hvm-disk.md b/debugging/mount-hvm-disk.md deleted file mode 100644 index e7c9963e..00000000 --- a/debugging/mount-hvm-disk.md +++ /dev/null @@ -1,43 +0,0 @@ ---- -layout: doc -title: Mount LVM image -permalink: /doc/mount-lvm-image/ ---- - -# How to mount LVM image - -You want to read your LVM image (ex: you did some errors and can't start the VM ). - -1: make the image available for qubesdb. (dom0) - -```bash -# Example: /dev/qubes_dom0/vm-debian-9-tmp-root -dev=$(basename $(readlink /dev/YOUR_LVM_VG/YOUR_LVM_IMAGE)) -qubesdb-write /qubes-block-devices/$dev/desc "YOUR_LVM_IMAGE" -``` - -2: Create a new disposable VM (dom0) - -```bash -qvm-run -v --dispvm=YOUR_DVM_TEMPLATE --service qubes.StartApp+xterm & -``` - -3: Mount the partition you want to, and do what you want with it (disp) - -```bash -mount /dev/xvdiX /mnt/ -``` - -4: Umount and kill the VM (disp) -``` -umount /mnt/ -``` - -5: Remove the image from qubesdb (dom0) -``` -qubesdb-rm /qubes-block-devices/$dev/ -``` - -# References - -https://github.com/QubesOS/qubes-issues/issues/4687#issuecomment-451626625 diff --git a/debugging/mount-lvm-image.md b/debugging/mount-lvm-image.md new file mode 100644 index 00000000..2bdcc5ca --- /dev/null +++ b/debugging/mount-lvm-image.md @@ -0,0 +1,50 @@ +--- +layout: doc +title: Mount LVM image +permalink: /doc/mount-lvm-image/ +--- + +# How to mount LVM image + +You want to read your LVM image (ex: you did some errors and can't start the VM ). + +1: make the image available for qubesdb. + +```bash +# Example: /dev/qubes_dom0/vm-debian-9-tmp-root +[user@dom0]$ dev=$(basename $(readlink /dev/YOUR_LVM_VG/YOUR_LVM_IMAGE)) +[user@dom0]$ qubesdb-write /qubes-block-devices/$dev/desc "YOUR_LVM_IMAGE" +``` + +2: Create a new disposable VM + +```bash +[user@dom0]$ qvm-run -v --dispvm=YOUR_DVM_TEMPLATE --service qubes.StartApp+xterm & +``` + +3: Attach the device to your newly created disp VM + +From the GUI, or from the command line: +```bash +[user@dom0]$ qvm-block attach NEWLY_CREATED_DISPVM dom0:$dev +``` + +4: Mount the partition you want to, and do what you want with it + +```bash +[user@dispXXXX]$ mount /dev/xvdiX /mnt/ +``` + +5: Umount and kill the VM +``` +[user@dispXXXX]$ umount /mnt/ +``` + +6: Remove the image from qubesdb +``` +[user@dom0]$ qubesdb-rm /qubes-block-devices/$dev/ +``` + +# References + +https://github.com/QubesOS/qubes-issues/issues/4687#issuecomment-451626625 From 375b7db2a4e7bb8ca610cbb433443eaae0c4caf4 Mon Sep 17 00:00:00 2001 From: Yukikoo Date: Sat, 13 Apr 2019 16:26:39 +0000 Subject: [PATCH 4/4] Update doc.md add link to "mount-lvm-image" --- doc.md | 1 + 1 file changed, 1 insertion(+) diff --git a/doc.md b/doc.md index 67e80e46..279e8484 100644 --- a/doc.md +++ b/doc.md @@ -264,6 +264,7 @@ redirect_from: * [VM-dom0 internal configuration interface](/doc/vm-interface/) * [Debugging Windows VMs](/doc/windows-debugging/) * [Safe Remote Dom0 Terminals](/doc/safe-remote-ttys/) + * [Mount LVM Image](/doc/mount-lvm-image/) ### Building