ntfsclone: support writing a ddrescue domain mapfile #40
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
ntfsclone's rescue mode has (at least) two shortcomings:
ddrescue does those things, but it has no knowledge of the volume structure, so it can't save just the allocated sectors. But it does support using a "domain mapfile" to denote the sectors to read. This commit adds a
-D
option to ntfsclone that writes a domain mapfile covering the allocated sectors.partclone can also write a domain mapfile, but it only looks at
$Bitmap
, so if there are allocated clusters not in the bitmap (which I've found to be oddly common) it won't save all the data. (Also it has other problems with NTFS.) The unmaintained ddrutility package can also write a domain mapfile, but it's unmaintained.I can't recommend merging this. The way I implemented this is pretty dumb, so after walking the volume, ntfsclone spends nearly all of its time in lseek (once seeking to where it wants to read, then calling it again to get the current file position). Adding another mode also adds more tricky conditionals to a program already full of them. A "proper" implementation would or any extra allocated clusters into the main bitmap and just scan through it. But this may still be useful to others.