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

imagemount v0.4.2 does not work for all NTFS, many ext4 filesystems #2

Open
shasheene opened this issue Nov 19, 2020 · 3 comments
Open

Comments

@shasheene
Copy link

Hi George,

As part of my work on the Rescuezilla "Image Explorer" graphical frontend, I am evaluating, consolidating and improving partclone-util's imagemount tool.

As best I can tell, due to a bug in partclone-utils it's not actually possible to mount an NTFS filesystem for both partclone v1 images, and partclone v2 images. The imagemount command returns success, but trying to mount the /dev/nbd1 device produces an error such as:

Launched in daemon mode: All logging output being written to the system log.
Failed to read last sector (4030): Invalid argument
HINTS: Either the volume is a RAID/LDM but it wasn't setup yet,
   or it was not setup correctly (e.g. by not using mdadm --build ...),
   or a wrong device is tried to be mounted,
   or the partition table is corrupt (partition is smaller than NTFS),
   or the NTFS boot sector is corrupt (NTFS size is not valid).
Failed to mount '/dev/nbd1': Invalid argument
The device '/dev/nbd1' doesn't seem to have a valid NTFS.
Maybe the wrong device is used? Or the whole disk instead of a
partition (e.g. /dev/sda, not /dev/sda1)? Or the other way around?
mount reported error

I have raised this bug with the upstream project partclone utils ticket #3, but since you're the author of the partclone image format v2 support in partclone-util's imagemount I think you (and any users cloning or forking this repository) may be interested.

I guess it makes sense to keep the bulk of the discussion on partclone utils ticket #3. I've created Sourceforge Merge Request #5 to provide a reproducible test case.

I'm hoping you might have some insights that could save me time, but if not I will try and debug it myself.

Also, you may be interested in checking out Sourceforge Merge Request #6, there were two other independent implementations of mounting partclone image format v2, each apparently not knowing about the others.

@prekageo
Copy link
Owner

prekageo commented Nov 21, 2020

Hi Shasheen,

I did a little bit of testing and it seems that partclone.ntfs is not cloning everything. Specifically, your input file /tmp/raw-fs-image is 2063872 bytes and the size of /dev/nbd1 is 2060288. That is a difference of 7 * 512 bytes = 4096 - 512 bytes.

You can also see the difference by doing the following:

diff <(hexdump -C /tmp/raw-fs-image) <(sudo dd if=/dev/nbd1 | hexdump -C)

This observation matches the error message which complains that it cannot read the last sector because partclone.ntfs did not copy it.

@shasheene
Copy link
Author

shasheene commented Nov 21, 2020

Interesting. Thanks for the advice. It sounds like this might be a problem with the test case parameters rather than the utility. I'll continue to investigate.

By the way, I am currently expanding your very useful test.sh script to mount the raw filesystem image to create small test file before the creating the partclone image, then comparing the md5sum hash. I also was intending on compiling partclone with support for other filesystems enabled, and adding test cases for the corresponding filesystems.

@shasheene
Copy link
Author

Just to provide an update on this for anybody coming across this issue: there is active discussion and investigation of this issue happening on ticket #3 of the partclone-utils Sourceforge project.

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

No branches or pull requests

2 participants