Utility to extract files from images¶
Installing¶
Important
First need to do setting up the environment. All commands are executed only from superuser.
Mode superuser:
sudo -i
Install required system packages:
apt install python3-guestfs
Install
virt-extract
:pip3 install virt-extract
Note
To install utility on Astra Linux (Smolensk) do following:
Connect the provided repository with AccentOS packages.
Install the package with the command:
sudo apt install -y aos-virt-extract
Utility description¶
virt-extract
is console utility for extracting files from image. Utility allows to save the hierarchy of paths of the extracted files. Functional of utility is need for correct work of module AppLevel.
Parameter | Description |
---|---|
-h , --help |
Help output. Optional parameter. |
-a |
Path to the image. |
-d |
Instance name (libvirt domain). |
file|dir |
Path to files or directories inside image. |
localdir |
Local directory where files and directories will be extracted. |
--ignore-missing |
Flag to ignore errors about the absence of the specified files inside the image. Optional parameter. |
-v |
Enabling verbose output. Optional parameter. |
Examples of using¶
Extracting files by instance name¶
Command:
virt-extract -d instance-00000010 /etc/cirros/version /home /tmp/backup
Directory /tmp/backup
structure after command execution:
/tmp/backup/
├── etc
│ └── cirros
│ └── version
└── home
├── cirros
│ ├── .profile
│ ├── .shrc
│ └── .ssh
│ └── authorized_keys
└── ftp
Extracting files indicating the path to the image¶
Command:
virt-extract -a instance-00000010 /etc/cirros/version /home/cirros /tmp/backup