Skip to contentSkip to conversation

fdisk: What do plus signs after "Blocks" mean?

DISCUSSION Konstantin Kudin 5 participants 11 messages Jul 12, 2005 – Aug 11, 2005 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

Hi there,

Fdisk on my machine displays the output shown below. Many partitions
have pluses after "Blocks". The issue is that during installation on the existing linux setup WinXP screwed up the partition table, and these pluses were very difficult to recreate. Basically, if I remove hda9, and then try to recreate it in fdisk, it loses the plus sign and does not look as before. Also, sometimes fdisk creates a partition with "+", and sometimes it does not.

Since I did not want to take any chances, I used Knoppix to read a
similar partition table from /dev/hdb using "sfdisk -dx", and then copied it to /dev/hda by using "sfdisk -fx". If I do not force sfdisk by using "-f", it complains that there are some inconsistencies.

Can anyone enlighten me what the pluses mean? Also, if a partition
loses pluses after "Blocks", would that destroy a RAID array?

Thanks!
Konstantin

#################
fdisk -l /dev/hda

Disk /dev/hda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/hda1   *           1           3       24066    7  HPFS/NTFS
/dev/hda2               4       19457   156264255    5  Extended
/dev/hda5               4         264     2096451   82  Linux swap
/dev/hda6             265        2176    15358108+  fd  Linux raid
autodetect
/dev/hda7            2177        4088    15358108+   7  HPFS/NTFS
/dev/hda8            4089        7912    30716248+  fd  Linux raid

autodetect
/dev/hda9 7913 19457 92735212+ fd Linux raid
autodetect

____________________________________________________
Sell on Yahoo! Auctions – no fees. Bid on great items.
http://auctions.yahoo.com/

#1 lore raw

Hi Konstantin :)

* Konstantin Kudin <[email protected]> dixit:

Quoted 1 line

Can anyone enlighten me what the pluses mean?

It is commented in the README.fdisk file in util-linux
distribution: the '+' flag means that the partition has an odd number of sectors. That means that you can waste a sector at the end of the partition, and it's very common for the first partition in the disk if it ends on a cylinder boundary and cylinders have an even number of sectors, due to the MBR.

Harmless.

Quoted 2 lines

Also, if a partition loses pluses after "Blocks", would that destroy a RAID array?

I don't have any idea :? To reproduce a '+' in a partition, you
probably have to specify partition size in sectors (or kilobytes, whatever fits you better) and make it odd, honoring exactly the number of sectors that partition had (before the parttable was destroyed by our dear friend XP).

It's a good idea to have a copy of the partition table around, if
it is not simple (the one you had is NOT simple).

Hope that helps.

Raúl Núñez de Arenas Coronado

Signature · 3 lines
Linux Registered User 88736 | http://www.dervishd.net
http://www.pleyades.net & http://www.gotesdelluna.net
It's my PC and I'll cry if I want to...

A message that is not in the archive (sent off-list or not yet received): [email protected]

#3 lore raw

DervishD <[email protected]> wrote:

[...]

Quoted 2 lines

It's a good idea to have a copy of the partition table around, if
it is not simple (the one you had is NOT simple).

Be careful. What you'll get out of backing up the partition table is /only/ the primary partitions, the others are handled by a weird russian doll of partitions-inside-partitions. AFAIR, the details were in the LILO docu.

Signature · 4 lines
Dr. Horst H. von Brand                   User #22616 counter.li.org
Departamento de Informatica                     Fono: +56 32 654431
Universidad Tecnica Federico Santa Maria              +56 32 654239
Casilla 110-V, Valparaiso, Chile                Fax:  +56 32 797513
#4 lore raw

--- Horst von Brand <[email protected]> wrote:

Guys, thanks a lot for the explanations!

Actually, it seems like one can backup information on ALL partitions
by using the command "sfdisk -dx /dev/hdX". Supposedly, it reads not only primary but also extended partitions. "sfdisk -x /dev/hdX" should be then able to write whatever is known back to the disk.

Konstantin

Quoted 6 lines

DervishD <[email protected]> wrote:

[...]

Quoted 1 line

It's a good idea to have a copy of the partition table around,

if

Quoted 9 lines
Quoted 1 line

it is not simple (the one you had is NOT simple).

Be careful. What you'll get out of backing up the partition table is /only/
the primary partitions, the others are handled by a weird russian doll of
partitions-inside-partitions. AFAIR, the details were in the LILO docu.

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

#5 lore raw
Quoted 7 lines

Guys, thanks a lot for the explanations!

Actually, it seems like one can backup information on ALL partitions by using the command "sfdisk -dx /dev/hdX". Supposedly, it reads not only primary but also extended partitions. "sfdisk -x /dev/hdX" should be then able to write whatever is known back to the disk.

MBR size is 448 bytes, the rest is "the partition table", with space for four entries. If one wants more, then s/he creates a [primary] partition, tagging it "extended", and the "extended partiton table" is within that primary partition. So yes, by dd'ing /dev/hdX, you get everything. Including "lost sectors" if you dd it back to a bigger HD.

#6 lore raw

I always thought;

First 446 bytes are boot code and all
Next 64 bytes are for 4 partition records, 16 bytes each Last 2 bytes are signature

?

-fd

Quoted 18 lines · Jan Engelhardt
Quoted 6 lines

Guys, thanks a lot for the explanations!

Actually, it seems like one can backup information on ALL partitions by using the command "sfdisk -dx /dev/hdX". Supposedly, it reads not only primary but also extended partitions. "sfdisk -x /dev/hdX" should be then able to write whatever is known back to the disk.

MBR size is 448 bytes, the rest is "the partition table", with space for four entries. If one wants more, then s/he creates a [primary] partition, tagging it "extended", and the "extended partiton table" is within that primary partition. So yes, by dd'ing /dev/hdX, you get everything. Including "lost sectors" if you dd it back to a bigger HD.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

#7 lore raw

Hi kernel.

* kernel <[email protected]> dixit:

Quoted 3 lines

First 446 bytes are boot code and all
Next 64 bytes are for 4 partition records, 16 bytes each Last 2 bytes are signature

And that's right, but only for the MBR. If you set up an extended
partition in the MBR, the partition table for that extended partition is on the boot record of the extended partition. If you just backup the MBR, you only backup the *declaration* of the extended partition (where it starts, where it ends, etc.) but NOT the partition table of the extended partition (that is, the partitions within the extended partition). For storing that you have to backup the first sector of the extended partition itself. And you have to do it recursively if you want to backup any partition setup, no matter how strange.

I hope I've made this clear, is a bit difficult to explain
without a couple of diagrams O:)

Raúl Núñez de Arenas Coronado

Signature · 3 lines
Linux Registered User 88736 | http://www.dervishd.net
http://www.pleyades.net & http://www.gotesdelluna.net
It's my PC and I'll cry if I want to...
#8 lore raw
In reply to kernel
Quoted 3 lines

I always thought;

First 446 bytes are boot code and all

Right, of course. Otherwise it won't sum up to 512 bytes.

Jan Engelhardt

#9 lore raw
In reply to Konstantin Kudin

Hi Konstantin :)

* Konstantin Kudin <[email protected]> dixit:

Quoted 4 lines

Actually, it seems like one can backup information on ALL partitions
by using the command "sfdisk -dx /dev/hdX". Supposedly, it reads not only primary but also extended partitions. "sfdisk -x /dev/hdX" should be then able to write whatever is known back to the disk.

Cool! A long time has passed since I used sfdisk, but I used it
for manually re-reading partition tables and the like :)

Raúl Núñez de Arenas Coronado

Signature · 3 lines
Linux Registered User 88736 | http://www.dervishd.net
http://www.pleyades.net & http://www.gotesdelluna.net
It's my PC and I'll cry if I want to...
#10 lore raw
In reply to Horst von Brand

Hi Horst :)

* Horst von Brand <[email protected]> dixit:

Quoted 6 lines
Quoted 2 lines · DervishD

It's a good idea to have a copy of the partition table around, if
it is not simple (the one you had is NOT simple).

Be careful. What you'll get out of backing up the partition table is /only/ the primary partitions, the others are handled by a weird russian doll of partitions-inside-partitions. AFAIR, the details were in the LILO docu.

Note that I didn't suggest to backup or have a copy of the MBR,
but of the partition table, the FULL partition table (that includes the secondary partitions and the like. Once a disk is fully partitioned, a couple of 'dd' commands do the trick even for extended partitions.

It's a mess, anyway :(

Raúl Núñez de Arenas Coronado

Signature · 3 lines
Linux Registered User 88736 | http://www.dervishd.net
http://www.pleyades.net & http://www.gotesdelluna.net
It's my PC and I'll cry if I want to...
#11 lore raw

Re: Problem with usb-storage and /dev/sd?

In reply to a message not in the archive
Quoted 9 lines · DervishD

* Pete Zaitcev <[email protected]> dixit:

Quoted 5 lines · DervishD
Quoted 3 lines

I'm not using hotplug currently so... how can I make the USB
subsystem to assign always the same /dev/sd? entry to my USB Mass storage devices? [...]

You cannot. Just mount by label or something...

Mounting by label won't work, the problem is the /dev entry,
which changes every time.

That's why you should mount by label...

Quoted 5 lines
Quoted 2 lines

Better yet, install something like Fedora Core 4, which uses HAL, and forget about it. The fstab-sync takes care of the rest.

Oh no, thanks, I've already used Fedora and it only reinforced my
feeling about distros: I prefer my do-it-yourself box ;)

In Fedora rawhide it just works. I can't see how the knot you are tying yourself into by diy is any better...

Signature · 4 lines
Dr. Horst H. von Brand                   User #22616 counter.li.org
Departamento de Informatica                     Fono: +56 32 654431
Universidad Tecnica Federico Santa Maria              +56 32 654239
Casilla 110-V, Valparaiso, Chile                Fax:  +56 32 797513