Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I currently have a wrong-sized partition in a "very damaged" status. The first problem for most recovery tools: - disk size is 9*10x units. - logical partition starts at 2*10x units - logical partition ends at 6*10x units. due to broken partition table. - logical partition end should be set to 2*10x units (whole drive).

What is a good document on direct editing Intel(traditional) partition table, except for the casting a 'read all' spell on fdisk source?

I mean, if there's a fdisk version, that can be told to: "set the partition to begin at cluster X, end at cluster Y" - it is ok.

If there's a GUI tool to change the data, without doing actual "so smart resize magic" - that's ok.

If there is a good docs about changing partition table information directly, byte to byte - that's ok too.

share|improve this question
up vote 4 down vote accepted

Heh, heh, heh. This brings me back. Back, way back, in the Win3.1 days there was a package out there that was exactly what you're looking for. It was called PCTools and had a hex-editor that could directly edit the partition table (as well as the master boot record). If you had a misaligned partition for some reason, you could fix it in a way that DOS FDISK never could. Helped me fix a few things. It's fallen off the back of google, though.

These days there are a couple of Linux fdisk programs that allow you to set partition limits on a sector by sector basis. Dangerous, for a reason, but they're there.


This is brain surgery. You can really screw things up if you do it wrong.

That out of the way...

Find yourself a USB-Linux or DVD-Linux of your choice, they all should have what you're looking for. Get to a command line, root-mode if you're not already there, and start it up.

fdisk /dev/sda

Set select U to change the units. p will print your partition table.

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *          63      144584       72261   83  Linux
/dev/sda2          144585   415424834   207640125   8e  Linux LVM

side-note: If I had a solid-state-drive on this machine, /dev/sda1 would be misaligned. It should start on sector 64 not 63.

Note your partitions, write them down. Where they start, where they end, how many blocks they are, and what the partition ID is. You'll need each of these.

The easiest way is to remove the entire partition table and write a new one, with the parameters you need. If you do it right, it should come back.

The o command will write a new, blank, partition table. The n command will create a new one; select your partition type, where the partition will start, and where it will end (you wrote that down). Once that's done the t command will allow you change the partition type, since it'll default to Linux (83) and you probably don't want that. Use the code you wrote down.

Repeat for each partition you need. When done the w command will commit your work. You'll probably have to reboot to see if it works out.

The more advanced method is to just change the bad partition directly. This is a lot more work, and I'm unclear enough on the steps that I'm not going to write them down in case I lead you to bricking things.

share|improve this answer

You must log in to answer this question.

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