gfc-file compare

File and Disk cloning, benchmark, compare and hash utility

☂︎ Optimised for high performance and low CPU usage
☂︎ Locks disks for exclusive access while cloning
☂︎ Allows access to protected files bypassing security ACL

Command line options

Argumentgfc [file2] [-##]
-b -benchBenchmark read or write, also disables hash processing
-l -logUse with -b or -B for benchmark write to gfc-log.txt
-l -bBenchmark write 0x00 to gfc-log.txt
-l -BBenchmark write 0xff to gfc-log.txt
-q -quietSuppress messages to STDOUT, use when writing to STDOUT
-v -verboseOutput more debug messages to STDOUT
-md2 -md4 -md5 -sha1Calculate hash using: MD2 MD4 MD5 SHA1
-sha256 -sha384 -sha512Calculate hash using: SHA256 SHA384 SHA512
-c -compareCompare the entire file content: by default, the program displays
only the first difference and exits.
-p -peakCalculate peaks for 16 bit RAW audio files
-n -normalizeNormalise level for 16 bit RAW audio files
-tTry to assign each thread on it's own processor
-L -lock -dismountLock and dismount volumes or partitions (works only on Windows)
This asserts exclusive access and is important when clonning.
Linux: please umount all volumes manually, before accessing
a disk or partition.
-O -offlineTake disks offline (works only on Windows)
This asserts exclusive access and is important when clonning.
On Linux this notifies the system to scan the disk for changes
to the partition table, when the program exits.
-OOImplies -O. Leave disks offline when the operation is complete:
It is safe to detach any offline disk as soon as the program exits.
If all attached disks are offline, it is also safe to cut power to
the computer. Otherwise, use the shutdown command.
Warning:
Since cloning creates an exact copy, a clonned disk has the same
GUID as the source. It is important to never have two disks with
the same GUID attached and online at the same time. Otherwise the
system will change the GUID on one of the disks, which prevents
any system boot volume on it from being detected. Any operating
system on that disk will be left in a non-operational state, since
it does not know which volume contains its files. This state can
be recovered by editing the Windows registry: Boot the computer to
a working installation or Windows setup. Note the drive letter of
the system that needs to be recovered: e.g. D:
Start regedit, File, Load hive:
D:\Windows\System32\config\SYSTEM as sys.
Navigate to HKEY_LOCAL_MACHINE\SYSTEM\MountedDevices.
Edit \DosDevices\D:, and copy the hex data.
Navigate to HKEY_LOCAL_MACHINE\sys\MountedDevices.
Edit \DosDevices\C:, and replace the hex data with the copy from
the previous step. The system should now boot correctly.
-WriteCopy file1 to file2. Without this, a copmpare is performed.
-a -appendfile1 is appended at the end of file2
-r -resumeResume an interrupted copy. Implies -append.
-[0-9][0-9]Set number of buffers and page size, for example:
-4#Set number_of_buffers = 1 << 4 = 16
Higher values minimize the effect of disk speed variation
-#5Set page_size = 2MB << 5 = 64 MB
When accessing two files on the same disk, a value of 5 should
reduce the seek overhead and improve performance on spinning disks.
-P[0-9]Set page_size = 512 << 0..9, allows setting a small page size:
this could be very slow, but is useful when there is physical damage
to the media. Since unreadable blocks are skipped, setting this to
the sector size of the disk allows as much data as possible to be
recovered. Note that the default page size is 2 MB, so a deffective
sector of 512 bytes would cause the entire page to be skipped.
Example: Compare disk against image.img and calculate SHA256 hash
gfc /dev/sdb image.img -sha256              # Linux
gfc \\.\PhysicalDrive0 image.img -sha256    # Windows
Example: Compare volume against image.img on Linux
gfc /dev/sdb1 image.img
gfc /dev/disk/by-path/acpi-VMBUS:00-scsi-0:0:0:0 image.img
gfc /dev/disk/by-path/acpi-VMBUS:00-scsi-0:0:0:0-part1 image.img
gfc /dev/disk/by-partlabel/gvalkov image.img
Example: Compare volume against image.img on Windows
gfc \\.\d: image.img -md5
gfc \\.\globalroot\Device\Harddisk0\Partition1 image.img
gfc \\.\globalroot\Device\HarddiskVolume1 image.img
gfc \\.\Harddisk0Partition1 image.img
Example: Compress volume to d.img.7z and calculate SHA1 hash:

Use - or con as file name to read from STDIN or write to STDOUT.

gfc /dev/sdb1 - -Write -L -sha1 | 7z a -si -m0=LZMA2 -mx=7 -md=32m -mfb=128 d.img.7z
gfc \\.\d:    - -Write -L -sha1 | 7z a -si -m0=LZMA2 -mx=7 -md=32m -mfb=128 d.img.7z

Example: Restore volume from d.img.7z and calculate SHA1 hash:
7z x -so d.img.7z | gfc - /dev/sdb1 -Write -L -sha1   # Linux
7z x -so d.img.7z | gfc - \\.\d:    -Write -L -sha1   # Windows
Miscelaneous examples
gfc file.txt:stream1 -sha1  # sha1 hash for stream1 in file.txt
gfc image.img	            # creates hash of [image.img], SHA1 is the default hash algorithm
gfc -b -l                   # benchmark write performance 0x00 to [gfc-log.txt]
gfc -B -l                   # benchmark write performance 0xFF to [gfc-log.txt]
gfc \\.\d: -Write -L -b -l  # destroy data on vol [\\.\d:]
gfc src.raw dst.raw -n      # performs peak level audio normalization

This tool can utilise large memory page support to improve performance. The feature requires Windows 2003 or later, and the user must have the Lock pages in memory priviledge, which can be set in Local Security Policy, Local Policies, User Rights Assignment.

Supported Platforms

☂︎ Apple iOS, macOS
☂︎ FreeBSD
☂︎ Linux, OpenWRT
☂︎ Windows

Prerequisites and build instructions

© 2008-2023 Georgi Valkov

https://httpstorm.com/download/gfc-file-compare/