When you told fio
to write to /dev/sdc
with 1 GB of random data, you probably overwrote the partition table (and some significant portion of the first physical partition on the disk). More than likely, you'll never see that first 1GB ever again. But if you are careful and lucky, you might be able to recover the other 499 GB.
Before you start messing with the disk, you should back up the data as-is to some external drive and keep it safe. Use a tool like dd to make sure you copy the raw bits from the drive rather than trying to mount the drive as a block device in any way.
Recovery of the partition table is probably not possible through automatic means, but if you know how the disk was partitioned before, you can just repartition the disk the same way using parted. For example, if the entire disk contained a single ext4-formatted partition, you can do parted -s /dev/sdc -- mklabel gpt mkpart primary ext2 0 -1s
.
Once the partition table has been rebuilt but BEFORE YOU FORMAT THE NEW PARTITION, try running fsck.ext4. You might need to specify the -b
flag and point the program to a usable backup superblock, as more than likely the primary superblock lived somewhere in that first GB of disk that was overwritten. For most modern systems, the backup superblock is typically at block 32768, but ymmv.
As a last-ditch effort (and if you are feeling lucky), make a new ext4 filesystem on the partition with mkfs.ext4 -S
to attempt to rebuild the superblocks without wiping anything.
And make sure to read the man pages, and keep that backup handy so you can start over if any of these suggestions don't work or lead to more data corruption!