[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Windows Partition Cloning under Linux



T o n g wrote:
Hi,

Is there any good solution to clone Windows Partitions under Linux?

Most people would recommend Partimage, but I think it is practically useless since the source/dest partition size has to be exactly the same. http://www.partimage.org/Partimage-
FAQ#Can_I_restore_it_to_a_smaller_or_bigger_partition_.3F

Please help.

thanks

Use dd to copy the Master boot record and the partition table
dd if=/dev/sdX of=/dev/sdX bs=512 count=1
changing bs to 446 will copy the MBR but not the partition table.

Use ntfsclone to mirror the NTFS partition
ntfsclone -s -o - /dev/sdX1 | ntfsclone -r -O /dev/sdX1 -

If you're trying to shrink your windows system you can resize the filesystem with ntfsresize and then resize the partition with fdisk, if you're trying to grow it reverse the order, remember to togal bootable "a" and set the part id to 7 "t"

The trick is to use a command like
ntfsresize -nvi /dev/sdX1
to calculate the minimum size of the file system, round UP that number to at least the nearest gig then use a command like
ntfsresize -nv -s 7G /dev/sdX1
to test your decision where 7G is the desired size then remove the n from -nv to actually perform the filesystem resize, then use fdisk to delete and recreate the partition at the desired size (in the above example you'd use +7G instead of an end cylinder in fdisk)

if you're trying to increase the size just make your partition whatever size you want, mirror the data over and use a command like
ntfsresize -v /dev/sdX1
to make the filesystem fill the partition.

I do this all the time with no problems.


Reply to: