]> git.ipfire.org Git - thirdparty/util-linux.git/commit
fdisk: don't care about partition type
authorKarel Zak <kzak@redhat.com>
Mon, 25 Nov 2013 11:00:55 +0000 (12:00 +0100)
committerKarel Zak <kzak@redhat.com>
Mon, 25 Nov 2013 11:00:55 +0000 (12:00 +0100)
commitd0a870c5b3f57309edd81021ca4c9174380cfb56
tree30073ef6e63240dd8ea3d352b23a142cbee6c8b3
parent488cc17a992089820fcb26733ffa7c5faf857691
fdisk: don't care about partition type

fdisk allows to overwrite existing partition if the partition has
partition type set to zero (very unusual, but possible).

This is incorrect because such partition is pretty valid (and Linux
kernel does not care about the type at all). For example:

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048       22527       10240   83  Linux
/dev/sdb2           22528      227327      102400    0  Empty
                    ^^^^^                            ^^^^^^^^

Command (m for help): n
Partition type:
   p   primary (1 primary, 0 extended, 3 free)
   e   extended
Select (default p):
Using default response p
Partition number (3,4, default 3):
First sector (22528-1228799, default 22528):
                                    ^^^^^^^

.. if user follows the default then the result are overlapping
partitions:

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048       22527       10240   83  Linux
/dev/sdb2           22528      227327      102400    0  Empty
/dev/sdb3           22528     1228799      603136   83  Linux
                    ^^^^^

... and if you call "mkfs /dev/sdb3" then you lost data on sdb2. Sad
thing.

Reported-by: Marc MERLIN <marc@merlins.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
libfdisk/src/dos.c