3

I was trying to repair a damaged MicroSD card located on /dev/sdb, however I accidentally ran the gpart tool on /dev/sda instead. (not gparted, but gpart)

I ended up writing one partition and so now insted of having 4 partitions on my internal hard drive, I have 1 partition.

This is the output of fdisk -l:

Disk /dDisk /dev/sda: 320.1 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders, total 625142448 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
ev/sda: 320.1 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders, total 625142448 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

I don't know why, but my system is still working. I am afraid if I restart though, I won't have a system anymore. I have a dual boot Windows 7/Arch Linux setup.

How should I recover my partitions seeing as I overwrote them with gpart?

1
  • 1
    Please don't put "solved" into the title — we are not a forum! To mark your question as "solved", all you have to do is accept it by using the green checkmark next to your answer. You will be able to do that in two days from now.
    – slhck
    Jul 29, 2012 at 21:05

1 Answer 1

5

okay - it turns out it was only my partition table that I overwrote.

I restored it using testdisk, the step by step instructions can be found here:

http://www.cgsecurity.org/wiki/TestDisk_Step_By_Step#Partition_table_recovery

I actually had more partitions than I had recalled, this is the restored layout:

Disk /dev/sda: 320.1 GB, 320072933376 bytes 255 heads, 63 sectors/track, 38913 cylinders, total 625142448 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048    24578047    12288000    7  HPFS/NTFS/exFAT
/dev/sda2        24578048    24782847      102400    7  HPFS/NTFS/exFAT
/dev/sda3        24782848   500794240   238005696+   7  HPFS/NTFS/exFAT
/dev/sda4       500794245   625153409    62179582+   f  W95 Ext'd (LBA)
/dev/sda5       500794308   620173259    59689476   83  Linux
/dev/sda6       620173323   625137322     2482000   82  Linux swap / Solaris

Disk /dev/sdb: 4158 MB, 4158652416 bytes
128 heads, 62 sectors/track, 1023 cylinders, total 8122368 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
1
  • It turns out that my grub2 got obliterated and testdisk didn't fix that. I made a rescatux bootable usb drive, booted into the live session and repaired it that way. Alternatively I could have booted into any live cd, chroot'd into my Arch Linux and worked that way. rescatux was faster and easier though. Aug 2, 2012 at 15:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .