OSDN Git Service

[PATCH] fix /proc/partitions display with USB-FDD geometry
authorWilly TARREAU <willy@pcw.(none)>
Thu, 20 Apr 2006 09:08:08 +0000 (11:08 +0200)
committerWilly TARREAU <willy@pcw.(none)>
Sun, 7 May 2006 18:58:57 +0000 (20:58 +0200)
commit0b070a5b47b7378768d0f14fb49c5ebf2ba1d07e
treeb1b358d9a87ec071880c2a4ba0461bae8e7c720d
parent6865793264cc0e0b20f3fd93c06b1c6b8481ec62
[PATCH] fix /proc/partitions display with USB-FDD geometry

When an USB flash disk is formatted under as a floppy (without partitions),
random partitions appear in /proc/partitions depending on the code and data
used by the boot loader at the offset where the partition table is expected :

   8     0     128000 sda
   8     1  985184692 sda1
   8     2  271759162 sda2
   8     3 1093808825 sda3
   8     4      26721 sda4

Such layout appears when Windows is used to format the USB stick, or when
putting a boot-loader such as syslinux on an device.

A patch was introduced in 2.6 to fix this by ensuring that all 4 partitions
boot flags are either 0x00 or 0x80 before interpreting the boot sector as an
MBR.

This fix has been back-ported to 2.4 by Gilles Espinasse. The behaviour has
been carefully tested, and 2.4.32 with this patch now behaves as 2.6.16 in
that such USB sticks are correctly detected without partitions, while others
still work correctly :

   8     0     128000 sda   => 128 MB USB stick formatted under windows
   8     0     261216 sdb   => 256 MB USB stick which contains a real partition
   8     1     261040 sdb1
fs/partitions/msdos.c