My dd Python script works

#!/usr/bin/env python
import subprocess, sys
from datetime import datetime
backup_folder = "/media/xxx/Windows_10_backup"
if len(sys.argv) != 2:
    print("No input drive")
    exit(0)
if_file = sys.argv[1]
d = str(datetime.now().date())
splitter = if_file.split("/")
out_file = backup_folder + "/" + d + "_" + splitter[len(splitter) - 1] + ".img"
subprocess.call('dd if=' + if_file + ' of=' + out_file + ' status=progress', shell=True)

For backing up Windows. If you use partimage, you have to manually do each partition. Might be faster though. Can you run partimage without the GUI?

How do you get all partitions in Python from a drive? You can use fdisk -l /dev/xxx to list em, but it looks like a pain to try and get the drives, with all the other text.

I forgot the command that you can use from a terminal.

Update

Uses partimage now, script below.

#!/usr/bin/env python
import subprocess, sys, re
from datetime import datetime
backup_folder = "/media/xxx/Windows_10_backup"
if len(sys.argv) != 2:
    print("No input drive")
    exit(0)
if_file = sys.argv[1]
d = str(datetime.now().date())
fdisk = subprocess.run('fdisk -l ' + if_file, stdout=subprocess.PIPE, shell=True)
fdisk = fdisk.stdout.decode().strip()
parts = re.findall(r'(^/dev/sda\d)', str(fdisk), re.MULTILINE)
for p in parts:
    splitter = p.split("/")
    out_file = backup_folder + "/" + d + "_" + splitter[len(splitter) - 1] + ".partimg"
    subprocess.call('partimage -b -d save ' + p + ' ' + out_file, shell=True)

Uses batch mode, so you don’t have to click enter on each partition. No need for Macrium Reflect now.

See, you can do everything in Linux, for free. It’ll only take two hours, possibly slower then Macrium Reflect.