Multiple partitions Win7

Just bought a new laptop and wanted to setup Porteus to run from a partition on the hard drive. There are some aspects of windows 7 that can make this quite a task so i thought i would write up how it should be done.

Target machine: Laptop HP Pavilion dv6Windows 7600Gb hard drive

Windows 7 usually keeps a 200Mb partition right at the start of the drive which is ued for boot files, crash dump reports and other important things. I decided to leave this intact and use easyBCD later to edit the boot loader. My unit also had a HP partiton containing some HP tools which i decided to remove. You need to use the windows disk management tool to shrink the volume. DO NOT use a third party tool such as gparted to organize your partitions just yet. Windows keeps vital files such as the disk file table, page file & hibernation file halfway down the drive and if you wipe this out you won't be able to boot windows anymore. I found these files by using a third party disk defrag tool which showed the files toward the middle of the drive as partition file table files. When attempting to shrink the partition i could only shrink to 300Gb because that is where the system files were. I had to move these files before being able to shrink the volume any further.

The first step is to turn of hibernation, pagefile and system restore for the C: drive. Now you need to take ownership of the files and give yourself permission to remove them.
Windows Key & type cmd then hit ctrl + shift + enter. This opens a command prompt as administrator.

Take ownership of the file:

takeown /f C:\Windows\System32\en-US\winload.exe.mui

Give yourself permission to delete it (gotta love windows)replace where i have 'jay' with your username.

cacls C:\Windows\System32\en-US\winload.exe.mui /G jay:F

Now delete your c:\pagefile.sys if it still exists.

Run a disk cleanup and defrag on the c: drive now. Now you should be able to use the disk management tool to shrink your volume to whatever size you like. Once done you can then boot into a thrid party application and organize your partitions.