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.
Last edited by saikee; 06-22-2008 at 10:41 AM.
Since it is probably less work to download and burn the iso for parted or gparted than Mandriva Free CD #1, this is probably not a valid alternative. But, those people who already have a Mandriva CD #1, it can resize XP and Vista partitions, moving contents over in the shrunken partition to avoid loss. I certainly cannot speak to moving partitions, because I have never done it, so have no reason to believe Mandriva can do that.
But, for the simple multi-boot on an existing MS system, Mandriva does the resize fine. Go through the install procedure, manual partitioning, then when it starts selecting package, hit the power switch and put your chosen distro CD in the CD/DVD slot and reboot.
I use Mandriva because I have used it since 1999, thus am less likely to make any mistakes.
Since I have never moved a partition, as opposed to shrinking one, I don't even understand why one moves a partition. Clearly there is a reason, Saikee does not generate useless postings. (Heh, heh, how is that for the understatement of the day?)
If a useless person generates a useless post there is a chance the double negative effect can make a it positive again!
Mandriva is not alone in providing Gparted or other resizing program that can do resizing, creating the partitions, formatting them and then hands over the partitions to the installer to complete the installation in one sweeping operation. Ubuntu and Suse are also very keen on this idea.
I am rather uncomfortable with this approach myself because if something goes pear shape then not only the new Linux will not boot but the original operating system may also be broken. In such case I would have no idea of which part of the operation has gone wrong, making the corrective action nearly impossible. Being an old school I still encourage users to resize the existing system first, check that it is still working happily before embarking on a new installation, instead compounding one problem with another.
To resize a partition by trimming back its right boundary is not a demanding task as this is where the empty space lies. This operation apparently can be executed quickly by every resizing software.
The moving of a bootable partition, thus changing the left boundary, is a bigger challenge for every operating system.
My theory is that the Bios only reads the MBR which is only one sector large. The remaining portion of the boot loader has to reside in a partition's boot sector which is the starting point of every Fat16, Fat32, NTFS and Ext2/3 partition. This partition may not be the first partition and so far away from the MBR. As the MBR has little intelligence to operate it must find its second part by hard-coding the hard disk address of the partition it came from. Thus moving the partition away from its starting point in the hard disk simply sabotaging the booting process.
I find whenever I move a booting partition I have to restore its boot loader, unless the resizing software does this process for me. Apparently Vista is the same in this respect.
Last edited by saikee; 06-23-2008 at 12:36 PM.
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.
I posted the results of my Google on why one would move a partition, along with an explanation of how I deal with the same issues, without moving partitions.
When I clicked submit reply, firefox 126.96.36.199 died on the spot, and my work was lost. I am not going to type it in again. I have had some other unexpected shutdowns, not all on firefox.
I will summarize that several reasons stated had to do with partitions too small, which I deal with by creating links to other partitions for storage, and by this method almost the entire HD is available, except perhaps NTFS partitions, and perhaps that might be available as well.
I am on a 12 GB partition, and am only using 3.5 GB, because I have 21GB of linked storage on another partition.
To me the best reason to do anything is, "Because I want to" and that requires no explanation and no defense. I tire rapidly of those who claim Linux is about choice, as long as you do it exactly their way.
Don't take me too seriously.
I always make a boring subject less boring. I love JL as I was brought here Linux wise. Members are very kind to me and I learn a lot from everybody.
I do tend to write too much by putting forward my own explanation. Some like it and some don't.
One thing I do though I will correct my mistakes and update my threads if I am corrected by others or new information appear.
I am also fond of Mandriva, its predecessor Mandrake and it offshoot PCLinuxOs. I didn't speak against Mandriva at all, just the way users opting for an easy partition-reisizing/installation together could get the finger burnt.
I never expect people to agree with me. Linux is good in that we can achieve the same task by different ways and approaches.
On the subject of moving a bootable partition this is quite common if one wishes to resize a neighbouring partition on the left boundary of a bootable partition and wish it to take up the vacated hard disk space.
The problem does not exist in Linux as all Linux partitions can be freely shifted around. Both Lilo and Grub can be retored easily.
The resizing and moving of Win2k and Xp are not permitted by the OSes and Vista is the first MS system allows itself to be shrunk and expanded at the partition's right boundary. These MS Windows systems have in-built protection systems preventing them from partition size/position changes. Proprietary software that have been developed to do resizing or cloning Windows partitions make millions on the ignorance of MS users.
The current threads and many of my previous threads are meant to show with Linux these operations can be accomplished as simple tasks.
Originally Posted by irlandes
Since you are an experienced user in Mandriva, I like to ask you about bluetooth and Dial Up Networking with my mobile in Mandriva.
Only yesterday I've installed Mandriva Spring 2008 from LiveCD to my laptop where I've Vista and XP. Now I've tripple boot by using grub. Everything fine except I can't connect to net by using my mobile. It is not showing anything when I connected my mobile by USB cable except my mobile asking mode of connection like Nokia mode etc. I can't find anywhere in Mandriva to locate bluetooth devices. Since I am new to Mandriva and even to Linux, please explain with details, if possible.
Last edited by sreejmen; 06-28-2008 at 04:40 AM.
Never used bluetooth
I tend to live in the Third world, and my uses are somewhat simplistic. Only this week did I get an old Linksys router to work on my non-wireless DSL modem and it took a visit from my son-in-law, who knew to change Device IP Address.
The only thing that comes to mind when someone says modem, is the driver issue. That has been a problem forever. Conexant modems are always a bear, and my 2wire DSL modem has no USB driver for Linux.
My Google suggestion is to google for your model of machine, and the issue, starting with modem. rather than treating it as a Mandriva problem. Find out what make it is, then go from there if you have drivers. You could post laptop details here, on the chance someone might know by accident.
In the past, I have fixed dial-up modems on all my laptops, lucent and conexant, but now that I seem to always have access to DSL, the problems have shifted to wireless.