Comment 3 for bug 1390819

Revision history for this message
Evan Langlois (uudruid74) wrote : Re: [Bug 1390819] Re: fdisk/cfdisk crashes and wrong data

Odd .. small update. I just noticed that parted was wrong, too! I don't
normally use it, but I had erroneously assumed that parted and gparted
shared the same code and would give the same results. The graphical
gparted and the gnome "Disks" tool both show the same output as blkid,
which is showing what the kernel shows. Everything else is wrong.

How can this be?

On Fri, Apr 10, 2015 at 9:52 AM Evan Langlois <email address hidden> wrote:

>
> Sorry it has taken me so long to get back to you.
>
> Here is blkid from util-linux 2.20.1 (libblkid 2.20.0, 19-Oct-2011)
>
> ekl@Taro ~ $ blkid
> /dev/sda1: LABEL="Elementary" UUID="7f117018-5bf9-4294-b268-a84176c057cc"
> TYPE="ext4"
> /dev/sda2: LABEL="GParted-live" TYPE="udf"
> /dev/sda3: SEC_TYPE="msdos" LABEL="EFI" UUID="5D94-05DA" TYPE="vfat"
> /dev/sda4: LABEL="/home" UUID="e57eb743-b91c-401c-8a45-92bcec9f8ba2"
> TYPE="ext4"
> /dev/sda5: LABEL="Sabayon" UUID="09c2e3c2-28dd-4f36-80ae-8df05f18ae4b"
> TYPE="ext4"
> /dev/sda6: LABEL="GuestSwap" UUID="cbbde82c-9fed-4af5-9c9c-69e2cef89032"
> TYPE="swap"
> /dev/sda7: LABEL="/media" UUID="8761ae41-8541-4e5a-8c3d-e35a063ad9b1"
> TYPE="ext4"
> /dev/sda8: LABEL="HostSwap" UUID="46196490-44bc-45aa-9ebb-246b62387374"
> TYPE="swap"
> /dev/sda9: LABEL="Funtoo" UUID="7c3903a5-4a80-4c75-b616-cc8a6176e2dc"
> TYPE="ext4"
> /dev/sda10: LABEL="TestSystem" UUID="20837010-382a-4bf7-81be-9a8b20503797"
> TYPE="ext4"
>
>
> ekl@Taro ~ $ parted
> WARNING: You are not superuser. Watch out for permissions.
> GNU Parted 2.3
> Using /dev/sda
> Welcome to GNU Parted! Type 'help' to view a list of commands.
> (parted) print
> Model: ATA HGST HTS541075A9 (scsi)
> Disk /dev/sda: 750GB
> Sector size (logical/physical): 512B/4096B
> Partition Table: gpt
>
> Number Start End Size File system Name Flags
> 1 1049kB 62.9GB 62.9GB ext4 Linux filesystem
> 9 62.9GB 126GB 62.9GB ext4 TestSystem
> 10 126GB 210GB 83.9GB ext4 Funtoo
> 2 210GB 210GB 210MB GNU Parted msftdata
> 4 210GB 218GB 8389MB ext4 Home
> 6 218GB 220GB 2097MB linux-swap(v1) GuestSwap
> 8 220GB 223GB 2097MB linux-swap(v1) HostSwap
> 7 223GB 742GB 520GB ext4 Storage
> 3 742GB 742GB 123MB fat16 EFI System boot
> 5 742GB 750GB 7733MB ext4 Sabayon
>
>
> Now the above is the correct information that the kernel sees. Below you
> will notice that the Funtoo partition and TestSystem are being shown with
> the wrong partition numbers. Partitions 9 and 10 are "swapped". This is
> going to lead to some problems. I've given the version numbers of each
> tool in the output.
>
>
> GNU cfdisk 1.2.5
>
> ATA HGST HTS541075A9
> Disk: /dev/sda Disk type: gpt Size: 750156374015B, 750156MB
> Heads: 255 Sectors per track: 63 Cylinders: 91201
>
> Number Flags Part Type Filesystem Label
> Size
>
> ------------------------------------------------------------------------------
> Primary Free space
> 1.03MB
> 1 Primary ext4 Linux filesys
> 62915MB
> 9 Primary ext4 TestSystem
> 62915MB
> 10 Primary ext4 Funtoo
> 83890MB
> 2 Primary GNU Parted
> 210MB
> 4 Primary ext4 Home
> 8389MB
> 6 Primary linux-swap(v1) GuestSwap
> 2097MB
> 8 Primary linux-swap(v1) HostSwap
> 2097MB
> 7 Primary ext4 Storage
> 519785MB
> Primary Free space
> 0.13MB
> 3 Bootable Primary fat16 EFI System
> 123MB
> Primary Free space
> 0.22MB
> 5 Primary ext4 Sabayon
> 7733MB
> Primary Free space
> 0.89MB
>
> GPT fdisk (gdisk) version 0.8.8
> Disk /dev/sda: 1465149168 sectors, 698.6 GiB
> Logical sector size: 512 bytes
> Disk identifier (GUID): 7783E637-93FE-4C66-A370-04DC6F474E95
> Partition table holds up to 128 entries
> First usable sector is 34, last usable sector is 1465149134
> Partitions will be aligned on 8-sector boundaries
> Total free space is 4446 sectors (2.2 MiB)
>
> Number Start (sector) End (sector) Size Code Name
> 1 2048 122882047 58.6 GiB 8300 Linux filesystem
> 2 409610240 410019839 200.0 MiB 0700 GNU Parted
> 3 1449801990 1450042964 117.7 MiB EF00 EFI System
> 4 410019840 426403839 7.8 GiB 8300 Home
> 5 1450043392 1465147391 7.2 GiB 8300 Sabayon
> 6 426403840 430499839 2.0 GiB 8200 GuestSwap
> 7 434595840 1449801727 484.1 GiB 8300 Storage
> 8 430499840 434595839 2.0 GiB 8200 HostSwap
> 9 122882048 245762047 58.6 GiB 8300 TestSystem
> 10 245762048 409610239 78.1 GiB 8300 Funtoo
>
>
> As you can see there is some subtle bug that both programs seem to share.
>
> -- Evan
>
>
> On Wed, Mar 18, 2015 at 1:35 PM Roderick Smith <email address hidden>
> wrote:
>
>> Please post example output; it's unclear to me what you mean by "showing
>> opposite labels for my 9th and 10th partitions (GPT)." Also, be aware
>> that the versions of fdisk and cfdisk delivered with Ubuntu through
>> version 14.04 don't support GPT, although 14.10's fdisk and cfdisk add
>> GPT support. Identifying the version of what you're running is
>> critically important in this case.
>>
>> Furthermore, GPT fdisk (gdisk, cgdisk, and sgdisk) all share most of
>> their code with each other, but almost none with the util-linux programs
>> (fdisk, cfdisk, and sfdisk). If you're seeing what seems to be an
>> inconsistency between fdisk and cfdisk and a similar inconsistency
>> between gdisk and cgdisk, the most likely explanation that occurs to me
>> is that your partitions are out of order -- both fdisk and gdisk display
>> partitions by their sequence number (/dev/sda1 followed by /dev/sda2
>> followed by /dev/sda3, and so on), whereas both cfdisk and cgdisk
>> display partitions by their on-disk order (the partition that occupies
>> the lowest-numbered sectors first, then the partition occupying the next
>> sequence of sectors, and so on). The two sequences need not be the same;
>> it's easy to generate a partition table in which /dev/sda10 comes before
>> /dev/sda9 in terms of on-disk extents. GParted is like cfdisk and cgdisk
>> in this respect. I don't recall what parted does, offhand.
>>
>> --
>> You received this bug notification because you are subscribed to the bug
>> report.
>> https://bugs.launchpad.net/bugs/1390819
>>
>> Title:
>> fdisk/cfdisk crashes and wrong data
>>
>> Status in gnu-fdisk package in Ubuntu:
>> New
>>
>> Bug description:
>> This is an odd bug. cfdisk and fdisk are both showing opposite labels
>> for my 9th and 10th partitions (GPT). The same bug is present in
>> gdisk/cgdisk (likely shares the same code). blkid, the linux kernel,
>> and parted/gparted show the correct partition table (or rather the
>> kernel matches what I configured into gparted, so that defines
>> "correct").
>>
>> Also, if you select "Info" when "Free Space" is highlighted in cfdisk,
>> the program will crash.
>>
>> Partitioning disks and having it done in a manner that is
>> deterministic and reliable is extremely important. It looks like the
>> linux-tools packages are totally outdated and dangerous on new systems
>> (don't support GPT), the gdisk/cgdisk packages only support GPT and
>> are buggy, the gnu-fdisk packages share the bugs and instabilities of
>> gdisk.
>>
>> Only parted/gparted is reliable. Please make note of this and either
>> get someone to fix/upgrade gnu-fdisk or just cancel fdisk completely
>> in support of parted.
>>
>> Thanks
>>
>> To manage notifications about this bug go to:
>> https://bugs.launchpad.net/ubuntu/+source/gnu-fdisk/+bug/139
>> 0819/+subscriptions
>>
>