You are not logged in.

#1 2013-11-23 19:58:27

Registered: 2013-02-19
Posts: 67

Recovering a ruined partition table

I would like to begin by saying, I f***ed up big time. 

When trying to reboot my machine having hibernated it the night before, I found that the computer would only boot into recovery mode and didn't respond to my keyboard.  After trying again, and the fallback I put the Arch install disk in to try to figure out the problem.  The first thing I found was the /boot partition couldn't mount due to a filesystem problem.  I decided that rather than try and fix it, I'd create a new one.  I originally used JFS for god knows what reason but this time I tried to put ext2 on it (which is I use for all my other Arch installs).  Afterwhich, it seemed to have some kind of problem with both of the filesystems.  I learnt from another install that a good way to deal with a filesystem that refuses to die is to use:

dd if=/dev/urandom of=/dev/sdaX bs=1M

and create a new partition in it's place.  But I must have overlooked something because now it says that sda4 (the /boot partition I was trying to destroy) is longer than the hard drive. 

I'm fairly certain that my data is still there because it says dd only wrote about 176kB.  I think I should be able to delete the partition and everything should work, but I may be oversimplifying it. 

If anyone has any suggestions or idea the help is appreciated.  Also I am, at this moment, creating an image of my drive, just in case. 

Right now I'm thinking of print /dev/zero to sda4 for 176kB and see if that fixes it.

Last edited by Dornith (2013-11-23 21:36:48)


#2 2013-11-23 20:06:54

Forum Moderator
From: Twin Cities, MN
Registered: 2012-06-22
Posts: 1,554

Re: Recovering a ruined partition table

Okay, first, is that actually the command that you used? If so, it shouldn't have done anything since /dev/sdX almost certainly isn't a valid device (nor the one you talk about). Second, that command would zero the whole drive, so if you ran that command without specifying a specific partition, the drive is probably zero'd.

All the best,


"All errors are ᴘᴇʙᴋᴀᴄ errors—It's just a matter of narrowing down which keyboard and chair." -Trilby


#3 2013-11-23 21:39:09

Registered: 2013-02-19
Posts: 67

Re: Recovering a ruined partition table

Sorry it was urandom, not zero.  I fixed it in the orignal post. 

Also, that this not the actual command I typed into this computer, it was just a format for a command I had learnt to use in another instance.  The actual command I typed onto my now non-functional computer was:

dd if=/dev/urandom of=/dev/sda4

Last edited by Dornith (2013-11-23 21:39:42)


#4 2013-11-23 22:10:39

From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,412

Re: Recovering a ruined partition table

Next time, look into wipefs.


#5 2013-11-23 23:47:38

From: Great White North
Registered: 2008-01-23
Posts: 873

Re: Recovering a ruined partition table

Use Testdisk to resurrect that partition.  It is the fastest and simplest way I'm aware of resurrecting dead / old partitions.  It should be on the wiki about how Testdisk is used.  Your partition may still be damaged but at least you can access it after Testdisk is done and then run the fsck utility (JFS does have one, right?) on that partition.  From there I'm pretty sure you can figure out what else you need to do.

Last edited by MoonSwan (2013-11-23 23:49:03)

I'm torn apart between worlds. Basically, using vim in a highly visual environment with a lot of mouse features feels like soldering a lose wire to a motherboard with a Zippo and a needle, while working with ANY TEXT AT ALL with a "modern GUI" text editor feels like joining the London Philharmonic Orchestra with a Fisher-Price Laugh and Learn Magical Musical Mirror.  --Awebb


#6 2013-11-24 03:53:06

From: Cymru
Registered: 2011-11-27
Posts: 6,082

Re: Recovering a ruined partition table

What kind of partition table does it have? GPT disks have a back up partition table which tools like gdisk can use to restore a damaged primary partition table.

Please post the output of gdisk -l /dev/sdX (for GPT) or fdisk -l /dev/sdX (for MBR).

How To Ask Questions The Smart Way | Help Vampires

Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Corporation Wireless 8265 / 8275 | US keyboard with Euro | 512G NVMe INTEL SSDPEKKF512G7L


Board footer

Powered by FluxBB