Advertisement
xe1phix

Xe1phix-[QCow2]-Cheatsheet-[v2.5.85].sh

Nov 10th, 2022
1,532
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.15 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3.  
  4. ##-==========================================-##
  5. ##   [+] Create a QCow2 image from a HDD
  6. ##-==========================================-##
  7. e2image -Q /dev/sda1 $Image.qcow2
  8.  
  9.  
  10. ##-================================================-##
  11. ##   [+] Convert a QCow2 image into a Raw image
  12. ##-================================================-##
  13. e2image -r $Image.qcow2 $Image.raw
  14.  
  15.  
  16. ##-=================================================-##
  17. ##   [+] Mount A QCOW2 Image:
  18. ##-=================================================-##
  19. qcowmount $File.qcow2 /mnt/qcowimage/
  20.  
  21.  
  22. ##-=================================================-##
  23. ##   [+] Pass "allow_root" to the fuse subsystem:
  24. ##-=================================================-##
  25. qcowmount -X allow_root $File.qcow2 /mnt/qcowimage/
  26.  
  27.  
  28. ##-=================================================-##
  29. ##   [+] Unmount /mnt/qcowimage/ Using umount:
  30. ##-=================================================-##
  31. unmount /mnt/qcowimage/
  32.  
  33.  
  34. ##-=================================================-##
  35. ##   [+] Unmount /mnt/qcowimage/ Using fusermount:
  36. ##-=================================================-##
  37. fusermount -u /mnt/qcowimage/
  38.  
  39.  
  40. ##-========================================================================-##
  41. ##   [+] Create a new image, read/write snapshot of the original image:
  42. ##-========================================================================-##
  43. qemu-img create -f qcow2 -b $File.img snapshot.img
  44.  
  45.  
  46. ##-==========================================-##
  47. ##   [+] Determine an images backing file
  48. ##-==========================================-##
  49. qemu-img info $File.img
  50.  
  51.  
  52. ##-=================================================================-##
  53. ##                  [+] Temporary snapshots
  54. ##-=================================================================-##
  55. ## ----------------------------------------------------------------- ##
  56. ##   [?] any changes made to the virtual machine while it is
  57. ##       running are written to temporary files and thrown away
  58. ##       when the virtual machine is turned off
  59. ## ----------------------------------------------------------------- ##
  60. qemu -hda $File.img -snapshot
  61.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement