Resizing and moving Xp and Vista with help from Linux
This thread describes the resizing and moving Xp and Vista partitions by Linux.
Tools required :
(1) Gparted or Parted Magic Live CD
(2) Vista installation DVD (needed only if the partition is physically moved)
I list two hard disks, both are 500Gb Sata II, as follow:-
The two disks are identical to start with, one being a backup clone of another. My normal disk is the device sda and the work I did was on sdb. In other word I started with the disk like sda and ended with condition like sdb.
debian:/home/saikee# fdisk -l
Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 12158 97659103+ 7 HPFS/NTFS
/dev/sda2 12159 24316 97659135 17 Hidden HPFS/NTFS
/dev/sda3 24317 36598 98655165 5 Extended
/dev/sda4 36599 60801 194410597+ 83 Linux
/dev/sda5 24317 24438 979933+ 82 Linux swap / Solaris
/dev/sda6 24439 25654 9767488+ 83 Linux
/dev/sda7 25655 26870 9767488+ 83 Linux
/dev/sda8 26871 28086 9767488+ 83 Linux
/dev/sda9 28087 29302 9767488+ 83 Linux
/dev/sda10 29303 30518 9767488+ 83 Linux
/dev/sda11 30519 31734 9767488+ 83 Linux
/dev/sda12 31735 32950 9767488+ 83 Linux
/dev/sda13 32951 34166 9767488+ 83 Linux
/dev/sda14 34167 35382 9767488+ 83 Linux
/dev/sda15 35383 36598 9767488+ 83 Linux
Disk /dev/sdb: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 128 2677 20482875 17 Hidden HPFS/NTFS
/dev/sdb2 * 2678 5227 20482875 7 HPFS/NTFS
/dev/sdb3 24317 36598 98655165 5 Extended
/dev/sdb4 1 127 1020096 83 Linux
/dev/sdb5 24317 24438 979933+ 82 Linux swap / Solaris
/dev/sdb6 24439 25654 9767488+ 83 Linux
/dev/sdb7 25655 26870 9767488+ 83 Linux
/dev/sdb8 26871 28086 9767488+ 83 Linux
/dev/sdb9 28087 29302 9767488+ 83 Linux
/dev/sdb10 29303 30518 9767488+ 83 Linux
/dev/sdb11 30519 31734 9767488+ 83 Linux
/dev/sdb12 31735 32950 9767488+ 83 Linux
/dev/sdb13 32951 34166 9767488+ 83 Linux
/dev/sdb14 34167 35382 9767488+ 83 Linux
/dev/sdb15 35383 36598 9767488+ 83 Linux
Partition table entries are not in disk order
When I boot the MS systems I only use "ONE" disk. I can list both here because I use Linux. The section in blue relates to Xp while the section in purple relates to Vista.
The best to decribe the content of my hard disk is the Grub configruation file "menu.lst" (I shall give sufficient detais below to help users new to Linux)
This menu says I have altogether 12 operating systems inside
title Return to master menu
title xp pro @ sda1
title Vista @ sda2
title Ubuntu, kernel 2.6.20-16-generic @ sd6
#title Ubuntu, kernel 2.6.20-16-generic
#kernel /boot/vmlinuz-2.6.20-16-generic root=UUID=80db91a1-b3f2-42b2-b3a2-9cb6e5f71b8b ro quiet splash
title Slackware 12.1 @ sda7
title Mepis 6.0.4 @ sda8
title Slax 6.0.0 @ sda9
title OpenSuse 11-Beta 2 @ sda10
title Debian 4r0 @ sda11
title Yoper 3.0rc1 @ sda12
title DSL 4.0 Alpha1 @ sda13
title Linux Mint 4.0 KDE Beta 2 @ sda14
title Puppy 3.0 @ sda15
XP in sda1, type 7 but switchtable to type 17 if it is hidden, size 100Gb
Vista in sda2, type 17 but switchtable to type 7 if I unhide it, size 100Gb
sda3 is the entended partition containing sda5 to sda15.
A data-only partition in sd4, type 83, size 100Gb
sda5 is the common swap partition for all Linux
sda6 to sda15 each has a Linux inside.
The menu is from Grub thus I boot all the systems by Grub.
I stalled Xp and Vista each as a stand alone system so that each has its own boot loader inside.
If I boot Xp, I make its partition active (or bootable) and hide the Vista partition so that sda1 become the drive "c". Similarly I do the same with Vista and so a hidden Xp with partition type 17 is not recognised by Vista. This allow Vista in the second partition sda2 to boot up as a "C" drive. To any MS Windows Type 7 is ntfs partition and Type 17 is foreign so the latter is not supported and would not be mounted. The reason why a NTFS partition changes to type 17 when hidden is explained here.
The standard MS method is to use only one MS boot loader for booting both Xp and Vista but my arrangement is simpler and has no limit on the number of MS system I can boot. The disadvantage is I can only see one MS partition at a time.
What I have done is to prove we could resize and move both Xp and Vista partitions.
The idea of resizing or moving a partition is Gparted involves specifying the number of Mb in three boxes of
(i) Free space precceding the partition (normally zero to start with)
(ii) New size (showing the current size)
(iii) Free space following the partition (normally zero to start with)
To resize a partition one changes box (i) or/and (iii) and the new size in box (ii) will adjust itself.
To move the partition one adjust the free space in either (box (i) or box (ii) or both but keep the box (iii) unchanged.
Any decent operating system would not like to be resized or moved while in operation so the best practice is not to run the operating system inside the partition you want a size change or a relocation. Using a Linux Live CD is recommended as the operating system is independent of the hard disks and hence safe. Also a Linux Live Cd by default can give you the root privilege (admin right) to change the partitions.
Although altering a partition is easy in Linux it is a very serious change to the operating system and should only be undertaken with upmost care.
Using Gparted to resize and move XP
I am fairly comfortable with Gparted to resize and move a Xp, two different operations conducted simultaneously, as I have done enough trials.
The sdb partition table shows I have deleted the 100Gb partition sda4, which was originally at the end of sda2 between cylinder 24317 and 36598. I then shrunk the left boundary of XP in sda1 from 100Gb to 20Gb. Created a new sda4 of only 1Gb large at the beginning of the disk and move the XP next to the new sda1.
My scheme looks complicated and is not needed by other users. I did it because I want to show XP can be moved and resized at the same time by Gparted.
This also shows although sda4 is the 4th primary partition it can be put at the front of the hard disk as long as the first 3 primary paritions have been defined in the partition table.
I run a Parted Magic Live CD V2.1 to resize and move Xp in one operation. Parted Magic has Gparted which is the engine for resizing NTFS partitions reliably. If one uses the Gparted from an installed Linux the Xp partition may be protected by the installed Linux and ownership issue may make the resizing/moving operation difficult to instruct.
After its partition has been resized and moved we can expect XP to react to the changes. It will first conduct a check on the filing system by the usual 3-step CHKDSK command. The system will then automatically rebooted and thereafter it will work normally.
I cannot remember any problem of resizing and moving a XP with a Gparted or Parted Magic Live CD. It is simply as reliable as it can be expected.
Using Gparted to resize and move Vista
Now this is a different story.
Vista's disk management is shipped with a resizing function that can shrink or expand a Vista partition but it only works on the right boundary of the partition. In other word the left boundary can not be moved or there does not seem to be any facility to change the left boundary.
This tells me Vista can be easily resized but does not want to be "moved".
What is more it seems to have a mind of its own on how much it allows the user to shrink the system partition. In my case it only allowed me to shrink about 50Gb out of 100Gb although its footprint was no bigger than 16 Gb.
I tried to use Disk Management "shrink" facility and opted for the maximum reduction in size. Vista can shrink itself vary quickly and much much faster than Gparted can, so it pays to use it. I also did another size reduction later with Gparted to check the Vista behaviour.
This is no drama to use Vista's shrinking facility to reduce the partition by trimming back its righ boundary.
To move the Vista partition I had no choice but to use Gparted. To simplify the matter I moved it first, without resizing it at the same time, by instructing in Gaprted that the space infront of Vista's sda2 should be zero and click its rear space. This effectively tells Gparted to move sda2 next to sda1.
Gparted did this without any complaint so I rebooted but the Vista refused to boot and asked me to repair it.
This is the only time I needed to go back to Vista's installation DVD to repair a "moved" Vista partition. It was only a matter of booting up the Vista installation DVD, chose the keybord language and click "repair". I only have one Vista license and cannot test if any Vista installation DVD can do the repiar job but the behaviour of Vista led me to believe any Vista installation should be able to do the repair.
The repair took seconds. I then rebooted. Vista did the usual 3-stage CHKDSK to ensure the file system integrity and booted up successfully. It then demanded an immediate reboot to effect the hardware change. After the reboot Vista operates normally again.
Thus based on my observation a Vista partition can be moved but need a Vista installation DVD to carry out a repair. It is possible that Vista in normal operation disallows its position to be shifted. An possible explanation of needing a repair is that Vista may have hard-coded the hard disk address of the partition into the system files. Moving the Vista partition changes the hard disk address. As it is a proprietary system it should only be repaired by its own installation DVD. That seems to work satisfactorily.
I was unhappy that Vista no longer willing to shrink to a smaller size and wanted to retain its shrunk 50Gb size. So I run Parted Magic Live CD again and resized it to down 20Gb. This affected only its right boundary.
Vista reluctantly booted, did its CHKDSK check and demanded a reboot to efeect the new change. Thereafter Vista works normally again.
Thus I started Xp and Vista in two 100Gb partitions as sda1 and sda2. The two systems are now in sdb1 and sdb2 both 20Gb large and run happily at the different locations.
The disk sdb here is attached for demontration only as with sda disk attached I would have two Xp + two Vista and all Oses are duplicated. In real operation I have to remove one of the disks. Thus when I run the second disk and it is the only disk in the PC it becomes the sda again.
Throughout my experiement I booted both Xp and Vista with Grub only and never needed to restore MS's own MBR. I disable the system protection of both systems as I never have a need to go back to a recovery partition. I simply run a backup cloned disk.
(a) Xp can be safety resized and moved by Gparted (or Parted Magic). For best result use a Live CD as both are freely available for download.
(b) Vista it is shipped with a shrink/expand function in its disk management program to alter it right boundary of the partition. This is the most efficient way.
It appears Vista does not have own its facility to move itself.
Gparted can be used to moved and shrink a Vista partition but the moved partition required a "repair" to update its hard disk position by the Vista installation DVD.
To just resize a Vista right boundary Gparted alone is adequate for the operation but takes several times longer than Vista's own shrink/expand function.
(c) The resized and moved Xp and Vista systems retain their activations and do not need to be re-activated again.
Saikee makes no useless postings
>>If a useless person generates a useless post there is a chance the double negative effect can make a it positive again!
I have never found any of your postings to be useless. There is not only no double negative; there is also no single negative in your postings. I hope my way of saying things did not make you think that is what I meant. I meant the exact opposite; that if you are moving a partition there is a reason for it, even if I don't know what it is. My ignorance is my ignorance and has no reflection on your work.
I have a few minutes while guests from the States take a nap, and will use it to Google to try to find out under what circumstances one will want to move a partition.
In case any newbies come here, Saikee is widely recognized across the Web via a multitude of links, as the expert on multi-boot with grub, right here on justlinux.com. Some people will tell you that you cannot have more than one version of Windows on the same machine. Saikee knows how.
I do not always agree with Saikee one hundred percent, but it is never on technical issues. He reminds me somewhat of a man I worked with for some years, and whom I admired very much. Andy was very careful about how he said things, instead of sort of shooting from the hip then correcting our errors when we note them, like most of us do; thus when Andy said something you could count on it.
It is usually on some personal preference on how to get something done, such as my simple multi-boots being done perfectly via Mandriva install CD. His method works great, and he does things that are much more complex than my simple multi-boots. Mine suits me, primarily because I am thus using the same utility I have used since 1999, which becomes TO ME an advantage. As I said, if you don't already have Mandriva nor plan to use it, it makes more sense to download and burn parted.
You can bet if I ever run into something I can't handle, I will be downloading parted and coming to his How-to's.