I accidentally deleted the partition containing Grub and whatever else needed to boot my PC when I ran Ubuntu 18.04 dual-boot with Windows XP. I was starting this PC from my external HDD so I can start Ubuntu or Windows. Here are snapshots of the HDD shown by TestDisk and one shown by G-parted. How can I reinstall the files needed for starting my PC without deleting other files on the Ext HDD?
Please follow the link below
If you have delete your linux-swap partition , boot on a live-CD, open gparted (or install it with sudo apt-get install gparted and open it). In gparted, recreate a partition (type linux-swap ), apply, and reboot.