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 683643 - Doesn't properly support partitionless drives.
Doesn't properly support partitionless drives.
Status: RESOLVED DUPLICATE of bug 743181
Product: gparted
Classification: Other
Component: application
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gparted maintainers alias
gparted maintainers alias
Depends on:
Blocks:
 
 
Reported: 2012-09-08 20:57 UTC by censlin
Modified: 2015-03-09 17:27 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
0001-Fix-loop-labels.patch (2.44 KB, patch)
2013-12-29 04:46 UTC, Phillip Susi
none Details | Review
0001-Fix-loop-labels.patch (4.34 KB, patch)
2014-01-04 03:37 UTC, Phillip Susi
none Details | Review
GParted details - [1] "format to" error (3.22 KB, text/html)
2014-01-12 20:17 UTC, Mike Fleetwood
  Details

Description censlin 2012-09-08 20:57:43 UTC
I have a drive that is entirely covered with a swap partition, without a partition table.GParted detects this partition as /dev/sdd1 when it should be /dev/sdd. This has a variety of implications, such as the swapon command attempting to work with the non-existent /dev/sdd1.

There is also no functionality for creating partitionless drives.
Comment 1 Curtis Gedak 2012-09-10 16:46:32 UTC
Thank you censlin for your interest in GParted and pointing out this discrepancy.

GParted was designed to work with partition tables.  As such, the incorrect detection of the device/partition name for a file system on a device lacking a partition table is not surprising.  Having said this, it would certainly be beneficial if GParted could at least properly recognize when a device has been entirely formatted with a file system instead of having a partition table.

The mission statement that guides development of the GParted application can be found at the following link:
http://gparted.org/development.php#mission-statement
Comment 2 Phillip Susi 2013-03-03 03:54:41 UTC
This appears to be caused by the way that libparted reports such devices.  It says the disk has a partition table of type "loop" with one partition that contains the whole drive.  gparted probably should notice this and strip the partition number when calculating the device path.
Comment 3 Phillip Susi 2013-03-13 17:32:08 UTC
Actually, the path comes from libparted, so it looks like that is where the bug lies.  I'll try to work up a patch.
Comment 4 Phillip Susi 2013-12-29 04:45:39 UTC
I have fixed bugs in both parted and gparted to solve this issue.  It turns out there are two bugs in gparted that the following patch fixes.  First, gparted was killing the parted loop label when trying to format the filesystem, causing it to fail, and second, it was trying to set/clear the LVM partition flag, even though most partition types do not support it, including the loop partition type.  Between the two patches, you can now use gparted on partitionless devices.  If it already has a filesystem on it, parted reports a "loop" label with a single partition containing the filesystem, and if not, you can create a loop label, then format the partition to the filesystem type of your choice.
Comment 5 Phillip Susi 2013-12-29 04:46:07 UTC
Created attachment 264983 [details] [review]
0001-Fix-loop-labels.patch
Comment 6 Phillip Susi 2014-01-04 03:37:17 UTC
Created attachment 265286 [details] [review]
0001-Fix-loop-labels.patch

Had to tweak the patch a bit.  It's working well for me now.
Comment 7 Mike Fleetwood 2014-01-04 18:00:07 UTC
Hi Phillip,

Can you point me to the patches for parted.  I assume they are necessary
because when testing the display of a partitionless device GParted is
getting back "/dev/md2p1" from ped_partition_get_path() for the name of
the first, only, partition.  This then caused GParted to use this
non-existent device to try to query the file system causing error like:

    tune2fs: No such file or directory while trying to open /dev/md2p1
    Couldn't find valid filesystem superblock.

Thanks,
Mike
Comment 8 Phillip Susi 2014-01-04 23:09:10 UTC
Yep, that was ( part of ) the problem.  I posted an updated patch last night to bug-parted@gnu.org.  I've also backported it to the debian package and have emailed it to Colin Watson and asked him to upload it, so hopefully it will get into debian unstable and ubuntu 14.04 soon.
Comment 9 Mike Fleetwood 2014-01-07 23:39:46 UTC
Hi Phillip,

While compiling parted v3.1-66-gcf16ea8 from git with your patch added
from http://lists.gnu.org/archive/html/bug-parted/2014-01/msg00001.html
I needed to fix this one line in the parted test case for it to pass.

--- a/tests/t1102-loop-label.sh	2014-01-07 15:29:18.220518291 +0000
+++ b/tests/t1102-loop-label.sh	2014-01-07 15:26:27.634837728 +0000
@@ -73,7 +73,7 @@
 # make sure partition busy check works ( mklabel checks whole disk )
 parted -s "$dev" rm 1 > out 2>&1; test $? = 1 || fail=1
 # create expected output file
-echo "Error: Partition /dev/sde is being used. You must unmount it before you modify \
+echo "Error: Partition $dev is being used. You must unmount it before you modify \
 it with Parted." > exp
 compare exp out || fail=1
 
Thanks,
Mike
Comment 10 Phillip Susi 2014-01-07 23:51:37 UTC
Woops, how did that slip in?  Thanks... the tests also fail on non 512 byte sector sizes because parted was still not fixed to detect filesystems there, hence the other patch I submitted to fix that.
Comment 11 Mike Fleetwood 2014-01-08 23:56:17 UTC
Hi Phillip,

From my testing so far it doesn't appear to be necessary to force the
creation of ext2/3/4 and ntfs file systems.  Do you have a scenario
where it was necessary?

Thanks,
Mike
Comment 12 Phillip Susi 2014-01-09 00:08:46 UTC
When you try to format a disk with no partition table, they complain that you have to force it to run on a whole disk.
Comment 13 Mike Fleetwood 2014-01-09 00:20:03 UTC
Mkfs of ext2/3/4 (e2fsprogs-1.42.7) and ntfs (ntfsprogs-2013.1.13)
certainly didn't require forcing on Fedora 19.

Which OS did require forcing to run on a whole disk and what were
the versions?
Comment 14 Phillip Susi 2014-01-09 01:11:46 UTC
Are you using a loop device or a real disk?  I'm using Ubuntu 13.10, so e2fsprogs-1.42.9 and ntfs3g-1:2013.1.13AR.1-2ubuntu1.
Comment 15 Mike Fleetwood 2014-01-09 08:22:06 UTC
Hi Phillip,

I'd done all my testing until now on Linux Software RAID arrays and
mkfs didn't require forcing on those.  Now I try on a whole disk it does
need forcing.  Sorry for the noise.

Thanks,
Mike
Comment 16 Mike Fleetwood 2014-01-12 20:17:17 UTC
Created attachment 266080 [details]
GParted details - [1] "format to" error

Hi Phillip,


When I format the pretend partition table which fills a loop labelled
disk I get the attached error.  The code sequence in GParted is like
this:
    format()
        erase_filesystem_signatures()
        create_filesystem()
        set_partition_type()
            get_device_and_disk()
            ped_file_system_type_get("ext4")
            ped_disk_get_partition_by_sector()
            ped_partition_is_flag_available()
            ped_partition_set_system()
            commit()
                ped_disk_commit_to_dev() -> 0  //fail
            commit_to_os()
                ped_disk_commit_to_os() -> 1  //success
Looks like a libparted issue to me.


I've reviewed the code and I would like you to make the following
changes:

1)  Change the first patch so that it only does this:
    In set_partition_type() for the loop label case add an operation
    detail message something like this:
        Skipped.  Unnecessary for loop labels
    and does nothing else.  Other partition types are treated as they
    are now.

2)  Move the adding of the force flags to creation of ext* and ntfs
    file systems into a second patch.

This works around the above error and keeps the original ordering and
informs the user why setting partition type is skipped:
    erase file system signatures
    set partition type (reports skipping for loop labels)
    create new file system


Thanks,
Mike
Comment 17 Phillip Susi 2014-01-13 03:27:26 UTC
Oops, I fixed that in the create path by switching the order of create_filesystem and set_partition_type.  I thought I got it in the format path too, but apparently not.

Why do you think the force flags should be in another commit?  It seems pretty tightly coupled to this change to me.
Comment 18 Mike Fleetwood 2014-01-13 11:17:12 UTC
Hi Phillip,

(In reply to comment #17)

> Oops, I fixed that in the create path by switching the order of
> create_filesystem and set_partition_type.  I thought I got it in the
> format path too, but apparently not.

See the order in the attached details.  You already did switch the order
to create_filesystem() then set_partition_type() in format case.  


> Why do you think the force flags should be in another commit?  It
> seems pretty tightly coupled to this change to me.

Most file systems can already be created on whole disks so just having
working loop label handling is a useful first patch.  Putting force
flags in a second patch allows (me to write) a more explicite commit
message showing the failure of mkfs.ext2 without the force flag.  Both
patches will still get tagged with this bug number.

Thanks,
Mike
Comment 19 Curtis Gedak 2014-03-26 17:45:38 UTC
Hi Phillip and Mike,

I was reviewing this report and if I have interpreted the progress correctly, both the libparted patches and gparted patches require work.

1)  Recent bug-parted mailing list thread on fix-loop-labels patch for
    libparted:
https://lists.gnu.org/archive/html/bug-parted/2014-03/msg00011.html

2)  Request thread for gparted patch changes starting with comment #16.

If I have misunderstood the status of this patch, then please feel free to correct me.

Curtis
Comment 20 Phillip Susi 2014-03-26 18:25:21 UTC
Mike wanted the gparted patches split up.  I've already taken care of the parted patch, just forgot to post the revised one to the mailing list.  I'll do that tonight and get it pushed soon and it will be in parted 3.4.  We can revisit this once that's out.
Comment 21 Curtis Gedak 2014-03-26 18:53:33 UTC
Hi Phillip,

Thank you again for working on both parted and gparted.  If there is some additional testing I can help with for the parted release, then please let me know.

I agree that we can revisit this patch once the libparted patch is more widely available either in a new release or at least a patched version in a distro.

In general I find that Mike's code is much easier to understand and hence maintain than my own code -- especially when I have to go back and look at it several months later.  As such I think his suggestions are good improvements.  The first suggestion in comment #16 would also help identify in the details log why the partition operation is skipped.

Curtis
Comment 22 Phillip Susi 2014-04-03 02:16:54 UTC
Good news!  The libparted fix for this has hit debian unstable as well as Ubuntu Trusty!
Comment 23 Curtis Gedak 2014-08-31 18:43:01 UTC
Hi Phillip,

It looks like libparted 3.2 includes several patches to fix loop labels, starting with:

libparted: fix loop labels to not vanish
http://git.savannah.gnu.org/cgit/parted.git/commit/?id=32d637298717446a4edd3c8fbe637462fab4c000

(Thanks for your efforts on parted 3.2 by the way. :-)

With the loop label fixes in libparted, now is probably a good time to revisit this patch.

Will you have time to revisit this patch and address the suggestions in comment #16?

Curtis
Comment 24 Curtis Gedak 2015-01-04 18:36:44 UTC
Hi Phillip,

Mike has been working on GParted read-only support for whole disk devices (no partition table).  It appears that libparted does not set up a virtual "loop" partition table if libparted does not recognize the disk signature (e.g., LVM2 PV or Reiser4).  As such Mike has pursued a different path.  See:

Bug 741430 - GParted cannot recognise LVM signature on unpartitioned drive

Curtis
Comment 25 Phillip Susi 2015-01-05 04:32:17 UTC
Right, so just like you do with any blank disk, you create a partition table.  In this case, you choose the loop label, and then you can format the fake partition with the filesystem of your choice.
Comment 26 Curtis Gedak 2015-01-05 16:44:36 UTC
Testing of patch in comment #6 using method from comment 25 has been posted in bug 741430 comment 15.
Comment 27 Curtis Gedak 2015-03-09 17:27:38 UTC
Portions of the patches in this report by Phillip have been incorporated into the following report:

   Bug 743181 - Add unpartitioned drive read-write support

Also thank you Phillip for fixing issues with "loop" labels in libparted.

Marking this report as a duplicate of the above listed report.

*** This bug has been marked as a duplicate of bug 743181 ***