Le blog de Jean David TECHER, un Réunionnais à Saint-Priest/Lyon

Aller au contenu | Aller au menu | Aller à la recherche


jeudi 2 novembre 2017

Use LVM to back up and restore Virtual Machine

I am currently spending my nights on testing ReactOS with Qemu 2.10.1+ KVM + VFIO. It is a good idea to have the iso to reinstall the system. All my drivers are already available on the iso. BUT I am under the impression to waste my time while recovering a virtual machine from scratch. Here LVM and snapshot are helpful

  • Check the volum for the current machine
    root@kvm-ReactOS:~# lvdisplay kvm-ReactOS-vg/ReactOS
      --- Logical volume ---
      LV Path                /dev/kvm-ReactOS-vg/ReactOS
      LV Name                ReactOS
      VG Name                kvm-ReactOS-vg
      LV UUID                XFDmtn-e2mQ-urGk-1EhV-85eZ-LcCv-v3qRi3
      LV Write Access        read/write
      LV Creation host, time kvm-ReactOS, 2017-11-02 03:00:29 +0100
      LV Status              available
      # open                 0
      LV Size                10,00 GiB
      Current LE             2560
      Segments               1
      Allocation             inherit
      Read ahead sectors     auto
      - currently set to     256
      Block device           252:7
    
  • Once you are happy with the current installation that it is time to create a backup using a snapshot from LVM system. I took the exact same size, 10GB.
    root@kvm-ReactOS:~# lvcreate -L10GB -s -n ReactOS_snapshot /dev/kvm-ReactOS-vg/ReactOS
      Using default stripesize 64,00 KiB.
      Logical volume "ReactOS_snapshot" created.
    
  • Later... - after doing some tests -.... on the current virtual machine, you can check its status using lvs
    root@kvm-ReactOS:~# lvs
      LV               VG             Attr       LSize  Pool Origin  Data%  Meta%  Move Log Cpy%Sync Convert
      ReactOS          kvm-ReactOS-vg owi-aos--- 10,00g                                                     
      ReactOS_good     kvm-ReactOS-vg -wi-a----- 10,00g                                                     
      ReactOS_snapshot kvm-ReactOS-vg swi-a-s--- 10,00g      ReactOS 21,69                                  
      home             kvm-ReactOS-vg -wi-ao---- 50,00g                                                     
      root             kvm-ReactOS-vg -wi-ao---- 23,28g                                                     
      swap_1           kvm-ReactOS-vg -wi-ao----  5,74g                                                     
      tmp              kvm-ReactOS-vg -wi-ao----  1,86g                                                     
      var              kvm-ReactOS-vg -wi-ao----  9,31g                                                     
    
  • If something gets wrong then you can to restore the snapshot
    root@kvm-ReactOS:~# lvconvert --merge /dev/kvm-ReactOS-vg/ReactOS_snapshot
      Merging of volume kvm-ReactOS-vg/ReactOS_snapshot started.
      ReactOS: Merged: 78,34%
      ReactOS: Merged: 80,99%
      ReactOS: Merged: 83,68%
      ReactOS: Merged: 86,55%
      ReactOS: Merged: 88,85%
      ReactOS: Merged: 89,71%
      ReactOS: Merged: 89,78%
      ReactOS: Merged: 91,20%
      ReactOS: Merged: 93,94%
      ReactOS: Merged: 96,54%
      ReactOS: Merged: 99,06%
      ReactOS: Merged: 100,00%
    
Keep it mind that
  • Snapshot will be destroyed once original volume has been restored
  • You may have to regenerate a new snapshot as backup -- if required --
Source: https://www.tecmint.com/take-snapshot-of-logical-volume-and-restore-in-lvm/

Get meta-information about DLL file or EXE from Linux [ExifTool]

I am currently working on building a version of d3d9.dll provided by Google which should work on ReactOS. From my main Linux workstation, I wanted to get meta-information from the d3d9.dll file. Doing some search on Internet, I found a pretty perl script Exiftool

Installation

Return metainformation

Let's test the recent file d3d9.dll built from a virtual machine. I've just copied the file on my Linux workstation
david@amdgaming:/opt/Builds/wine/data/tmp/Telechargements/Duck_old/Release$ exiftool d3d9.dll
ExifTool Version Number         : 10.65
File Name                       : d3d9.dll
Directory                       : .
File Size                       : 4.3 MB
File Modification Date/Time     : 2017:11:01 04:23:02+01:00
File Access Date/Time           : 2017:11:01 04:23:20+01:00
File Inode Change Date/Time     : 2017:11:01 04:23:02+01:00
File Permissions                : rwxrwxr-x
File Type                       : Win32 DLL
File Type Extension             : dll
MIME Type                       : application/octet-stream
Machine Type                    : Intel 386 or later, and compatibles
Time Stamp                      : 2017:11:01 03:09:50+01:00
PE Type                         : PE32
Linker Version                  : 14.11
Code Size                       : 3400704
Initialized Data Size           : 1171968
Uninitialized Data Size         : 0
Entry Point                     : 0x82422
OS Version                      : 5.1
Image Version                   : 0.0
Subsystem Version               : 5.1
Subsystem                       : Windows GUI
File Version Number             : 3.3.0.2
Product Version Number          : 3.3.0.2
File Flags Mask                 : 0x001f
File Flags                      : Private build
File OS                         : Win32
Object File Type                : Dynamic link library
File Subtype                    : 0
Language Code                   : English (U.S.)
Character Set                   : Unicode
Company Name                    : Google Inc.
File Description                : SwiftShader Direct3D 9 Renderer
File Version                    : 3.3.0.2
Internal Name                   : D3D9
Legal Copyright                 : Copyright (C) 2016 Google Inc.
Original File Name              : d3d9.dll
Private Build                   : 2
Product Name                    : SwiftShader Direct3D 9 Renderer
Product Version                 : 3.3.0.2