Find a file
Mike Fleetwood 9c1a833a0d Fix failure to recognise whole disk file systems in certain cases (#743181)
When the following conditions were met GParted would fail to recognise a
newly created whole disk device file system, and instead show an unknown
file system filling the disk:

1) Disk was previously partitioned and contained at least one partition.

2) Using libparted version 2.0 to 3.0 inclusive.

Initial status:
    # blkid | fgrep sdc
    # fgrep sdc /proc/partitions
       8       32  976762584 sdc
       8       33  104857600 sdc1
    # parted /dev/sdc
    GNU Parted 2.4
    Using /dev/sdc
    Welcome to GNU Parted! Type 'help' to view a list of commands.
    (parted) print
    Model: ATA ST1000LM024 HN-M (scsi)
    Disk /dev/sdc: 1000GB
    Sector size (logical/physical): 512B/4096B
    Partition Table: msdos

    Number  Start   End    Size   Type     File system  Flags
     1      1049kB  107GB  107GB  primary

When creating the loop partition table libparted would not inform the
kernel to delete the old partitions.  /proc/partitions still contained
the details of the old partitions.
    (parted) mktable loop
    Warning: The existing disk label on /dev/sdc will be destroyed and
    all data on this disk will be lost. Do you want to continue?
    Yes/No? Yes
    (parted) print
    Model: ATA ST1000LM024 HN-M (scsi)
    Disk /dev/sdc: 1000GB
    Sector size (logical/physical): 512B/4096B
    Partition Table: loop

    Number  Start  End  Size  File system  Flags

    (parted) quit
    # fgrep sdc /proc/partitions
       8       32  976762584 sdc
       8       33  104857600 sdc1

Creation of the whole disk device file system goes unnoticed by blkid
because the kernel and therefore blkid's cache have stale partition
information.
    # mkfs.xfs -f /dev/sdc
    # blkid | fgrep sdc

NOTE:
On a Linux Software RAID array, as opposed to a hard disk, blkid does
notice creation of the whole disk device file system.  However the
kernel still has old partition details.

This was fixed in libparted 3.1 by commit:

    http://git.savannah.gnu.org/cgit/parted.git/commit/?id=f5c909c0cd50ed52a48dae6d35907dc08b137e88
    libparted: remove has_partitions check to allow loopback partitions

Fix by deleting old partitions before creating the loop table when
compiled with a broken version of libparted.  The GParted UI provides
no feedback while a new partition table is created, and with some
versions of GTK the UI become unresponsive too, so it is important to be
as fast as possible.  Evaluated three different methods, deleting 15 and
22 MSDOS partitions on a physical 5400 RPM hard drive using libparted
2.4:

M1) Delete and commit one partition at a time.
    Takes up to 24 seconds to delete 15 partitions.  With 22 partitions
    libparted always reports finding some of the partitions busy and
    unable to inform the kernel about the modifications.
    Too slow and doesn't work.

M2) Delete all partitions in one go and commit once.
    Takes up to 1.4 seconds to delete either 15 or 22 partitions.  Never
    removes partitions 17 and higher from the kernel.
    Doesn't work.

M3) Write GPT table (letting libparted delete any old partitions).
    Takes up to 0.8 seconds to delete either 15 or 22 partitions.
    Fast and works.

Use method 3 - write a GPT table thus using libparted code to inform the
kernel of the old partition deletions.

Bug 743181 - Add unpartitioned drive read-write support
2015-03-09 11:04:13 -06:00
compose Replace obsolete FSF postal address in copyright notices (#721565) 2014-01-26 10:53:23 +00:00
data Only install fallback icon when required (#695279) 2013-04-28 13:51:06 -06:00
doc Correctly capitalise GNOME in the Manual and man page (#739805) 2014-12-20 10:02:55 -07:00
help Updated Swedish translation 2015-03-08 12:36:28 +00:00
include Fix failure to recognise whole disk file systems in certain cases (#743181) 2015-03-09 11:04:13 -06:00
po Updated Russian translation 2015-03-05 23:07:30 +00:00
src Fix failure to recognise whole disk file systems in certain cases (#743181) 2015-03-09 11:04:13 -06:00
.cvsignore ignore all projectfiles 2004-09-29 13:15:57 +00:00
.gitignore Add an AppData file (#709164) 2013-11-24 11:42:02 +00:00
AUTHORS Provide credit for patch by Michael Zimmermann 2015-02-01 11:01:41 -07:00
autogen.sh Stop using locate in autogen.sh (#702040) 2013-06-14 10:17:02 -06:00
ChangeLog Correctly capitalise GNOME in the Manual and man page (#739805) 2014-12-20 10:02:55 -07:00
configure.ac Fix failure to recognise whole disk file systems in certain cases (#743181) 2015-03-09 11:04:13 -06:00
COPYING Revert "Fixed FSF's address. Fixes #721565" 2014-01-31 14:39:20 +01:00
COPYING-DOCS Added COPYING-DOCS and removed help/C/legal.xml file. The GFDL license should be translated only once per language, and not for each and every project that uses the license. See GParted bug #550047 2008-09-01 17:01:14 +00:00
gparted.appdata.xml.in Actually translate the AppData file 2013-11-25 01:09:09 +01:00
gparted.desktop.in.in Add keywords to the desktop file 2014-12-18 17:57:36 +00:00
gparted.doap Correctly capitalise GNOME in the Manual and man page (#739805) 2014-12-20 10:02:55 -07:00
gparted.in Prevent GParted starting stopped Linux Software RAID arrays (#709640) 2013-10-19 10:21:09 -06:00
HACKING Don't show intrinsic unallocated space (#499202) 2012-06-18 12:41:59 -06:00
Makefile.am Tidyup Autoconf check for --disable-doc (#734076) 2014-08-31 11:04:36 -06:00
NEWS ========== gparted-0.21.0 ========== 2015-01-26 10:01:46 -07:00
README README: Correct env variables to build using specific libparted version 2014-09-20 11:53:23 +01:00
testbuild.sh Add testbuild.sh script (#699881) 2013-05-27 11:08:39 -06:00

GPARTED
=======
Gparted is the GNOME Partition Editor for creating, reorganizing, and
deleting disk partitions.

A hard disk is usually subdivided into one or more partitions.  These
partitions are normally not re-sizable (making one smaller and the
adjacent one larger.)  Gparted makes it possible for you to take a
hard disk and change the partition organization, while preserving the
partition contents.

More specifically, Gparted enables you to create, destroy, resize,
move, check, label, and copy partitions, and the file systems
contained within.  This is useful for creating space for new operating
systems, reorganizing disk usage, and mirroring one partition with
another (disk imaging).

Gparted can also be used with storage devices other than hard disks,
such as USB flash drives, and memory cards.

Visit http://gparted.org for more information.


LICENSING
---------
GParted is released under the General Public License version 2, or (at
your option) any later version.  (GPLv2+).  All files are released under
the GPLv2+ unless explicitly licensed otherwise.

The GParted Manual is released under the GNU Free Documentation License
version 1.2 or any later version.  (GFDLv1.2+).

See these files for more details:
   COPYING      - GNU General Public License version 2
   COPYING-DOCS - GNU Free Documentation License version 1.2


NEWS
----
Information about changes to this release, and past releases can be
found in the file:
   NEWS


INSTALL
-------
a. Pre-built Binary

   Many GNU/Linux distributions already provide a pre-built binary
   package for GParted.  Instructions on how to install GParted on
   some distributions is given below:

      Debian or Ubuntu
      ----------------
      sudo apt-get install gparted

      Fedora or CentOS/RHEL
      ---------------------
      su -
      yum install gparted

      OpenSUSE
      --------
      sudo zypper install gparted

b. Building from Source

   Briefly, build and install GParted into the default location of
   /usr/local using:
      ./configure
      make
      sudo make install
   This assumes all the dependencies are already installed and builds
   the default configuration.

   The following dependencies are required to build GParted from source:
      g++
      e2fsprogs
      parted
      gnome-common
      gtkmm24
      gettext
      gnome-doc-utils     - required if help documentation is to be built

   On Debian or Ubuntu, these dependencies may be obtained by running
   one of the following commands:
     Either;
      sudo apt-get build-dep gparted
     Or;
      sudo apt-get install build-essential e2fsprogs uuid uuid-dev \
                           gnome-common libparted-dev libgtkmm-2.4-dev \
                           libdevmapper-dev gnome-doc-utils docbook-xml

   On Fedora, you will need to run (as root);
      yum install gtkmm24-devel parted-devel e2fsprogs-devel gettext \
                  'perl(XML::Parser)' desktop-file-utils libuuid-devel \
                  gnome-doc-utils docbook-dtds rarian-compat intltool \
                  gnome-common gcc-c++
      yum groupinstall 'Development Tools'

   On openSUSE, these dependencies may be obtained by running the
   following commands;
      sudo zypper install automake autoconf make gnome-common \
                          libuuid-devel parted-devel gtkmm2-devel \
                          gnome-doc-utils-devel docbook-xsl-stylesheets
      sudo zypper install -t pattern devel_c_c++

   Again, build GParted with the default configuration and install into
   the default location of /usr/local using:
      ./configure
      make
      sudo make install

   If you wish to build this package without the help documentation use
   the --disable-doc flag:
      E.g., ./configure --disable-doc

   If you wish to build this package for use on a desktop that does not
   support scrollkeeper use the --disable-scrollkeeper flag:
      E.g., ./configure --disable-scrollkeeper

   If you wish to build this package to use native libparted /dev/mapper
   dmraid support use the --enable-libparted-dmraid flag:
      E.g., ./configure --enable-libparted-dmraid

   If you wish to build this package with online resize support then
   the following is required:
      a)  Linux kernel version 3.6 or higher.
      b)  Libparted with online resize support.  Either:
          i)  Libparted version 3.2 or later which includes online
              resize support as standard.  In this case GParted is
              automatically built with online resize support.
          ii) Online resize support back ported into an earlier version
              of libparted.  This is only known to be included in Debian
              and derived distributions with parted version 2.3-14 and
              higher.  In this case online resize support must be
              specifically enabled with the --enable-online-resize flag:
                E.g., ./configure --enable-online-resize

   Please note that more than one configure flag can be used:
      E.g., ./configure --disable-doc --enable-libparted-dmraid

   The INSTALL file contains further GNU installation instructions.

c. Building using a Specific (lib)parted Version

   1) Download the parted version you wish to use (e.g., 3.2) from:

      http://ftp.gnu.org/gnu/parted/

   2) Build and install parted.

      Extract parted tarball, configure, make, and sudo make install.
      Note that by default this will install into /usr/local.

   3) Set environment variables to inform the GParted build system to
      use libparted from /usr/local:

        export CPPFLAGS=-I/usr/local/include
        export LDFLAGS=-L/usr/local/lib
        export LD_RUN_PATH=/usr/local/lib

   4) Build gparted using steps listed above in "Building from Source".

      Note that when you run ./configure you should see the specific
      version of parted listed in the check for libparted >= 1.7.1.

      You will also see the libparted version listed when running
      gparted from the command line.


DIRECTORIES
------------
compose  - contains String::ucompose() function

data     - contains desktop icons

doc      - contains manual page documentation

help     - contains GParted Manual and international translations

include  - contains source header files

m4       - contains macro files

po       - contains international language translations

src      - contains C++ source code


DISTRIBUTION NOTES
------------------
Gparted uses GNU libparted to detect and manipulate devices and partition
tables.  Several optional packages provide additional file system support.
Optional packages include:

   btrfs-tools
   e2fsprogs
   f2fs-tools
   dosfstools
   mtools          - required to read and write FAT16/32 volume labels and UUIDs
   hfsutils
   hfsprogs
   jfsutils
   nilfs-utils
   ntfsprogs / ntfs-3g
   reiser4progs
   reiserfsprogs
   xfsprogs, xfsdump

   NOTE:  * If the vol_id command is in the search PATH, it will be used
            to read linux-swap, reiser4, hfs, and hfs+ file system
            volume labels.
          * If the blkid command is in the search path, it will be used
            to read file system UUIDs and labels.  It is also used for
            ext4 file system detection.
            blkid is part of the util-linux package and e2fsprogs
            package before that.


For dmraid support, the following packages are required:

   dmsetup         - removes /dev/mapper entries
   dmraid          - lists dmraid devices and creates /dev/mapper entries

For GNU/Linux distribution dmraid support, the following are required:
   - kernel built with Device Mapping and Mirroring built.  From menuconfig,
     it is under Device Drivers -> <something> (RAID & LVM).
   - dmraid drive arrays activated on boot (e.g., dmraid -ay).


For LVM2 Physical Volume support the following command is required:
   lvm             - LVM2 administration tool
And device-mapper support in the kernel.


For attempt data rescue for lost partitions, the following package
is required:
   gpart           - guesses PC-type hard disk partitions


Several more commands are optionally used by GParted if found on the system.
These commands include:

   blkid         - used to read volume labels and detect ext4 file systems
   vol_id        - used to read volume labels
   udisks        - used to prevent automounting of file systems
   devkit-disks  - used to prevent automounting of file systems
   {filemanager} - used in attempt data rescue to display discovered
                   file systems.  (e.g., nautilus, pcmanfm)
   hal-lock      - used to prevent automounting of file systems
   gksudo        - used to acquire root privileges in .desktop file,
                   but only if available when gparted source is configured.
   gksu          - alternatively used to acquire root privileges in .desktop
                   file if gksu not available, but only if available when
                   gparted source is configured.
   kdesudo       - alternatively used to acquire root privileges in .desktop
                   file if gksudo and gksu not available, but only if available
                   when gparted source is configured.
   xdg-su        - alternatively used to acquire root privileges in .desktop
                   file if gksudo, gksu, and kdesudo are not available, but only
                   if available when gparted source is configured.
   udevinfo      - used in dmraid to query udev name
   udevadm       - used in dmraid to query udev name
   yelp          - used to display help manual