Resizing and moving Xp and Vista with help from Linux

Results 1 to 8 of 8

Thread: Resizing and moving Xp and Vista with help from Linux

Threaded View

  1. #1
    Join Date
    Jun 2004
    Newcastle upon Tyne

    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:-

    saikee@debian:~$ su
    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
    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.

    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)
    title           Return to master menu
    configfile      (hd0,5)/boot/grub/menu.lst
    title                   xp pro @ sda1
    root                    (hd0,0)
    unhide                  (hd0,0)
    hide                    (hd0,1)
    chainloader     +1
    title                   Vista  @ sda2
    root                    (hd0,1)
    unhide                  (hd0,1)
    hide                    (hd0,0)
    chainloader     +1
    title                   Ubuntu, kernel 2.6.20-16-generic @ sd6
    root                    (hd0,5)
    chainloader     +1
    #title          Ubuntu, kernel 2.6.20-16-generic
    #root           (hd0,5)
    #kernel         /boot/vmlinuz-2.6.20-16-generic root=UUID=80db91a1-b3f2-42b2-b3a2-9cb6e5f71b8b ro quiet splash
    #initrd         /boot/initrd.img-2.6.20-16-generic
    title                   Slackware 12.1 @ sda7
    root                    (hd0,6)
    chainloader             +1
    title           Mepis 6.0.4 @ sda8
    root            (hd0,7)
    chainloader     +1
    title           Slax 6.0.0 @ sda9
    root            (hd0,8)
    chainloader     +1
    title           OpenSuse 11-Beta 2 @ sda10
    root            (hd0,9)
    chainloader     +1
    title           Debian 4r0 @ sda11
    root            (hd0,10)
    chainloader     +1
    title           Yoper 3.0rc1 @ sda12
    root            (hd0,11)
    chainloader     +1
    title           DSL 4.0 Alpha1 @ sda13
    root            (hd0,12)
    chainloader     +1
    title           Linux Mint 4.0 KDE Beta 2 @ sda14
    root            (hd0,13)
    chainloader     +1
    title           Puppy 3.0 @ sda15
    root            (hd0,14)
    chainloader     +1
    This menu says I have altogether 12 operating systems inside

    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.
    Linux user started Jun 2004 - No. 361921
    Using a Linux live CD to clone XP
    To install Linux and keep Windows MBR untouched
    Adding extra Linux & Doing it in a lazy way
    A Grub menu booting 100+ systems & A "Howto" to install and boot 145 systems
    Just cloning tips Just booting tips A collection of booting tips

    Judge asked Linux "You are being charged murdering Windoze by stabbing its heart with a weapon, what was it?" Replied Linux "A Live CD"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.