xdevs23's answer is good, but I want to elaborate on some issues. First, when you launched gdisk
on your disk, it automatically converted MBR to GPT in memory. Anything you do subsequently works on the transformed GPT data structures, unless and until you hit w
, at which point the disk itself is transformed to use GPT. The n
command in gdisk
creates a new partition. Thus, when you used n
and then specified 3
as the partition, you were telling gdisk
to create a new partition #3 -- but that partition entry already exists. The gdisk
error refers to this fact; it has nothing to do with what partitions are currently mounted. (gdisk
doesn't care about mounted partitions, and will readily delete or modify them -- but if you do so, your changes won't be visible until you restart or remove the disk, since the kernel will continue to use the old partition table.)
Another point, and really a more important one in this context, is to ask why you want to create a GPT partition. My guess is that Windows complained about the use of MBR and said it wanted GPT. This is simply a symptom that you booted the Windows installer in EFI/UEFI mode; but the use of MBR implies that Ubuntu is installed in BIOS/CSM/legacy mode. Mixing boot modes is not a good idea. The simplest solution may be to install Windows in BIOS mode, too. Doing this will require finding the right way to boot the Windows installation medium. You'll probably need to use your boot manager and pick the option for the boot medium that lacks the string "UEFI" in its description.
The trouble with this is that you've already got three primary partitions on the disk. If you intend to install Windows to one of those partitions (presumably /dev/sda3
), you may be OK; however, Windows has a tendency to convert disks from a plain MBR setup to MBR with a Logical Disk Manager (LDM) layer atop it when the number of partitions exceeds four. If the Windows installer does this, you'll have a hard time fixing the problem, since Ubuntu can't boot from such disks -- at least, not easily, and I've never heard of anybody succeeding it making it work.
Thus, converting from MBR to GPT may be useful; however, you'll then need to re-install an Ubuntu boot loader. As I said, mixing boot modes is undesirable, so it will be best to install an EFI boot loader for Linux. You can do this either manually or in a semi-automated way. Using Boot Repair can do this -- but be sure to boot it in EFI mode. (In fact, disabling your CSM in your firmware setup utility may be best if you go this route.) Another alternative is to use my rEFInd boot manager on USB flash drive or CD-R to boot Ubuntu. You can then swap out the grub-pc
package for the grub-efi
package to install GRUB manually; or install the rEFInd Debian package or PPA to have rEFInd take over as your boot manager.
Yet another option may be to install Windows to a second disk. If you do this in BIOS mode, you won't need to mess with the Ubuntu boot loader. Windows can use LDM or not, as it desires, without causing problems for Ubuntu. This is obviously more likely to work on a desktop than on a laptop, and requires extra hardware.
Installing Windows in a virtual machine (using VirtualBox, KVM/QEMU, or something similar) can avoid many of the headaches I've just described, but may be limiting if you want Windows for game-playing or something else that requires direct hardware access.
In sum, you have a number of options. The trick is navigating them all. There are quite a few ways the installation you're attempting can go wrong, so if you don't know what you're doing, this can be hazardous. Overall, I recommend you try a virtual machine installation, if that's practical. If not, you really should read up on the subject of EFI-mode booting. I recommend:
unmont
thendelete
thenformat
Alternatively right click in files andunmount
– Mark Kirby Oct 03 '15 at 10:41