User Tools

Site Tools


software:ntfsclone

This is an old revision of the document!


ntfsclone

DO NOT USE, NOT READY YET.

You can efficiently back up a Windows virtual domain (or, just a Windows server) from unix using the ntfsclone command. This only copies the used parts of a system, however, it only works on file systems (not block devices), so you have to go through some additional changes. The following is an example of backing up everything you need for recovery.

It assumes we are shutting down a Windows 10 workstation, using Xen. The Windows 10 machine is named 'win_test', and uses two Logical volumes, /dev/vg0/win_test.disk0 and /dev/vg0/win_test.disk1. We will be putting the output on a USB drive mounted on /mnt.

# shut down win_test
xl shutdown win_test
# wait until it actually goes away (press q to exit xl top)
xl top
# ok, it is gone, now create snapshots
lvcreate -s -L 10G -n snap.win_test.disk0 /dev/vg0/win_test.disk0
lvcreate -s -L 10G -n snap.win_test.disk1 /dev/vg0/win_test.disk1
# we have our snapshot, so start win_test back up
xl create /etc/xen/win_test.hvm
# create a directory for all our stuff
mkdir -p /mnt/win_test
# get disk sizes
lvs | grep win_test.disk? > /mnt/win_test/lvs.disks
# get partitioning
for disk in 0 1
do
   # get partition scheme
   sfdisk -d /dev/vg0/win_test.disk$disk > /mnt/win_test/win_test.disk$disk.sfdisk
   # get MBR and bootloader
   dd if=/dev/vg0/win_test.disk$disk of=/mnt/win_test/win_test.disk$disk.mbr+bootloader bs=512 count=63
done
# get domain configuration
cp -av /etc/xen/win_test.hvm /mnt/win_test/
# Do the actual copy
# get partition information from disk0
fdisk -l /dev/vg0/win_test.disk0
# for every parition, do the following (I use # to indicate the partition number)
ntfsclone --save-image --output - /dev/vg0/win_test.disk0#

ntfsresize –info /dev/sda1

software/ntfsclone.1615182481.txt.gz · Last modified: 2021/03/07 23:48 by rodolico