Hi,
On 24 Apr 2010, at 23:04, Pete McCann wrote:
> I have a hard drive image file with a Windows 7 installation that I
> captured prior to first boot. It looks like this:
>
> bigmedia:/var/extra1/images# losetup -fsr ./netbook-working-sda.img
> /dev/loop0
> bigmedia:/var/extra1/images# fdisk -lu /dev/loop0
>
> Disk /dev/loop0: 160.0 GB, 160041885696 bytes
> 255 heads, 63 sectors/track, 19457 cylinders, total 312581808 sectors
> Units = sectors of 1 * 512 = 512 bytes
> Disk identifier: 0xdc7a3828
>
> Device Boot Start End Blocks Id System
> /dev/loop0p1 63 25173854 12586896 27 Unknown
> /dev/loop0p2 * 25173855 25382699 104422+ 7 HPFS/NTFS
> /dev/loop0p3 25382700 312579759 143598530 7 HPFS/NTFS
> bigmedia:/var/extra1/images#
>
>
> I want to shrink this installation down to 40GB and put it back on the
> machine which right now has Ubuntu taking up all 160GB.
>
> I have read that ntfsresize may have some problems resizing Windows 7
> partitions, and also that sometimes machines ship in Suspend mode instead
> of shutdown that can lead to boot problems.
>
> Can I safely use ntfsresize to shrink partition 3, and put the 3 partitions back
> on the drive after my Ubuntu installation, and expect the machine to boot?
> Or is that type 27 partition the suspend partition that needs to be first on
> the drive? Anything else I should keep in mind?
The type 27 partition is either an Acer laptop hidden rescue partition or a Windows RE hidden partition. In either case you do not need it at all.
As far as booting goes, no it will NOT work. Windows booting is much more complicated than that. You will need to modify the NTFS boot sector to update it to the new physical location on the disk, you will need to update the new drive geometry information in the NTFS boot sector as well. You will then need to also edit Windows 7 setup itself so it knows about the new system and boots from it. I am afraid I have no idea how booting works in Windows 7 so you will have to search google for details of what you have to do but be prepared for a lot of pain...
I would recommend you to install Windows from scratch in the new space you want to put it in, then copy over from the old disk image anything you want to keep to the new Windows installation then make a full backup and then discard your now no longer needed disk image... This will be a lot less hassle than trying to do what you are trying to do...
Best regards,
Anton
--
Anton Altaparmakov <aia21 at cam.ac.uk> (replace at with @)
Unix Support, Computing Service, University of Cambridge, CB2 3QH, UK
Linux NTFS maintainer, http://www.linux-ntfs.org/
|