software:ntfsclone
Differences
This shows you the differences between two versions of the page.
software:ntfsclone [2021/03/07 23:48] – created rodolico | software:ntfsclone [2021/03/08 00:18] (current) – rodolico | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== ntfsclone ====== | ====== ntfsclone ====== | ||
+ | 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 an NTFS file system but, it only works on //file systems// (not block devices), so you have to go through some additional steps if you want the entire disk backed up. The following is an example of backing up everything you need for recovery. | ||
- | DO NOT USE, NOT READY YET. | + | It assumes we are shutting down a Windows 10 workstation, |
- | + | ||
- | 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, | + | |
<code bash> | <code bash> | ||
Line 14: | Line 11: | ||
xl top | xl top | ||
# ok, it is gone, now create snapshots | # ok, it is gone, now create snapshots | ||
- | lvcreate -s -L 10G -n snap.win_test.disk0 / | + | lvcreate -s -L 10G -n snap.win_test.disk / |
- | lvcreate -s -L 10G -n snap.win_test.disk1 / | + | # we have our snapshot, so we can start win_test back up |
- | # we have our snapshot, so start win_test back up | + | |
xl create / | xl create / | ||
# create a directory for all our stuff | # create a directory for all our stuff | ||
mkdir -p / | mkdir -p / | ||
- | # get disk sizes | + | # get disk size |
- | lvs | grep win_test.disk? > / | + | lvs | grep win_test.disk > / |
# get partitioning | # get partitioning | ||
- | for disk in 0 1 | + | sfdisk -d /dev/vg0/snap.win_test.disk > / |
- | do | + | # get MBR and bootloader |
- | # get partition scheme | + | dd if=/ |
- | sfdisk -d / | + | |
- | | + | |
- | | + | |
- | done | + | |
# get domain configuration | # get domain configuration | ||
cp -av / | cp -av / | ||
- | # Do the actual copy | + | # break apart the image. kpartx will create a separate entry in /dev/mapper for each |
- | # get partition | + | # partition |
- | fdisk -l / | + | # so we can use it below |
- | # for every parition, | + | kpartx |
- | ntfsclone --save-image --output - /dev/vg0/win_test.disk0# | + | # do this for each partition defined by kpartx. Replace |
+ | ntfsclone --save-image --output - /dev/mapper/ | ||
+ | # redo the ntfsclone for each partition, changing the name on input | ||
+ | # and partition number on the output file. | ||
+ | # | ||
+ | # we're done, so clean up | ||
+ | # remove the kpartx entries in / | ||
+ | kpartx -dv / | ||
+ | lvremove -f / | ||
</ | </ | ||
+ | Some points on the process | ||
+ | * If you don't know how much space is going to be used, ntfsresize will give it to you if you just use the --info flag. The number will be off by about 2%, but it helps. <code bash> | ||
+ | * You do not have to use pbzip2. I like it because it uses all processors, and the syntax is easier than xz (which may give you better compression), | ||
+ | * kpartx is really, really useful. Instead of manually doing offsets into an image, kpartx will simply create multiple entries in / | ||
+ | * If you're running Linux, it is very possible to script this. kpartx has a specific name it uses for its mappings, and xl or virsh can give you the full paths to the block devices. | ||
+ | ===== Links ===== | ||
- | ntfsresize --info | + | * https:// |
software/ntfsclone.1615182481.txt.gz · Last modified: 2021/03/07 23:48 by rodolico