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

stdout support #183

Merged
merged 1 commit into from Apr 19, 2022
Merged

Conversation

hdkigelcojp
Copy link
Contributor

Previously lseek() was always used for an output device file when
restoring or copying device-to-device. With this patch, stdout is
supported by writing zeros instead of lseek() only if stdout is
specified as output.

@Thomas-Tsai
Copy link
Owner

Hi,
I have a question about this patch. Why your output is stdout/pipe?
what is your command to run partclone with pipe or device-to-device?
did you try to run with the -W option, e.g., partclone.apfs -d -b -W -s macmini -o macmini2

    -W   --restore_raw_file create a special raw file for the loop device

@hdkigelcojp
Copy link
Contributor Author

The reason of stdout/pipe is that a command we are implementing needs pipe.

https://bitbucket.org/vthrii/vhd-utilities/src/master/

The vhd-create.pl command creates a vhd disk image from a raw disk device. If free space of file systems is cleared, the disk image size is reduced. Previously free space was cleared manually before creating disk images to reduce the size, but it sometimes took a long time. We recently implemented clearing free space feature for ntfs partitions using ntfsclone command which already supports stdout/pipe output. The vhd-create.pl command internally runs ntfsclone and uses its output instead of a raw disk device as a source for specified ntfs partitions. If free space is enough big, the output of zeros for free space is consumed within the vhd-create.pl command on memory and not written to the disk image. If Partclone supports stdout/pipe like ntfsclone, the feature can support other filesystems.

@Thomas-Tsai
Copy link
Owner

Thanks. I understand your scenario now.

Is it possible to move skip_bytes/skip_blocks functions to partclone.c ?
That would be good for us to maintain the code in the feature!

Previously lseek() was always used for an output device file when
restoring or copying device-to-device.  With this patch, stdout is
supported by writing zeros instead of lseek() only if stdout is
specified as output.
@hdkigelcojp
Copy link
Contributor Author

I moved the functions to partclone.c. Are the function names still good? Or should I change them to like skip_output_bytes/skip_output_blocks?

@Thomas-Tsai Thomas-Tsai merged commit 4fed91c into Thomas-Tsai:master Apr 19, 2022
@Thomas-Tsai
Copy link
Owner

Hi,
The name is fine and clear. Thanks for your contribution, and that makes partclone better than before.

Thank you very much.

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

2 participants