README.md 4.2 KB

RU: Скрипт снятия образа данных через утилиту ntfsclone с носителей XEN\KVM с максимальным сжатием данных
Параметры использования скрипта задаются в секции manual_parameters
для скрипта необходим пакет dialog.

для получения необходимых параметров скрипта - пример:

losetup /dev/loop1 /kvm/win7x64/disk_c.img
losetup -a
dev/loop0: [2055]:2103175 (/kvm/win7x64/disk_c.img)

fdisk -l /dev/loop0

Disk /dev/loop0: 80 GiB, 85899345920 bytes, 167772160 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x677d5646
Device        Boot  Start       End   Sectors  Size Id Type
/dev/loop0p1 *      2048    206847    204800  100M  7 HPFS/NTFS/exFAT
/dev/loop0p2      206848 167770111 167563264 79,9G  7 HPFS/NTFS/exFAT

у нас на образе 2 раздела.
каждый раздел это: sda1 и sda2
смещение для каждого раздела получаем вычислением:

sda1 offset:( 512 х 2048 = 1048576 )
sda2 offset:( 512 x 206848 = 105906176 )

результат вносим в раздел скрипта manual_parameters
теперь скрипт сможет сам как сохранять так и восстанавливать данные с образа виртуальной машины.

Пожалуйста обратите внимание, параметры скрипта это массивы, вносите изменения так же как в исходном коде,
скрипт всегда опрашивает значения как массив, независисмо одно значение или более.

Внимание!!
До начала использования скрипта рекомендую предварительно сделать копию файла образа (пример : /kvm/win7x64/disk_c.img)
и только если все прошло успешно, копию можно удалить.
Диалог скрипта поддерживает 2 языка: RU и EN


EN: A script to extract a data image via the ntfsclone utility from XEN \ KVM with maximum data compression
Parameters for using the script are specified in section manual_parameters
for the script you need the package dialog.

to get the necessary parameters of the script - an example:

losetup /dev/loop1 /kvm/win7x64/disk_c.img
losetup -a
dev/loop0: [2055]:2103175 (/kvm/win7x64/disk_c.img)

fdisk -l /dev/loop0

Disk /dev/loop0: 80 GiB, 85899345920 bytes, 167772160 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x677d5646
Device        Boot  Start       End   Sectors  Size Id Type
/dev/loop0p1 *      2048    206847    204800  100M  7 HPFS/NTFS/exFAT
/dev/loop0p2      206848 167770111 167563264 79,9G  7 HPFS/NTFS/exFAT

at us on an image of 2 sections.
each partition is: sda1 and sda2
the offset for each section is obtained by computing:

sda1 offset :( 512 x 2048 = 1048576)
sda2 offset :( 512 x 206848 = 105906176)

the result is added to the section of the script manual_parameters
Now the script itself can both save and restore data from the virtual machine image.

Please note, the script settings are arrays, make the changes as well as in the source code,
The script always interrogates values as an array, independently one value or more.

Attention!!
Before using the script, I recommend that you first make a copy of the image file (example: /kvm/win7x64/disk_c.img)
and only if everything went well, a copy can be deleted.
The script dialog supports 2 languages: RU and EN