FAQ SearchLogin
Tuxera Home
View unanswered posts | View active topics It is currently Thu May 13, 2021 21:15



Post new topic Reply to topic  [ 4 posts ] 
cloning an NTFS image 
Author Message

Joined: Wed Oct 17, 2012 01:24
Posts: 3
Post cloning an NTFS image
Hi there,
I am experimenting with deploying machine images.
I would like to use a master NTFS image captured in Clonezilla, mount it, edit it, and put it back in Clonezilla format.
I would use this method to make different images for different fleets of devices.
Clonezilla format is needed as techs downstream from me are used to Clonezilla.

I have got as far as being able to perform my fs edits with much thanks to ntfs-3g on ubuntu 11.
However, I am now stuck trying to convert the mountable edited ntfs image back to the "special format" used by Clonezilla to image a real device:

#partimage used to restore Clonezilla ntfs "special format" image to mountable image
ntfs3g ntfs.img /mnt/ntfs
#some edits on the mounted filesystem now done, then:
partclone.ntfs -c -q -s /mnt/ntfs -o image-ready-for-clonezilla.img

This fails with I guess with the predictable
ntfsclone.c: NOT NTFS partition, ntfs mount error 21.
I don't fully understand

I have tried feeding the ntfs.img file back in to partimage. This also fails with
ntfsclone-ng.c: Current NTFS volume size is bigger than the device size (66738569216)!

I have tried upgrading ntfsclone as I read https://bugzilla.redhat.com/show_bug.cgi?id=632902
I used it to also re-perform the image conversion from "special format" with no change.
I notice 66738569216 is correct for the 4K boundary.
I am now generating a large zero file to cat to the end of the image file to take it over the original volume size.
If this fails I'll make a large zeroed loopback device and attempt to restore the image to it, then clone that to special format.

I would greatly appreciate any advice on getting this to work or perhaps some other better way altogether!
best,
TDG


Thu Oct 18, 2012 03:18
Profile

Joined: Wed Oct 17, 2012 01:24
Posts: 3
Post partclone fails to create special format image for ntfs imag
Hi there,
I created a longer post but I think it may have not made it.

I want to image an NTFS device with clonezilla, unpack the clonezilla images, mount the ntfs image, edit it, then return it to a new clonezilla archive.

I get most of the way through this except partclone.ntfs won't create the special format file.

If I try to use partclone.ntfs with a mounted ntfs-3g image, it says its not a block special device, which seems right, but nice if it worked for me.

If I try to give partclone.ntfs a mountable ntfs image, it complains that
ntfsclone-ng.c: Current NTFS volume size is bigger than the device size (66738573308)!
Corrupt partition table or incorrect device partitioning?

If I force it to not make this check, it starts to fail along the way with an error something like (4096) != (-1) for every sector.

I am presently using dd and cat to add \x00s to the end of the ntfs image file to take it up and over the original volume size, to see what happens.

If anyone knows a better way to clone the mountable ntfs image back to the partclone special format for clonezilla use, please let me know. If you know a more enlightened way than this, as I suspect there may be, any advice would be really great.
Cheers,
TDG


Thu Oct 18, 2012 08:35
Profile
NTFS-3G Lead Developer

Joined: Tue Sep 04, 2007 17:22
Posts: 1286
Post Re: cloning an NTFS image
Hi,

Quote:
I created a longer post but I think it may have not made it.

Well, this forum is run by volunteers, so hickups are to be expected when there is no volunteer on duty. You should however get what you paid for, and more.
Quote:
If I try to give partclone.ntfs a mountable ntfs image, it complains that
ntfsclone-ng.c: Current NTFS volume size is bigger than the device size (66738573308)!
Corrupt partition table or incorrect device partitioning?

I know nothing about partclone.ntfs, but this looks like only the file system was saved, not the full partition (which is the device). The last sector of the partition is outside of the file system and reserved for a backup boot sector, and a few sectors have to be left unused to get an integral number of clusters.
Usually this can be fixed by resizing the ntfs image to the partition size :
Code:
resize -s 66738573308 partition-image

Quote:
If I force it to not make this check, it starts to fail along the way with an error something like (4096) != (-1) for every sector.

This means trying to read clusters beyond the end of the file system image. This probably means processing a really truncated image. The difference between the partition size and the file system image should not exceed 4096 bytes.
Quote:
This fails with I guess with the predictable
ntfsclone.c: NOT NTFS partition, ntfs mount error 21.
I don't fully understand

Nor do I. Please summarize your steps again, and mention what warning you get at which step. Also please indicate which ntfs-3g version you are using, and post the summary of your ntfs file system :
Code:
ntfsinfo -fm ntfs-file-system


Regards

Jean-Pierre


Fri Oct 19, 2012 10:46
Profile

Joined: Wed Oct 17, 2012 01:24
Posts: 3
Post Re: cloning an NTFS image
Thank you for your feedback!

I found a solution to this problem from here:
http://www.hyperionworks.com/blog/4/con ... hine-image

The solution is to use dd to set the end of file so that the file size is greater than the volume size. Your suggested answer looks like it would achieve the same thing.

dd if=/dev/null of=sda3.img bs=1 count=0 seek 116G

That last value is greater than 110G which was the original device size.

Using ntfsresize shows the machine and volume size. It is not clear to me why ntfsclone requires this since we are dealing with images not devices.

Otherwise I greatly appreciate this tool set and it now lets me automate a really dreary and error prone process!

Kind regards,
TDG


Mon Oct 22, 2012 01:05
Profile
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Original forum style by Vjacheslav Trushkin.