All Projects → dyorgio → apfs-clone-checker

dyorgio / apfs-clone-checker

Licence: MIT license
An utility to check if two files are clones in macOs APFS.

Programming Languages

c
50402 projects - #5 most used programming language

Projects that are alternatives of or similar to apfs-clone-checker

OpenGnsys
OpenGnsys (pronounced Open Genesis) is a free and open source project that provides tools for managing and deploying different operating systems.
Stars: ✭ 15 (-50%)
Mutual labels:  filesystem, cloning
linux-apfs-rw
APFS module for linux, with experimental write support
Stars: ✭ 190 (+533.33%)
Mutual labels:  filesystem, apfs
paragon apfs sdk ce
Paragon APFS SDK Free
Stars: ✭ 97 (+223.33%)
Mutual labels:  filesystem, apfs
django-clone
Controlled Django model instance replication.
Stars: ✭ 89 (+196.67%)
Mutual labels:  clone, cloning
apfs
Package apfs implements an Apple File System(apfs) bindings for Go
Stars: ✭ 30 (+0%)
Mutual labels:  filesystem, apfs
Netflix
Netflix in React
Stars: ✭ 16 (-46.67%)
Mutual labels:  clone, cloning
datoteka
A filesystem toolset and storage implementation for Clojure.
Stars: ✭ 59 (+96.67%)
Mutual labels:  filesystem
cloudstore
简易分布式云存储服务
Stars: ✭ 22 (-26.67%)
Mutual labels:  filesystem
fatx
Original Xbox FATX Filesystem Library, Python bindings, FUSE driver, and GUI explorer
Stars: ✭ 87 (+190%)
Mutual labels:  filesystem
sgfs
🚀Simple http file server. A open source file server, implement by golang that can be used to upload and download files. Simple to deploy, simple to use. 中文介绍:
Stars: ✭ 51 (+70%)
Mutual labels:  filesystem
dropbox-fs
📦 Node FS wrapper for Dropbox
Stars: ✭ 35 (+16.67%)
Mutual labels:  filesystem
pyFileManager
This script lets you automatically relocate files based on their extensions. Very useful from the downloads folder !
Stars: ✭ 22 (-26.67%)
Mutual labels:  filesystem
ffiler
File Filer; sort files into structured directory tree. Tree can be structured based on various designs such as date (file modification time), file hash, file prefix etc
Stars: ✭ 45 (+50%)
Mutual labels:  filesystem
Gmail-Clone
Gmail Clone using flutter
Stars: ✭ 82 (+173.33%)
Mutual labels:  clone
GitFS
A FUSE filesystem that stores data on Git
Stars: ✭ 26 (-13.33%)
Mutual labels:  filesystem
kafka-connect-fs
Kafka Connect FileSystem Connector
Stars: ✭ 107 (+256.67%)
Mutual labels:  filesystem
Django-WebApp
This is a web-app created using Python, Django. By using this user can login, upload files and also can view and download files uploaded by other users.
Stars: ✭ 285 (+850%)
Mutual labels:  filesystem
go-clone
Clone any Go data structure deeply and thoroughly.
Stars: ✭ 182 (+506.67%)
Mutual labels:  clone
fileutils
Golang file system utils such as copy files and directories
Stars: ✭ 19 (-36.67%)
Mutual labels:  filesystem
arch-btrfs-install-guide
Arch Linux installation guide with btrfs and snapper, this guide is based on the information from unicks.eu guide https://www.youtube.com/watch?v=TKdZiCTh3EM, and Arch Linux UEFI step-by-step installation guide https://www.youtube.com/watch?v=dOXYZ8hKdmc from ALU.
Stars: ✭ 32 (+6.67%)
Mutual labels:  filesystem

apfs-clone-checker

An utility to check if two files are clones in macOs APFS.

How it works (and motivation)

Some years ago (2017-09-26) I asked in stackoverflow and in Apple Developer Forum if there is a way to identify if a file is a clone.

3 years later, no response or update of macOs tools to get this.

My motivation, like others who also want an answer ( I guess 😄 ), is create a tool that analyze entire disk and create clones of files with same content. (use clone APFS feature at maximum possible).

Many tools are created in this space of time, but all of then works creating hash of file content (expensive operation).

This tool use another aproach: file blocks physical location.

All cloned files point to the same blocks, this utility get this info from both files and compare.

It also make some validations and fast checking:

  • Both files are in an APFS device.
  • Files are in same device.(CLONE only supported in same device)
  • Files are normal files.
  • Files are not the same.
  • Files have same size and blocks count.

In initial tests it can speedup clone checking in at least 200% (compared with shasum or md5) full file verification.

But the optimization is much better for no full cloned files, it can stops on first different block, and it can be the first one 🤓.

Usage

./clone_checker [-fqv] pathOfFileA pathOfFileB

If exit code 0 (OK) than print in stdout:

  • 1 = Clones
  • 0 = Not clones (maybe partial if -q option is used)

If exit code not 0 (NOK) than:

  • Print in stderr what was the problem.

Options

  • -f (forced mode): Ignore read/validation errors and return 0 (not clones).
  • -q (quick mode): Just verify first and last blocks (fast, but not 100%).
  • -v: Print version.
  • -?,h: Print usage.

Compilation

Have gcc installed (XCode).
Copy clone_checker.c (or content) to your computer.
Run gcc:

gcc clone_checker.c -o clone_checker

Optional (mark binary executable):

chmod +x clone_checker

Work TODO

  • Investigate about directory cloning. 2021-11-24 - Not supported, directories are always new inodes, but files inside can be all clones.
  • Investigate how to get j_inode_flags and check INODE_WAS_CLONED flag (optimization) Apple APFS Reference 2020-12-12 - To get it is necessary to use reverse engineer and parse all device fs structure.
  • Support to percentual of clone mode (A clone can have only some blocks altered).
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].