FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > ArchLinux > ArchLinux General Discussion

 
 
LinkBack Thread Tools
 
Old 03-17-2010, 10:48 PM
Mauro Santos
 
Default fdisk vs cfdisk... And is my drive borked or what?

On 03/17/2010 10:45 PM, Linas wrote:
>> Which complained about a dos compatibility flag and that I should
>> change the display/entry units to sectors. This showed me a small bit
>> of unused
>> space above my last logical partition (/dev/sda12)...

Don't worry about that for now, that could only come back to bite you if
you had a new disk with 4KB sectors (or an SSD that I think prefers
writes to be aligned with pages ... or something like that).

>> => FATAL ERROR: Bad primary partition 3: Partition ends after
>> end-of-disk
>> => Press any key to exit cfdisk

cfdisk can complain if _anything_ isn't as it wants it to be. cfdisk is
easier to use than fdisk but complains a lot if the partition table
deviates a little from the most compatible "format" possible.


>> Because that's my extended partition... And a close look at the ending
>> cylinder/sector of /dev/sda4 is a slightly higher number than it reports
>> the total cylinders/sectors to be...

I take it that the first listing is in sectors, if you look closely you
will see that your last partition (swap) end before the end of the disk
so you're safe, the extended partition is just a placeholder for other
partitions, so if the partitions do not try to use space that doesn't
exist it should be ok. However I would still try to rectify the ending
of the extended partition. Backup all your data and try to shrink that
extended partition until it fits in your disk.

> I find an oddity on your paritition table, though. You say that
> /dev/sda4 is an
> extended partition (and you do have logical partitions) but it is listed
> by fdisk as
> having type 0xf (W95 Ext'd (LBA)) instead of 0x5 (Extended). I suspect
> that after
> testdisk restoring, some old entries got loaded?
> If that's really a wrong entry, you can do the fdisk delete/recreate tip
> to force its
> length to be inside the disk limits. However, fdisk won't allow you to
> set a partition
> type of 5, which is a pity when you *really* know what you are doing.

Type 0xf is also ok, it all depends on which program created the
partition table initially, I'm not sure but I think gparted used to set
extended partitions to 0xf and so do many other programs.
fdisk should be able to change the type to 5 but if it can't then give
sfdisk a try but make sure all your data is safe.
 
Old 03-18-2010, 10:52 AM
Mauro Santos
 
Default fdisk vs cfdisk... And is my drive borked or what?

On 03/18/2010 09:10 AM, Joe(theWordy)Philbrook wrote:

> 0xf, 5, Who cares which it's called? As long as it contains the logical
> partitions... But the ending sector thing will bug me if I don't fix it.
> So for my piece of mind I'm gonna have to do something...

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.

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).
 
Old 03-18-2010, 08:32 PM
Guus Snijders
 
Default fdisk vs cfdisk... And is my drive borked or what?

On 18-03-10 12:52, Mauro Santos wrote:
[...]


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),

[...]

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.


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).

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.


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.



HTH, HAND


mvg,
Guus
 
Old 03-19-2010, 07:36 PM
Mauro Santos
 
Default fdisk vs cfdisk... And is my drive borked or what?

> On a funny note; i read today that fdisk also has an option to "fix" an
> existing partition table (under expert options)...

I did try that once and I won a free system reinstall, maybe I was just
unlucky or the partition table was too messed up.

> Looks like the partition table is stored on the first sector of the
> disk, so restoring a copy of that sector also restores the table.
> But yes; storing a copy of the MBR on an external disk is what i meant.

That will only restore the primary partitions (the extended partition
itself is a primary partition), the location of the logical partitions
inside an extended partition are saved in a different way, check [1] for
a description. With luck, by restoring the extended partition one can
also restore all the logical partitions inside.

> You're right, it wasn't neccesary in this case, but it sometimes happens
> that the order of partitions get messed up. On such occasion it might be
> worthwhile to just recreate the whole table.

As far as I know linux doesn't care if the partition order in the table
is the same as the order on disk but lots of partition managers complain
(and I like it to be nice and ordered). fdisk can create an out of order
layout (at least it did for me once), cfdisk can do that too I think and
gparted is a master at messing with that when doing any operation with
partitions (and thats why, among other reasons, I try to touch gparted
only with a long stick).

Now that we are talking about this I guess it is a good time to share
thoughts/experiences about this, you never know when knowing this things
will prove to be life savers or avoid you from making big mistakes.

[1] http://en.wikipedia.org/wiki/Extended_boot_record
 

Thread Tools




All times are GMT. The time now is 10:30 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org