As my family’s computers age into obsolescence I typically back up the disks, use shred to securely erase data from the disks, then donate or re-use the disks/computers.

My current technique for backing up the Windows disks is to mount the primary (non-boot) Windows partition, convert it to a squashfs filesystem, then squirrel that backup image away somewhere for safe keeping.

I like this technique because squashfs filesystems are highly compressed and read-only by default, which is exactly what I want for a Windows backup that I’ll probably never look at again.

See here an example of a Windows parition (using a free Windows VirtualBox development VM from Microsoft for the sake of demonstration).

Disk /dev/sda: 127 GiB, 136365211648 bytes, 266338304 sectors
Disk model: VBOX HARDDISK
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: 0x7986a060

Device     Boot     Start       End   Sectors   Size Id Type
/dev/sda1  *         2048    104447    102400    50M  7 HPFS/NTFS/exFAT
/dev/sda2          104448 265298036 265193589 126.5G  7 HPFS/NTFS/exFAT
/dev/sda3       265299968 266334207   1034240   505M 27 Hidden NTFS WinRE

The partition I care about is /dev/sda2. It’s only a piece of the puzzle, and backing it up alone would not be bootable, but all I care about is the user data so this is fine for my needs.

I mount the partition at /mnt/windows using ro (read-only) for safety.

mount -o ro /dev/sda2 /mnt/windows

Then I copy that data to a squashfs image.

mksquashfs /mnt/windows/ ~/backups/windows.backup.squashfs

The compressed squashfs backup is only ~16G, which is ideal considering the original partition size of 126.5G.

ubuntu@ubuntu:~$ ls -alh ~/backups/
total 16G
drwxr-xr-x 3 root root 4.0K Oct 12 01:28 .
drwxr-xr-x 1 root root  100 Oct 12 01:27 ..
drwx------ 2 root root  16K Oct 12 00:00 lost+found
-rw-r--r-- 1 root root  16G Oct 12 01:45 windows.backup.squashfs

It’s a good idea to mount the backup to verify the data looks intact.

ubuntu@ubuntu:~$ sudo mount ~/backups/windows.backup.squashfs /mnt/tmp/
ubuntu@ubuntu:~$ ls /mnt/tmp/
'$Recycle.Bin'  'Documents and Settings'   PerfLogs        'Program Files (x86)'   Recovery  'System Volume Information'   Windows        swapfile.sys
'$WinREAgent'    DumpStack.log.tmp        'Program Files'   ProgramData            Scripts    Users                        pagefile.sys

Note that the filesystem for the backup is read-only.

ubuntu@ubuntu:~$ sudo touch /mnt/tmp/test
touch: cannot touch '/mnt/tmp/test': Read-only file system

The data above looks right, as does the mount.

ubuntu@ubuntu:~$ mount
...
/home/will/backups/windows.backup.squashfs on /mnt/tmp type squashfs (ro,relatime)
...

Done!