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 741430 - GParted cannot recognise LVM signature on unpartitioned drive
GParted cannot recognise LVM signature on unpartitioned drive
Status: RESOLVED FIXED
Product: gparted
Classification: Other
Component: application
0.19.0
Other Linux
: Normal normal
: ---
Assigned To: gparted maintainers alias
gparted maintainers alias
Depends on:
Blocks:
 
 
Reported: 2014-12-12 10:42 UTC by tomchiukc@gmail.com
Modified: 2015-03-23 17:47 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Screen shot of GParted running on Ubuntu (303.58 KB, image/png)
2014-12-12 10:42 UTC, tomchiukc@gmail.com
  Details
read-only whole disk device support (v1) (44.54 KB, patch)
2014-12-30 12:05 UTC, Mike Fleetwood
none Details | Review
read-only whole disk device support (v2) (41.76 KB, patch)
2014-12-31 14:12 UTC, Mike Fleetwood
none Details | Review
Possible UI updates for read-only support (draft 1) (15.26 KB, patch)
2015-01-02 11:22 UTC, Mike Fleetwood
none Details | Review
read-only whole disk device support (v3) (42.14 KB, patch)
2015-01-11 14:00 UTC, Mike Fleetwood
none Details | Review
read-only whole disk device support (v4) (41.97 KB, patch)
2015-01-18 20:31 UTC, Mike Fleetwood
none Details | Review
read-only whole disk device support (v5) (41.96 KB, patch)
2015-02-02 18:41 UTC, Mike Fleetwood
none Details | Review

Description tomchiukc@gmail.com 2014-12-12 10:42:37 UTC
Created attachment 292605 [details]
Screen shot of GParted running on Ubuntu

When GParted is running on a system with LVM installed, it cannot recognise those disks being part of LVM.  Instead, it reported the disk is unallocated.  Also, when calling the program from root shell, you can see error message appearing on the terminal.  These messages are captured as below:

root@BKTKOWKS02:~# gparted --version
The program 'gparted' is currently not installed. You can install it by typing:
apt-get install gparted
root@BKTKOWKS02:~# apt-get install gparted
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  libgtkmm-2.4-1c2a
Suggested packages:
  xfsprogs reiserfsprogs reiser4progs jfsutils kpartx dmraid gpart
The following NEW packages will be installed:
  gparted libgtkmm-2.4-1c2a
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 1,180 kB of archives.
After this operation, 6,869 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://hk.archive.ubuntu.com/ubuntu/ trusty/main libgtkmm-2.4-1c2a amd64 1:2.24.4-1ubuntu1 [655 kB]
Get:2 http://hk.archive.ubuntu.com/ubuntu/ trusty/main gparted amd64 0.18.0-1 [524 kB]
Fetched 1,180 kB in 1min 57s (10.0 kB/s)                                       
Selecting previously unselected package libgtkmm-2.4-1c2a:amd64.
(Reading database ... 203764 files and directories currently installed.)
Preparing to unpack .../libgtkmm-2.4-1c2a_1%3a2.24.4-1ubuntu1_amd64.deb ...
Unpacking libgtkmm-2.4-1c2a:amd64 (1:2.24.4-1ubuntu1) ...
Selecting previously unselected package gparted.
Preparing to unpack .../gparted_0.18.0-1_amd64.deb ...
Unpacking gparted (0.18.0-1) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
Processing triggers for hicolor-icon-theme (0.13-1) ...
Processing triggers for gnome-menus (3.10.1-0ubuntu2) ...
Processing triggers for desktop-file-utils (0.22-1ubuntu1) ...
Processing triggers for mime-support (3.54ubuntu1) ...
Setting up libgtkmm-2.4-1c2a:amd64 (1:2.24.4-1ubuntu1) ...
Setting up gparted (0.18.0-1) ...
Processing triggers for libc-bin (2.19-0ubuntu6.4) ...
root@BKTKOWKS02:~# gparted &
[1] 7910
root@BKTKOWKS02:~# ======================
libparted : 2.3
======================

(gpartedbin:7933): GLib-CRITICAL **: Source ID 7 was not found when attempting to remove it

(gpartedbin:7933): GLib-CRITICAL **: Source ID 6 was not found when attempting to remove it

(gpartedbin:7933): GLib-CRITICAL **: Source ID 26 was not found when attempting to remove it

(gpartedbin:7933): GLib-CRITICAL **: Source ID 25 was not found when attempting to remove it

(gpartedbin:7933): GLib-CRITICAL **: Source ID 38 was not found when attempting to remove it

(gpartedbin:7933): GLib-CRITICAL **: Source ID 37 was not found when attempting to remove it

(gpartedbin:7933): GLib-CRITICAL **: Source ID 43 was not found when attempting to remove it

(gpartedbin:7933): GLib-CRITICAL **: Source ID 42 was not found when attempting to remove it

(gpartedbin:7933): GLib-CRITICAL **: Source ID 48 was not found when attempting to remove it

(gpartedbin:7933): GLib-CRITICAL **: Source ID 47 was not found when attempting to remove it

(gpartedbin:7933): GLib-CRITICAL **: Source ID 63 was not found when attempting to remove it

(gpartedbin:7933): GLib-CRITICAL **: Source ID 62 was not found when attempting to remove it

(gpartedbin:7933): GLib-CRITICAL **: Source ID 68 was not found when attempting to remove it

(gpartedbin:7933): GLib-CRITICAL **: Source ID 67 was not found when attempting to remove it

(gpartedbin:7933): GLib-CRITICAL **: Source ID 73 was not found when attempting to remove it

(gpartedbin:7933): GLib-CRITICAL **: Source ID 72 was not found when attempting to remove it

(gpartedbin:7933): GLib-CRITICAL **: Source ID 76 was not found when attempting to remove it

(gpartedbin:7933): GLib-CRITICAL **: Source ID 75 was not found when attempting to remove it

(gpartedbin:7933): GLib-CRITICAL **: Source ID 81 was not found when attempting to remove it

(gpartedbin:7933): GLib-CRITICAL **: Source ID 80 was not found when attempting to remove it

(gpartedbin:7933): GLib-CRITICAL **: Source ID 84 was not found when attempting to remove it

(gpartedbin:7933): GLib-CRITICAL **: Source ID 83 was not found when attempting to remove it

(gpartedbin:7933): GLib-CRITICAL **: Source ID 89 was not found when attempting to remove it

(gpartedbin:7933): GLib-CRITICAL **: Source ID 88 was not found when attempting to remove it

(gpartedbin:7933): GLib-CRITICAL **: Source ID 94 was not found when attempting to remove it

(gpartedbin:7933): GLib-CRITICAL **: Source ID 93 was not found when attempting to remove it

(gpartedbin:7933): GLib-CRITICAL **: Source ID 97 was not found when attempting to remove it

(gpartedbin:7933): GLib-CRITICAL **: Source ID 96 was not found when attempting to remove it

(gpartedbin:7933): GLib-CRITICAL **: Source ID 100 was not found when attempting to remove it

(gpartedbin:7933): GLib-CRITICAL **: Source ID 99 was not found when attempting to remove it

(gpartedbin:7933): GLib-CRITICAL **: Source ID 103 was not found when attempting to remove it

(gpartedbin:7933): GLib-CRITICAL **: Source ID 102 was not found when attempting to remove it

(gpartedbin:7933): GLib-CRITICAL **: Source ID 118 was not found when attempting to remove it

(gpartedbin:7933): GLib-CRITICAL **: Source ID 117 was not found when attempting to remove it
/dev/sdb: unrecognised disk label
/dev/sdc: unrecognised disk label
/dev/sdd: unrecognised disk label
/dev/sde: unrecognised disk label
/dev/sdf: unrecognised disk label
/dev/sdg: unrecognised disk label

[1]+  Done                    gparted
root@BKTKOWKS02:~# exit
Comment 1 Curtis Gedak 2014-12-12 18:14:02 UTC
Thank you Tom for your interest in GParted.

The error messages you mentioned were fixed in GParted 0.19.0.
See:  Bug 729800 - Prevent GSource double-destroy warning messages


Is there a partition table on the disk device?


Also would you be able to provide the output from the following three commands?

   sudo fdisk -l -u

where one of the options is a lower case "L" and not the number one.

   sudo parted /path-to-your-device unit s print

where /path-to-your-device is something like /dev/sda.

   sudo blkid
Comment 2 tomchiukc@gmail.com 2014-12-12 19:09:22 UTC
Here they are:

Disk /dev/sda: 1.4 TiB, 1500301910016 bytes, 2930277168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/sdc: 149.1 GiB, 160041885696 bytes, 312581808 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x0000c489

Device     Boot     Start       End   Sectors  Size Id Type
/dev/sdc1              63 150352334 150352272 71.7G 83 Linux
/dev/sdc3       300720735 312576704  11855970  5.7G  5 Extended
/dev/sdc5       300720798 312576704  11855907  5.7G 82 Linux swap / Solaris

Disk /dev/sdb: 1.4 TiB, 1500301910016 bytes, 2930277168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x73743eaf

Device     Boot Start        End    Sectors  Size Id Type
/dev/sdb1  *       63 2930272064 2930272002  1.4T  7 HPFS/NTFS/exFAT

Disk /dev/mapper/myVG-myNAS: 1.4 TiB, 1500298346496 bytes, 2930270208 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
tom@bkgovsrv1:~$ 

tom@bkgovsrv1:~$ sudo parted /dev/sda unit s print
Error: /dev/sda: unrecognised disk label
Model: ATA ST31500341AS (scsi)                                            
Disk /dev/sda: 2930277168s
Sector size (logical/physical): 512B/512B
Partition Table: unknown
Disk Flags: 
tom@bkgovsrv1:~$ 
tom@bkgovsrv1:~$ sudo parted /dev/sdb unit s print
Model: ATA ST31500341AS (scsi)
Disk /dev/sdb: 2930277168s
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start  End          Size         Type     File system  Flags
 1      63s    2930272064s  2930272002s  primary  ntfs         boot

tom@bkgovsrv1:~$ sudo parted /dev/sdc unit s print
Model: ATA ST3160815AS (scsi)
Disk /dev/sdc: 312581808s
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start       End         Size        Type      File system     Flags
 1      63s         150352334s  150352272s  primary   ext3
 3      300720735s  312576704s  11855970s   extended
 5      300720798s  312576704s  11855907s   logical   linux-swap(v1)

tom@bkgovsrv1:~$ 

tom@bkgovsrv1:~$ sudo blkid
/dev/sda: UUID="4zgM9v-qdyk-kQLv-Ldim-hrbS-5TGq-jbUJrf" TYPE="LVM2_member" 
/dev/sdc1: UUID="bf18ed1c-a5bb-429b-acbe-d73de724a8b4" TYPE="ext3" PARTUUID="0000c489-01" 
/dev/sdc5: UUID="c617999a-b0b9-4015-b8b2-5ad487465459" TYPE="swap" PARTUUID="0000c489-05" 
/dev/sdb1: LABEL="1.5TB" UUID="8A68C1B468C19EF7" TYPE="ntfs" PARTUUID="73743eaf-01" 
/dev/mapper/myVG-myNAS: UUID="e5639007-cc1b-4fc1-8363-ab75ccf4d38f" TYPE="ext4" 
tom@bkgovsrv1:~$ 

Hope it helps.

And I am already running GParted 0.19.0.  Here is the error when I start it:

root@bkgovsrv1:~# gparted &
[1] 11427
root@bkgovsrv1:~# Failed to get D-Bus connection: No connection to service manager.
Too few arguments.

(process:11464): Gtk-WARNING **: Locale not supported by C library.
	Using the fallback 'C' locale.
======================
libparted : 3.2
======================
Fontconfig warning: "/etc/fonts/conf.d/29-language-selector-zh.conf", line 8: Having multiple values in <test> isn't supported and may not work as expected
/dev/sda: unrecognised disk label
Too few arguments.
Comment 3 Mike Fleetwood 2014-12-12 20:53:23 UTC
Hi Tom,

(In reply to comment #2)
> tom@bkgovsrv1:~$ sudo parted /dev/sda unit s print
> Error: /dev/sda: unrecognised disk label
...
> Partition Table: unknown

> tom@bkgovsrv1:~$ sudo blkid
> /dev/sda: UUID="4zgM9v-qdyk-kQLv-Ldim-hrbS-5TGq-jbUJrf" TYPE="LVM2_member"

So your setup has LVM covering the whole sda disk without using a
partition table such as MSDOS or GPT.  Unfortunately this configuration
is not currently supported by GParted and libparted, the library used
to query and manipulate disks and partitions.

Libparted 3.2 has support for "loop" partition tables allowing it to
to recognise and probably manipulate a file system covering the whole
disk.  This bug report was working on adding that support to GParted
too.
    Bug 683643 - Doesn't properly support partitionless drives

However even if this bug was complete libparted still doesn't recognise
LVM2 PV signatures, so GParted wouldn't be able to recognise them
either.

Mike
Comment 4 Mike Fleetwood 2014-12-21 16:13:19 UTC
Hi Curtis,

Can you review the follow approach to see if seems reasonable.


Create a new partition table type of "none".

* Created when blkid recognised a signature on the device when libparted
  reports unrecognised.

* Optionally created to replace when libparted reports "loop" type too.
  This will allow GParted to recognise whole device use even on older
  libparted versions which have broken loop partition type handling.
  (Anything before libparted <= 3.1 and possibly even libparted 3.2).
  Doing this will interfere with making GParted work with libparted
  "loop" partition tables in bug 683643.  Perhaps don't do this until
  read-write support for partition type "none" is done.

* Have a single Partition object covering the whole device to report
  file system usage via.  Use the whole device name as the partition
  device_path.

* Optionally change the "Partition" heading to "Device" when displaying
  a device with partition type "none"; or
  always display as "Partition / Device"; or
  just leave it as it is.

* For read-only support ensure all Partition actions are disabled on the
  faked Partition object.


I plan to leave read-write support for another time so won't consider it
now.


Thanks,
Mike
Comment 5 Mike Fleetwood 2014-12-30 12:05:40 UTC
Created attachment 293474 [details] [review]
read-only whole disk device support (v1)

Hi Curtis,

Here's the patchset to provide read-only support for file systems on
whole disk devices.  The last patch will be the most controversial, but
given the state of libparted <= 3.1 with "loop" partition table is seems
necessary.

If you have any thoughts what read-write support looks like, let me
know.  I plan to start working on that next, but probably under a new
bug report.

Thanks,
Mike
Comment 6 Curtis Gedak 2014-12-30 21:54:28 UTC
Hi Mike,

Wow, it sure looks like you've been busy.  Thanks for working on this
enhancement.

Following are comments from my initial review of the patch set in
comment #5.  Overall these patches look reasonable to me.

PATCH COMMENT
----- -------

2/9:  I like the way you cleaned up the detection of file systems when
      other methods fail.  I initially thought that you missed the
      LVM2 detection need to read sector 1 for devices with sector
      size = 512 bytes, or sector 0 for devices with sector size >
      512.  However I noticed that you used the same method of
      "offset / sector_size" as found in btrfs detection.  Your new
      code should make it easier to add manual detection of other file
      systems as needed.  Great work!

4/9:  This is a cautionary note that we need to be consistent in how we
      use terminology.  For example I had named file system volume
      labels as "Partition Labels" which more recently causes
      confusion with actual GPT partition labels.  If I had been more
      careful earlier then this confusion might have been avoided.

      More specifically, my caution is that this patch changes
      get_partition_path() to return a partition path, and now a device
      path.  A device path is not consistent with the method name.  We
      might wish to consider renaming the method.

      Having said that, I know we are trying to adapt GParted to work
      with devices using code that was written for partitions.  This
      compromise might be an okay path forward at this point in time.

6/9:  Minor spelling mistakes.

      In commit message, "show" should be "shown".

        "... currently be show ..."

      In comment above void GParted_Core::set_device_one_partition()
      declaration, "equlivant" should be "equivalent"

9/9:  Due to the challenges of earlier libparted versions not working
      correctly with loop partition tables, I agree with handling
      whole devices directly in GParted as you have done with this
      patch.  :-)

In addition, from comment #4 I like your suggestion to also
"optionally change the 'Partition' heading to 'Device' when displaying
a device with partition type 'none'".

Alternatively, we might either enhance "View -> Device Information" to
include additional whole device format details, or create a new
"Device -> Information" dialog similar to "Partition -> Information".


Please note that I have not extensively tested this patch set yet.  In
my initial testing, both the old functionality and new enhancements
appear to be working.


Regarding the topic of write support for whole devices without
partition tables, I have some thoughts:

a) We will need to be cautious of the difference between when
   libparted does not recognize the partition table, and when
   libparted does not list partitions due to other errors such as
   overlapping partitions.

b) We should be consistent in our user interface menus.  Right now I'm
   thinking that whole device write actions would need new entries
   under the "Device" menu for thinks such as "Format", "Label
   volume", and "New UUID".

Curtis
Comment 7 Mike Fleetwood 2014-12-31 14:12:45 UTC
Created attachment 293520 [details] [review]
read-only whole disk device support (v2)

Hi Curtis,


Here's patchset v2.  Changes compared to v1:

P 4/9:
  Leaves get_partition_path() alone.  Instead puts the special case in
  get_filesystem().  Later small knock-on in set_device_one_partition()
  in P 6/9.

P 6/9:
  Corrects spelling mistakes.


I agree naming is important to get right.  In the "Partition Labels"
case GParted conflates partitions and file systems for UI simplification
so it is not until we try to add partition names that the issue becomes
apparent.  (In fact this will be a reoccuring theme providing difficult
choices for this whole disk device work).


One thing I have already found from my initial foray into read-write
support is that we now have two types of storage represented in
GParted_Core.  Those where we use libparted PedDevice, PedDisk and
PedPartition on libparted managed partitioned disk devices and those
where we just use libparted PedDevice on whole disk devices.  This will
effect calibrate_partition() and a number of other modification
functions in the module.


Will think about the UI choices more and see if I can test DMRaid using
"dmraid -f isw ...".


Thanks,
Mike
Comment 8 Mike Fleetwood 2015-01-02 11:22:51 UTC
Created attachment 293597 [details] [review]
Possible UI updates for read-only support (draft 1)

Hi Curtis,

Here's some code for you to try and see what extra items to the Device
menu looks like for handling whole disk device file systems.  Makes a
few other small UI changes too as already discussed.  Applies on top of
patchset v2 from comment #7.

Please try it and see what you think.

Thanks,
Mike
Comment 9 Mike Fleetwood 2015-01-02 11:26:21 UTC
I think ...

after trying GParted with the extra Device menu items that it is the
wrong thing to do.  The other UI tweeks around changing the title from
Partition to Device naming are cosmetic, mostly won't be noticed and are
wrong too.

I think that we should stick with the partition and file system
conflation we have now.  What we have were is a whole disk device and we
have a pretend (virtual if you like) partition containing the file
system.  It fits with the existing disk graphic and partition list which
GParted has always presented to the user.  Write support will use the
items on the partition menu to select relevant actions.  This seems the
most natural way forward to me.

As such I think that patchset v2 from comment #7 is ready and that we
shouldn't mess with the UI for read-only support.

Mike
Comment 10 Curtis Gedak 2015-01-02 21:07:39 UTC
Hi Mike,

Thank you for exploring the "possible UI updates for read-only support" in comment #8.  I agree with you that this does not seem like the right path forward.  The duplication of menu entries under Device and Partition seem confusing.  It wasn't until I actually saw the in the menus that I realized it was a bad idea.

The patch set v2 in comment #7 looks good to me, and in my testing works for non-partitioned devices and does not regress for any partitioned device functionality.

I plan to do some more testing.  If I don't hear any reason to hold off on patch set v2, then I will commit it in the next day or so.

Curtis
Comment 11 Curtis Gedak 2015-01-03 16:17:43 UTC
Hi Mike,

Last night I had another thought regarding write support for non-partitioned devices.  Since GParted is written primarily to support partitioned devices, and newer libparted versions (3.2+?) support non-partitioned devices using a "loop" partition table, perhaps we should consider limiting write support to the libparted versions that work correctly.  This might make the code simpler.

Curtis
Comment 12 Mike Fleetwood 2015-01-04 10:42:54 UTC
Hi Curtis,

Unfortunately libparted only creates "loop" partition tables when it
recognises signatures on whole disk devices.  If it doesn't recognise
anything there won't be a virtual "loop" partition table or virtual
partition to work with.
    ped_disk_new() returns NULL.
    ped_disk_next_partition(disk, part) requires disk to be non-NULL to
        get a partition.

This will mean that a whole disk device containing LVM2 PV, reiser4 or a
few other file system types not recognised by libparted won't be able to
be modified or reformatted, regardless of the version of libparted.
This behaviour only depends on the content of the whole disk device.

Therefore calibrate_partition() and various other manipulation functions
in GParted_Core will need to handle two types of disks: those with
recognised partition tables and can use PedDevice, PedDisk and
PedPartition; and those without a recognised partition table and can
only use PedDevice.

Mike
Comment 13 Curtis Gedak 2015-01-04 18:43:52 UTC
Hi Mike,

Thank you for the explanation.  I had not realised this limitation in libparted (i.e., only creates "loop" if disk signature recognized).

Using Fedora 21 (lipbarted 3.2) and OpenSUSE 13.2 (libparted 3.1) I tested this bug's patch set and the the patch in:

   Bug 683643 - Doesn't properly support partitionless drives.

The Bug 683643 patch fails to recognize LVM2 PV and Reiser4 (as expected).
The patch in this report does recognize LVM2 PV and Reiser4.

As such I believe that patch set v2 in comment #7 is our best path forward at this point in time.

I added a note to Bug 683643 regarding the libparted limitation you discovered.

Tomorrow I plan to commit patch set v2 to the git repository.

Curtis
Comment 14 Phillip Susi 2015-01-05 04:31:45 UTC
You seem to be following the gist of the idea from libparted, only using the name "none" instead of "loop" for the faked partition table type.  libparted doesn't recognize lvm as a "filesystem" currently, which is why this doesn't work.  I'm planning on fixing that when I get around to it, so in the mean time I'd say gparted should just work around that lacking by pretending to see a "loop" label with a single partition containing the lvm filesystem, which is what libparted will report when I get to that.
Comment 15 Curtis Gedak 2015-01-05 16:38:37 UTC
Thank you Phillip for looking at this patch set.

Using the method from bug 683643 comment 25 for working with unpartitioned disks, I ran some tests with the patch from bug 683643 comment 6 in a VM with Fedora 21 and libparted-3.2-4.fc21.

In my testing, I was able to create a "loop" partition for the unpartitioned disk, then format the "loop" partition.

When I choose a format that is *known* to libparted (e.g., ext4, fat32), the operation completes successfully and upon GParted refresh, libparted sets up the "loop" partition.

When I choose a format that is *unknown* to libparted (e.g., LVM2 PV), the operation mostly completes, but in the end libparted indicates "unrecognized partition table".

The big plus to the patch from bug 683643 is that it permits unpartitioned formatting when used with a libparted version with your "loop" improvements.

The downside is that the patch from bug 683643 does not work well with older libparted versions or unknown formats (at least for read-only).

Because we are trying to ensure that GParted works with currently supported versions of GNU/Linux which use older versions of libparted, I still believe that the patch set v2 in comment #7 is a step forward for read-only support of unpartitioned disks.  We still have some work to do for write support of unpartitioned disks.

Curtis
Comment 16 Phillip Susi 2015-01-05 18:34:19 UTC
This seems like a fairly large change just to get half working support for whole disk filesystems on old libparted, but if you think it is worth it, it seems to me that my patch should also be applied and the exception this set adds to disable operations on the "loop" label be made contingent on libparted < 3.2, that way you can get the best of both.
Comment 17 Curtis Gedak 2015-01-06 02:15:28 UTC
Hmm.... that might work, at least for write support for file systems recognized by libparted 3.2.  For other file systems I think we'd still need to fall back to handling the recognition in GParted.

What do you think Mike?
Comment 18 Mike Fleetwood 2015-01-06 18:43:03 UTC
Hi Curtis and Phillip,


I have a vision of providing partitionless support in GParted without
using libparted "loop" partition tables so that we can fully support
partitionless drives regardless of the libparted version used and
whether or not libparted recognises the file system.  To this end
everything I have coded in this patchset so far has been necessary
cleanup and read-only support of the new "none" partition type.


The best case for libparted "loop" partition support is with version
3.2, with the patch from bug 683643 comment 16, where it supports most
file systems.  But if the file system covering the whole device is:
LVM2 PV, reiser4 or a hand full of other types it becomes unrecognised
to libparted and therefore can't be managed as a device containing a
virtual "loop" partition table.  Therefore I need to code GParted so
that the partition/file system manipulation operations in GParted_Core
work using only libparted PedDevice, and not using PedDisk disk label or
PedPartition.  Exactly this code will enable GParted to create and
modify file systems on whole disk devices with libparted 3.1 and earlier
too.

I deliberately chose the name "none" so that:
1) it was a descriptive partition type for users to understand;
2) it was distinct to libparted's "loop" partition type so that as
   coders we would understand that it didn't rely on libparted's "loop"
   partition type support.


Assuming that I intend to produce read-write support for partitionless
drives in GParted, and I do; then making the libparted related changes
from the patch from bug 683643 comment 16, mearly provides a short term
capability to create and manipulate most, but not all, file systems when
using the most recent version of libparted.  GParted will become a
little inconsistant in that it can create and manipulate most file
systems on whole disk devices when using libparted 3.2, and fail with
others.  This is only useful if we do a release of GParted before I can
code write support for partitionless drives in GParted.

The changes to add the force flag to mkfs for NTFS and ext2/3/4 are
needed and I can include them in my read-write patchset later.


Thanks,
Mike
Comment 19 Phillip Susi 2015-01-06 19:55:31 UTC
Going that way means carrying around all of this code forever.  It would be much better to align with libparted and eventually be able to drop the small amount of work around code required for older versions of libparted.  This keeps gparted cleaner and easier to maintain.
Comment 20 Curtis Gedak 2015-01-06 20:47:40 UTC
Hi Mike and Phillip,

It seems that there are pros and cons to both approaches.

If we provide the unpartitioned device read/write in GParted, then a broader audience can access the functionality.  However this does mean extra code in GParted to be supported.

If we rely on libparted to handle the loop partition, then this means less changes to the GParted code and less to maintain.  However this does mean that only a portion of read/write functionality is available, even with libparted 3.2.  It also means that full unpartitioned read/write functionality will have to wait until wider adoption of to-be-developed libparted code.

My gut feel is that if Mike is up to developing the read/write support in GParted, then that would be best for our users for the near term.  Later we can revisit using libparted to provide the functionality when improved support is available in libparted.

In the meantime, I will hold off on committing any changes in this area.

Curtis
Comment 21 Mike Fleetwood 2015-01-11 14:00:29 UTC
Created attachment 294272 [details] [review]
read-only whole disk device support (v3)

Hi Curtis,

Here's v3 of the read-only whole disk device support patchset.

Corrects a bug in this patch:
4/9 - Support querying whole disk devices for signatures

For partitions which libparted doesn't recognise and blkid does and
GParted can't recognise itself, it would fail to recognise such
partitions.  On CentOS 6 w/ libparted 2.1 this is only Linux SWRaid.
It did this because the check at the start of ::get_filesystem() to
determine the name of the device incorrectly used the whole disk device
if libparted didn't recognise the partition contents, rather than only
when there wasn't a partition.

Mike
Comment 22 Mike Fleetwood 2015-01-18 20:31:11 UTC
Created attachment 294813 [details] [review]
read-only whole disk device support (v4)

Hi Curtis,

Here's v4 of the read-only whole disk device support patchset.

Changes this patch:
6/9 - Display whole disk file systems via partition table "none"

Changes partition table type "none" from a translatable string to a non-
translatable string.  Needed because the two patches following it both
do string compares against "none" to determine actions and they would
break if translated.  Note that table types from libparted are string
compared in the code too and aren't translated.  Only GParted
"unrecognized" table table is translated and never compared.

Thanks,
Mike
Comment 23 Mike Fleetwood 2015-01-19 13:46:00 UTC
Raised separate bug 743181 to track adding read-write support of
unpartitioned drives.
Comment 24 Mike Fleetwood 2015-02-02 18:41:07 UTC
Created attachment 295967 [details] [review]
read-only whole disk device support (v5)

Here's patchset v5.  Only difference is to rebase on top of current git
master.  Specifically:
  p5/9 - Create helper function set_partition_label_and_uuid() (#741430)
    Adapt to changes made in bug 741424.

Thanks,
Mike
Comment 25 Curtis Gedak 2015-03-09 16:42:10 UTC
My testing has confirmed that this latest patch set does indeed correctly recognize file system formats on whole devices without partition tables.

Hence patch set v5 from comment #24 has been committed to the git repository for inclusion in the next release of GParted.

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

Reorder crypt-luks detection (#741430)
https://git.gnome.org/browse/gparted/commit/?id=bd9c76f602e0ef4eafe96cfe04818c33ecb3d13e

Refactor GParted internal file system signature detection (#741430)
https://git.gnome.org/browse/gparted/commit/?id=cb645b16cf6cb6f0d04b693440e88c8d994aac52

Rename local variable to fsname in get_filesystem() (#741430)
https://git.gnome.org/browse/gparted/commit/?id=a9f08ddc7dd615b0ce4eb62098439514605fc998

Support querying whole disk devices for signatures (#741430)
https://git.gnome.org/browse/gparted/commit/?id=005a842f2522afe7f37990e8d52da8f7b58f9158

Create helper function set_partition_label_and_uuid() (#741430)
https://git.gnome.org/browse/gparted/commit/?id=ed827cf59ad1bc83a31063945b778126951a3a34

Display whole disk file systems via partition table "none" (#741430)
https://git.gnome.org/browse/gparted/commit/?id=cbf8bd741d21390e1e7d252f32cd61fc2779e222

Disable manipulation operations on "none" partition tables (#741430)
https://git.gnome.org/browse/gparted/commit/?id=dd049e8b4b46eb810de60bcfc454de75bd65a527

Set activate/deactivate partition menu item name earlier (#741430)
https://git.gnome.org/browse/gparted/commit/?id=474c5b10b3488698e09b7e1fcbdc6013492e0eb6

Display libparted "loop" partition tables via "none" instead (#741430)
https://git.gnome.org/browse/gparted/commit/?id=f5c044142c742da40c53c022d8f4f02537158f4c
Comment 26 Curtis Gedak 2015-03-23 17:47:56 UTC
This enhancement was included in the GParted 0.22.0 release on March 23, 2015.