[arch-general] fdisk vs cfdisk... And is my drive borked or what?

Joe(theWordy)Philbrook jtwdyp at ttlc.net
Fri Mar 19 19:34:43 CET 2010


It would appear that on Mar 18, Mauro Santos did say:

> Gparted (which is just a frontend for parted) may be able to resize your
> extended partition without touching any of the logical partitions inside
> (you may need to delete your last partition first though, it all depends
> on what alignment gparted will try to use), however I try not to use
> gparted because once it wrecked havoc during a resize operation, because
> of that and because I have a big enough spare disk, I always do a full
> backup before any major partition changes.

Tried it... Gparted didn't like my existing partition table any better than
cfdisk did... It refused to use the table data. But unlike cfdisk it was
willing to proceed in case I wanted to recreate the whole thing from
scratch...
 
> Your primary partitions are safe but the logical ones can just vanish if
> things go wrong. I guess that if you take note of the start and end
> sectors for all partitions you can recreate the layout if anything goes
> wrong (I have never tried it though so I can't say how well that will work).

I can now certify that rebuilding them with fdisk works... ;)  {see below}

It would appear that on Mar 18, Guus Snijders did say:

> To be safe, first make an *exact* note (on paper) of the current partition
> table. If anything goes wrong, you can boot a rescue CD and recreate the
> partition table from this note.
> You could also make a copy of the first sector with dd and store that on some
> media (USB hdd comes to mind), but i would still make the paper note.

I did print the partition table data... I'm not good with dd. I've got
explicit notes on using it to backup/restore the mbr, and have a copy of
that on the usb drive (is that what you mean?) but using it back-up the rest
of the partition table is beyond me. 

> After that, just change the end sector of the extended partition to match the
> end sector of your swap partition and you should be fine.
> (try starting cfdisk at this point to see if the error still exists).
Basically that's what I did with fdisk. I had a text file with the table
data in it on the usb drive. which I opened in one window while I ran fdisk
in another. It let me delete the old extended partition without explicitly
deleting the logical partitions, But of course when I recreated it, I
pasted the ending value from the swap partition. Then proceeded to recreate
the logical partitions the same way. (I had used the fdisk "u" to set units
to sectors:
1)type "n" copy the default beginning sector to clipboard
2)switch to the window with the text file open with vim
3)paste number next to old starting value to confirm values match
4)copy the ending sector from the old data to the clipboard
5)switch windows to the fdisk session
6)paste in the ending sector.
7)repeat 1-6 until all logical partitions had been recreated
8)use "t" to reset the type of the swap partition back to "82"
"w" write table...

And it worked.

> If you're feeling brave, you could also recreate the entire partition table
> from scratch. It's just a table listing which partitions are where. Nothing
> more.

I could have done that. But why mess with the 1st 3 partitions???

> If you don't fully trust the process, you could try mounting the data
> partitions after the change. If that succeeds without errors, it should be ok.

I trust it better now...

It would appear that on Mar 18, Linas did say:

> It works. But you should copy the values *in sectors*. It's amazing how
> different tools interpret the same values on different actual positions.

Well I could have recreated the whole table from scratch with gparted. But I
felt more secure using fdisk, since it was fdisk that provided the sector
data...

The good news is afterwards, I rebooted (successfully) And then tested
cfdisk, which no longer complains. I figure if cfdisk is willing to work on
it, my partition table must now be nearly perfect...

-- 
|   ---   ___
|   <0>   <->     Joe (theWordy) Philbrook
|       ^              J(tWdy)P
|    ~\___/~      <<jtwdyp at ttlc.net>>



More information about the arch-general mailing list