Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

macOS - '/System/Volumes/Data' DiskDevice path remapping #162

Merged
merged 3 commits into from
Sep 9, 2022
Merged

macOS - '/System/Volumes/Data' DiskDevice path remapping #162

merged 3 commits into from
Sep 9, 2022

Conversation

kapitainsky
Copy link
Contributor

Fixes #158

On macOS APFS disk all users' data is mounted in '/System/Volumes/Data' but fused transparently using firmlinks and presented as part of the root filesystem. It requires remapping Data volume path for this DiskDevice to '/' in order for fclones correctly recognise device deduplicated files are on.

Ref:

https://www.swiftforensics.com/2019/10/macos-1015-volumes-firmlink-magic.html

https://eclecticlight.co/2020/01/23/catalina-boot-volumes/

Fixes #158

On macOS APFS disk all users' data is mounted in '/System/Volumes/Data' but fused transparently using firmlinks and presented as part of the root filesystem.
It requires remapping Data volume path for this DiskDevice to '/' in order for fclones correctly recognise device deduplicated files are on.

Ref: 

https://www.swiftforensics.com/2019/10/macos-1015-volumes-firmlink-magic.html

https://eclecticlight.co/2020/01/23/catalina-boot-volumes/
@kapitainsky
Copy link
Contributor Author

Not sure what is wrong with my format....

@kapitainsky
Copy link
Contributor Author

Formatting fixed.

src/device.rs Outdated
Comment on lines 257 to 259
if cfg!(target_os = "macos") {
if String::from_utf8_lossy(d.file_system()) == "apfs"
&& d.mount_point().to_string_lossy() == "/System/Volumes/Data"
Copy link
Owner

@pkolaczk pkolaczk Sep 9, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This condition can be flattened and slightly simplified:

if cfg!(target_os = "macos") 
   && d.file_system() == b"apfs"
   && d.mount_point().to_str() == Some("/System/Volumes/Data") {
   result.mount_points.push((Path::from("/"), index));
} else {
    result
        .mount_points
        .push((Path::from(d.mount_point()), index));
}

and remove the repetition of the else clause.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you are right. I have not written any code for long... and also not used github as you can see by small mess I created. But things are coming back quickly.

Doing it now.

Copy link
Owner

@pkolaczk pkolaczk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! Looks good. Just remove the repetition in the code and I'll merge.

@kapitainsky
Copy link
Contributor Author

Done and all grenn

@pkolaczk pkolaczk merged commit 16af293 into pkolaczk:master Sep 9, 2022
@kapitainsky kapitainsky deleted the macOSfirmlink branch September 9, 2022 19:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

on 8 cores CPU fclones seems not to use all cores
2 participants