After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 746204 - Creating partitions on pc98 table fails with lvm flag not available
Creating partitions on pc98 table fails with lvm flag not available
Status: RESOLVED FIXED
Product: gparted
Classification: Other
Component: application
GIT HEAD
Other Linux
: Normal normal
: ---
Assigned To: gparted maintainers alias
gparted maintainers alias
Depends on:
Blocks:
 
 
Reported: 2015-03-14 12:07 UTC by Mike Fleetwood
Modified: 2015-08-03 17:29 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Only set lvm partition flag when supported (v1) (9.03 KB, patch)
2015-03-14 12:44 UTC, Mike Fleetwood
none Details | Review

Description Mike Fleetwood 2015-03-14 12:07:47 UTC
Attempting to create a new partition on a pc98 partition table fails
with the following libparted error:
    
    The flag 'lvm' is not available for pc98 disk labels.

Fix to follow.
Comment 1 Mike Fleetwood 2015-03-14 12:44:48 UTC
Created attachment 299400 [details] [review]
Only set lvm partition flag when supported (v1)

Hi Curtis,

Here's the fix for this bug.  As noted in the commit message this was
first broken when LVM2 PV read-write was first added in GParted 0.14.0.
So I guess that no body actually uses PC98 partition tables.

The diff for P1/2 Refactor set_partition_type() ... isn't easy to read.
Better of looking at the old and new source side by side.

Phillip did have a fix for this in his code for bug 68343, in
attachment 265286 [details] [review].  I used the same libparted
ped_partition_is_flag_available() call, but my code is completely
different.

It does add one new translatable string so you may not want to include
it in GParted 0.22.0.

Thanks,
Mike
Comment 2 Curtis Gedak 2015-03-15 17:15:22 UTC
Thanks Mike for re-discovering this problem, providing a patch set, and the heads-up about a new translatable string.

As you suggested, it is best that we hold this patch set until after the 0.22.0 release.  We are in a string freeze while the translators do their important work.

Regarding PC98 partitition tables, I'm not even sure what operating system uses these.  I do recall a forum post about PC98, but in that case PC98 was incorrectly chosen and didn't work with the user's operating system.  As you also mentioned, I think it is extremely rare that PC98 partition tables are used.

Curtis
Comment 3 Curtis Gedak 2015-03-24 17:26:01 UTC
Hi Mike,

I seem to be challenged in trying to test this patch set.  I'm working in a Fedora 21 VM, and have been unable to create a partition on a PC98 partition table, both with and without the patch set in comment #1.

The steps I am using are:

1)  Device -> Create Partition Table.  Select PC98, and apply.

2)  Partition -> New.  Select ext4 or lvm2 pv, and click Add.

3)  Apply all operations and the partition creation fails with libparted message:

      Unable to satisfy all constraints on the partition.

Would you be able to re-test this patch set on top of GParted-0.22 to see if it works for you?

Thanks,
Curtis
Comment 4 Mike Fleetwood 2015-03-24 19:27:36 UTC
Just re-tested this.

CentOS 6 w/ libparted 2.4.

Test 1) 256 MiB device (scsi_debug device, 512b sector size)
Create pc98 partition table.
Create lvm2 pv partition filling the disk.
Success.

Test 2) 1TB device.
Create pc98 partition table.
Create lvm2 pv partition filling the disk.
Fails with libparted message:
  Unable to satisfy all constraints on the partition

Test 3) 512 MiB device (linux software raid array)
Create pc98 partition table.
Create lvm2 pv partition filling the disk.
Reports libparted Error dialog:
    (-) Invalid argument during seek for write on /dev/md126
        [Retry] [Cancel] [Ignore]
Canceling leaves a 254MiB unrecognised partition behind.
Then format to lvm2 pv.
Correctly reports skipping setting the lvm flag.

If you Ingore instead you get a libparted Bug dialog:
    (-) Assertion (ped_partition_is_active(part)) at disk.c:1411
        in function ped_partition_is_flag_available() failed.
        [ OK ]
After OK, core dump and backtrace at this point in libparted.

Guess that pc98 has a maximum device size and/or partition size that is
really small and that libparted is a bit broken with respect to pc98
partition tables.

Thanks,
Mike
Comment 5 Curtis Gedak 2015-03-24 23:54:49 UTC
Hi Mike,

Thanks for retesting, and the heads up about smaller partitions and
PC98 appearing to be less than ideally supported.

All of my partition creation tests fail when I use a PC98 partition
table.  Even if I choose "unformatted" as the file system and a
partition as small as 1 MiB.

So either PC98 is severely broken in GParted/Libparted, or I am
missing something that is key to successfully creating a PC98
partition.


Can you create PC98 partitions in VM's other the CentOS 6 and
libparted 2.4?


Since I am unable to successfully test this, and because I do not
think there are many people using PC98, I would be willing to commit
the patch set just based on your testing.  The changes do not appear
to break msdos partition tables.


Following are my test results from trying to create 64 MiB and 256 MiB
partitions in a PC98 partition table:

                           Partition created successfully?
                           -------------------------------------
                           ext4     ext4      lvm2 pv   lvm2 pv
Distro            Parted   64 MiB   256 MiB   64 MiB    256 MiB
---------------   ------   ------   -------   -------   --------
Debian    7        2.3     No        No       No        No
Fedora   20        3.1     No        No       No        No
Fedora   21        3.2     No        No       No        No
openSUSE 12.3      2.4     No        No       No        No
openSUSE 13.2      3.1     No        No       No        No
Ubuntu   14.04     2.3     No        No       No        No


  The warning message from libparted after failure to create a
  partition is:

    Unable to satisfy all constraints on the partition.

Curtis
Comment 6 Mike Fleetwood 2015-03-25 09:31:04 UTC
Hi Curtis,

Testing with GParted 0.22.0 + patchset v1 from comment #1.

CentOS 5, libparted 1.8.1 - doesn't support pc98 tables

CentOS 7, libparted 3.1

T1) 8 GiB device - 256 MiB partition
    Unable to satisfy all constraints on the partition

T2) 8 GiB device - 64 MiB partition
    Unable to satisfy all constraints on the partition

T3) 1 GiB device - 1 GiB partition
    libparted error: Invalid argument during seek for write on /dev/md1
    [Retry] [Cancel] [Ignore]
    Choose [Cancel]
    Get a 254 MiB partition with no content

T4) 512 MiB device - 512 MiB partition
    libparted error: Invalid argument during seek for write on /dev/md2
    [Retry] [Cancel] [Ignore]
    Choose [Cancel]
    Get a 254 MiB partition with no content

T5) 256 MiB device - 256 MiB partition
    Works

Fedora 21, libparted 3.2

T1-T4) Same as above on CentOS 7

T5) 256 MiB device - 256 MiB partition
    Errors at "lvm pvreate -M 2 /dev/md3p1" step
    Device /dev/md3p1 not found (or ignored by filtering)
    Kernel hasn't been informed of the partition (not in
    /proc/partitions) and device file doesn't exist.

Taking a guess I would say that pc98 tables (at least as implemented by
libparted) are limited to devices 256 MiB and smaller.  Would all your
virtual disks be 1 GiB or larger?

On Fedora 21 libparted/kernel/udev don't actually load the partitions
into the kernel or create device entries.  PC98 tables really are badly
supported.

Thanks,
Mike
Comment 7 Curtis Gedak 2015-03-25 15:51:29 UTC
Thank you Mike for the extra testing.  And yes, all my virtual disks are 1 GiB or larger.  That explains why every single one of my tests failed.

Based on your test results I have committed the patch set in comment #1 to the git repository.

The relevant git commits can be viewed at the following links:

Refactor set_partition_type() setting lp_partition earlier (#746204)
https://git.gnome.org/browse/gparted/commit/?id=c882666e3af63951c6a2d55c09c75a5953650366

Only set lvm partition flag on tables which support it (#746204)
https://git.gnome.org/browse/gparted/commit/?id=e9cc0b15a5517809379448b06ea1eeb42f6ac01b
Comment 8 Curtis Gedak 2015-08-03 17:29:08 UTC
This enhancement was included in the GParted 0.23.0 release on August 3, 2015.