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

Include the NTFS Boot Record backup in the cloned image #54

Conversation

pfrouleau
Copy link
Contributor

Include the NTFS Boot Record backup in the cloned image

This one depends on your view. A NTFS file system is 1 block smaller than the partition and a copy of the Boot Record is stored in the last sector of the partition. When we clone a NTFS file system, this extra block is not cloned. However, that block is created/modified by mkfs.ntfs, so it seem logical to include it in the image.

This commit update the code to include the extra block in the clone, by increasing the totalblock count and setting the last bit of the bitmap. This have the following effect: the restored file system have the same checksum than the original one. And if we restore the image on a partition with identical geometry than the original, we do not need to run ntfsfixboot.

@ghost ghost mentioned this pull request Dec 20, 2015
@pfrouleau
Copy link
Contributor Author

Hi @Thomas-Tsai,

it seems this pull request has not been merged into Partclone. I think it could fix the issue described in this thread:
https://forums.linuxmint.com/viewtopic.php?p=1891126#p1891126
(See the section about the 8GB partition at the bottom)

Maybe I should create a new pull request. This one is very old.

@shasheene
Copy link

Further references:

Description on the partclone-utils project for mounting partclone images: https://sourceforge.net/p/partclone-utils/tickets/3/
and also relevant is this comment from on a partclone-utils fork: prekageo/partclone-utils#2 (comment)

@shasheene
Copy link

shasheene commented Feb 10, 2021

Maybe I should create a new pull request. This one is very old.

@pfrouleau, no need to create a new PR. Instead you can very easily "rebase" your change onto the latest partclone git commit, then update this Pull Request. I have tested the following instructions (except the sanity check and push step) and it works fine:

# Add this git respository as a remote
git remote add upstream https://github.com/Thomas-Tsai/partclone
git fetch upstream
git checkout review/include_NTFS_backup_boot_sector_in_the_image
# Apply your change on the latest partclone. There is no conflicts so your commit applies cleanly!
git rebase upstream/master

# Sanity check your changes still solve the issue, update the git commit message if necessary

# Push your changes to your GitHub fork, and to the correct remote branch.
# Since you cloned from your fork the remote will be "origin" (see `git remote -v` for more information).
# This push will automatically update this Pull Request. I believe you'll need to `--force` push here.
git push origin review/include_NTFS_backup_boot_sector_in_the_image

NTFS stores a copy of its Boot Record after the end of the volume, which is
1 block smaller than the partition. This commit updates the NTFS's totalblock
to include that block.

With this change, the md5sum of the restored floppy.raw is identical to
the md5sum of the cloned one.

Signed-off-by: Patrick Rouleau <pfrouleau@gmail.com>
@pfrouleau pfrouleau force-pushed the review/include_NTFS_backup_boot_sector_in_the_image branch from 6cd422f to 0398eff Compare February 12, 2021 02:07
@pfrouleau
Copy link
Contributor Author

@shasheene Thanks for pointing out the rebase, but I am "The git guy" at work. 😉 It is just that I am not used to Github. I manage our own server on-premise. I forgot the MR would be updated if I rebased my branch. And on a side note, I prefer to use '--force-with-lease' instead of '--force' itself. And since git 2.30, we now have '--force-if-includes'.

I had to amend my previous commit to get the code to compile after the rebase on master. pc_set_bit() got a new parameter in the meantime.

@Thomas-Tsai Thomas-Tsai merged commit 32d7495 into Thomas-Tsai:master Jun 21, 2024
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.

None yet

3 participants