Question: Currently I have both Windows XP and Windows 7 installed as dual-boot.I’ve been wanting to remove my XP installation for a long time (was waiting to buy an external HDD to backup the data) to get some more space in my Windows 7 partition, since I’m running out of it.
Here are the partitions I have in my drive:
/sda1 – Primary – Windows XP – 150GB/sda2 – Extended–/sda5 – Logical – Data – 99GB–/sda6 – Logical – Windows 7 – 50GB
They are shown like they are physically ordered in the HDD (from the left to the right, i.e sda1 comes first, then sda2, etc).
I backed up all of my data, and used GParted (from an Ubuntu LiveUSB) to try and:
- Delete the whole partition that has Windows XP
- Make my Windows 7 partition a primary one, so my system can boot from it
- Extend the Windows 7 partition (that has 50GB) with the 150GB unallocated space left by the deleted Windows XP partition, so myWindows 7 partition ends up with 200GB
However, I tried using GParted and couldn’t figure out how to do it. I’m not really sure how to change the sda6 partition into a Primary one, and put it in such a way so it can be extended with the space left from sda1 (after deletion).I’m fine with leaving sda5 as a logical partition. As far as I’ve tried, the only thing I can do after deleting the sda1 partition is extend sda2, which is not exactly what I want.
Thanks
EDIT: I also have the Windows 7 installation disk, so if the MBR table gets modified I can repair it from it.
Answer: You can use fixparts, a useful utility that exists in Linux, Windows, Mac OS and FreeBSD. You can download from this Web page. You can also find extensive documentation here.
Since you already have an Ubuntu live stick, I suggest you boot from that, choosing Try Ubuntu without installing. I cannot remember whether fixparts is already on the live; in any case, open a terminal and issue
?man fixparts
If you get a reply fine, otherwise you can install it by means of
?sudo apt-get install gdisk
(thanks to @RodSmith for pointing this out).
Now I will assume your boot stick is /dev/sdb, while your fixed disk is /dev/sda. If it is not so, please change what follows accordingly.
Mount briefly your HDD:
?sudo mount /dev/sda5 /mnt
Save the current partition table in a safe place:
?sfdisk -d /dev/sda > /mnt/parts.txt
Please remember that files on the USB stick are temporary: they are lost as soon as you turn the pc off. So you will have to save the file above on a different drive than the stick; and this is why I suggested ?to mount the partition above. If you need to re-load the partition table above, the command is:
?sfdisk -f /dev/sda < /mnt/parts.txt
Now unmount the partition above,
?sudo umount /mnt
and start fixparts:
?fixparts /dev/sda
And now p will print the partition table, h will print available commands, r turns a logical partition into primary partition, w writes changes to the disk.
The Tutorial referenced above explains under which conditions you can turn a primary partition into a logical one, and viceversa, but even more revealing is the follwoing table that fixparts will present you:
????Can Be ?Can Be ?Number ?Boot ?Start Sector ?End Sector ?Status ?Logical ?Primary ?Code ?1 ?* ?62 ?1171799 ?logical ?Y ?Y ?0x07 ?2 ?1171800 ?1562399 ?primary ?Y ?0x83 ?3 ?1562462 ?3124799 ?primary ?Y ?0x0C ?5 ?3124862 ?3980213 ?primary ?Y ?0xAF
which presents very clearly which partition can change status logical/primary.
When done, write changes (w) to disk, reboot without the USB stick.
Edit:
Make sure your /etc/apt/sources.list contains all of the following lines:
?deb http://us.archive.ubuntu.com/ubuntu/ saucy main restricted ?deb http://us.archive.ubuntu.com/ubuntu/ saucy-updates main restricted ?deb http://us.archive.ubuntu.com/ubuntu/ saucy universe ?deb http://us.archive.ubuntu.com/ubuntu/ saucy-updates universe ?deb http://us.archive.ubuntu.com/ubuntu/ saucy multiverse ?deb http://us.archive.ubuntu.com/ubuntu/ saucy-updates multiverse ?deb http://us.archive.ubuntu.com/ubuntu/ saucy-backports main restricted universe multiverse ?deb http://security.ubuntu.com/ubuntu/ saucy-security main restricted ?deb http://security.ubuntu.com/ubuntu/ saucy-security universe ?deb http://security.ubuntu.com/ubuntu/ saucy-security multiverse ?deb http://archive.canonical.com/ubuntu/ saucy partner ?deb http://extras.ubuntu.com/ubuntu/ saucy main
This is for Ubuntu Saucy Salamander (13.10), adapt to the version you are running (precise?).