I used dd to clone a 500gb Hard Drive to a 256gb SSD before doing this I edited the partitions so that the last 280gb (roughly) was unallocated using GParted.
Eventually dd ran out of room at 240gb, the plan was that it would just not copy the unallocated space and the clone would be finished.
Unfortunately the GPT table is incorrect and I don't know how to sort it out.
GParted hated it and told me it would use a backup table which was the entire drive unallocated.
GPT Fdisk tells me there are 5 errors but with "p" it does say all partions are there. (this might be a good time to memtion it's a windows drive)
The DD I used sudo dd if=/dev/sda of=/dev/sdc status=progress
The Result :dd: writing to '/dev/sdc': No space left on device 468862125+0 records in 468862124+0 records out 240057407488 bytes (240 GB, 224 GiB) copied, 21466.2 s, 11.2 MB/s
GPT fdisk: Warning! Disk size is smaller than the main header indicates! and Caution: invalid backup GPT header, but valid main header; regenerating backup header from main header. then Warning! One or more CRCs don't match. You should repair the disk! it then says MBR Protective and GPT Damaged.
Upon "v": Caution: The CRC for the backup partition table is invalid. This table may be corrupt. This program will automatically create a new backup partition table when you save your partitions.
Problem: The secondary header's self-pointer indicates that it doesn't reside at the end of the disk. If you've added a disk to a RAID array, use the 'e' option on the experts' menu to adjust the secondary header's and partition table's locations.
Problem: Disk is too small to hold all the data! (Disk size is 468862124 sectors, needs to be 976773168 sectors.) The 'e' option on the experts' menu may fix this problem.
Problem: GPT claims the disk is larger than it is! (Claimed last usable sector is 976773134, but backup header is at 976773167 and disk size is 468862124 sectors. The 'e' option on the experts' menu will probably fix this problem
Partition(s) in the protective MBR are too big for the disk! Creating a fresh protective or hybrid MBR is recommended.
Identified 5 problems!^
Help would be greatly appreciated
sudo gdisk -l /dev/sda
GPT fdisk (gdisk) version 1.0.3
Partition table scan:
MBR: protective
BSD: not present
APM: not present
GPT: present
Found valid GPT with protective MBR; using GPT.
Disk /dev/sda: 976773168 sectors, 465.8 GiB
Model: ST500LM034-2GH17
Sector size (logical/physical): 512/4096 bytes
Disk identifier (GUID): 43B49B18-460C-4EDB-B63D-195389ABF232
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 34, last usable sector is 976773134
Partitions will be aligned on 2048-sector boundaries
Total free space is 589831021 sectors (281.3 GiB)
Number Start (sector) End (sector) Size Code Name
1 2048 1085439 529.0 MiB 2700 Basic data partition
2 1085440 1290239 100.0 MiB EF00 EFI system partition
3 1290240 1323007 16.0 MiB 0C01 Microsoft reserved ...
4 1323008 273028223 129.6 GiB 0700 Basic data partition
5 273029120 274431999 685.0 MiB 2700
6 274434048 296837119 10.7 GiB 0700 Basic data partition
7 297041920 387151871 43.0 GiB 0700 Basic data partition
$ sudo gdisk -l /dev/sdc
GPT fdisk (gdisk) version 1.0.3
Warning! Disk size is smaller than the main header indicates! Loading
secondary header from the last sector of the disk! You should use 'v' to
verify disk integrity, and perhaps options on the experts' menu to repair
the disk.
Caution: invalid backup GPT header, but valid main header; regenerating
backup header from main header.
Warning! One or more CRCs don't match. You should repair the disk!
Partition table scan:
MBR: protective
BSD: not present
APM: not present
GPT: damaged
****************************************************************************
Caution: Found protective or hybrid MBR and corrupt GPT. Using GPT, but disk
verification and recovery are STRONGLY recommended.
****************************************************************************
Disk /dev/sdc: 468862124 sectors, 223.6 GiB
Model: high speed
Sector size (logical/physical): 512/512 bytes
Disk identifier (GUID): 43B49B18-460C-4EDB-B63D-195389ABF232
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 34, last usable sector is 976773134
Partitions will be aligned on 2048-sector boundaries
Total free space is 589831021 sectors (281.3 GiB)
Number Start (sector) End (sector) Size Code Name
1 2048 1085439 529.0 MiB 2700 Basic data partition
2 1085440 1290239 100.0 MiB EF00 EFI system partition
3 1290240 1323007 16.0 MiB 0C01 Microsoft reserved ...
4 1323008 273028223 129.6 GiB 0700 Basic data partition
5 273029120 274431999 685.0 MiB 2700
6 274434048 296837119 10.7 GiB 0700 Basic data partition
7 297041920 387151871 43.0 GiB 0700 Basic data partition