# Fixing a Corrupted Raspberry Pi SD Card Partition Table

1. Download the GParted live disc Download
2. Insert the SD card into a PC and boot into the GParted live disc
3. Minimize the GParted UI and launch Terminal from the desktop
4. Run the following command in the open terminal
   sudo testdisk
5. Select Create
6. Use the arrows to select the SD card device > Proceed
7. Use the arrows to select Intel
8. Select Analyse > Quick Search
9. Press Enter to continue
10. Arrow over and select Write to apply the partition table to the SD card > Type Y and press Enter to confirm
11. Quit out of TestDisk back to the terminal
12. Continue with the following commands to check and repair the filesystems on the SD card
    # take note of the device identifiers for the SD card (/dev/sda1 and /dev/sda2 in the example)
    sudo fdisk -l
    # run the following command for each partition on the SD card, replacing x with the correct disk identifier
    sudo fsck /dev/sdx1 -fy
    sudo fsck /dev/sdx2 -fy
13. Shutdown the GParted live disc
14. Insert the SD card back into the Raspberry Pi
15. Power it on to see if the SD card is now able to boot