Typing sudo gdisk /dev/sda
will not itself destroy data; gdisk
loads partition table data into memory but will only write changes if you type w
(or certain other commands) to save the changes. Furthermore, damaging the partitions would require using certain destructive commands, like d
(to delete a partition) or o
(to create a fresh partition table). gdisk
will warn you you're about to overwrite your old partitions when you type w
. Although it's entirely possible to trash a partition table with gdisk
, doing so requires considerably more than just launching the program on the disk. I say all this to point out that it's unclear from your description precisely what you've done or what the state of your disk is. Without that information, answers will be at least a little bit speculative, although an educated guess might still be helpful to you.
If you want to provide more information so that we can give answers that are better than guesses, please run the following commands from an Ubuntu live boot:
sudo gdisk -l /dev/sda
sudo parted -l
sudo efibootmgr -v
Note that in the first two of commands, -l
is a lowercase L, not a digit 1. Edit your question and post the output, or post the output to a pastebin site and post the URL in your question or in a reply to this answer.
For a more shot-in-the-dark response without further information, I can make two suggestions:
- You could contact your manufacturer or Microsoft to obtain a Windows installation disc image and use it to re-install Windows. You can then re-run the Ubuntu installation, but be more careful to not damage your system. This may be a good option if your disk doesn't contain personal data you need to recover. In fact, this article describes how to obtain Windows installation media from Microsoft legally. Doing so will have the advantage that your fresh installation will lack bloatware provided by your computer's manufacturer.
- If you want to recover your system to the way it was before, and if your diagnosis of a trashed partition table is accurate, then using TestDisk may enable you to recover your partitions. There are numerous questions and answers on this site, and across the Internet, about using TestDisk, so consult them if you need more help on using this tool. I'm not 100% sure that your diagnosis is correct, though; it could be that your boot loader is damaged or there's some other lesser problem. In such a case, TestDisk won't do any good, and could actually create new problems. Posting the output of the commands I specified earlier will help us understand what's going on and provide better guidance.