Go to file
Mike Fleetwood 0e980a47a2 Pass devid when resizing btrfs file systems (#723842)
GParted doesn't specify the devid when resizing a btrfs file system, so
the kernel defaults to resizing devid 1.  On a multi-device btrfs this
may not be the same partition which GParted is resizing.  This will
result in file system truncation and corruption.  Shrinking the wrong
partition example:

    1)  Create a btrfs file system spanning 2 partitions:
            # mkfs.btrfs /dev/sdb1 /dev/sdb2
            # btrfs filesystem show /dev/sdb1
            Label: none  uuid: 41654265-9840-45c4-aca1-55989da358d6
                    Total devices 2 FS bytes used 112.00KiB
                    devid    1 size 2.00GiB used 437.50MiB path /dev/sdb1
                    devid    2 size 2.00GiB used 417.50MiB path /dev/sdb2

    2)  Resize /dev/sdb2 down to 1 GiB using GParted.  This command was
        run:
            btrfs filesystem resize 1048576K /tmp/gparted-ddyGRh
        which resized devid 1 (/dev/sdb1) to 1 GiB:
            # btrfs filesystem show /dev/sdb1
            Label: none  uuid: 41654265-9840-45c4-aca1-55989da358d6
                    Total devices 2 FS bytes used 256.00KiB
                    devid    1 size 1.00GiB used 437.50MiB path /dev/sdb1
                    devid    2 size 2.00GiB used 417.50MiB path /dev/sdb2
        but GParted instead resized /dev/sdb2 to 1 GiB:
            # sfdisk -s /dev/sdb1
            2097152
            # sfdisk -s /dev/sdb2
            1048576

Even on a single device btrfs devid 1 may no longer exist if the file
system has had the initial device removed from it.  Example:

    1)  Create a single btrfs file system, add a second device and
        remove the first:
            # mkfs.btrfs /dev/sdb1
            # mount /dev/sdb1 /mnt/1
            # btrfs device add /dev/sdb2 /mnt/1
            # btrfs device remove /dev/sdb1 /mnt/1
            # umount /mnt/1
            # btrfs filesystem show /dev/sdb2
            Label: none  uuid: 2cbf3ac3-1344-472a-a0c7-1476d23bdc9f
                    Total devices 1 FS bytes used 256.00KiB
                    devid    2 size 2.00GiB used 480.00MiB path /dev/sdb2

    2)  Again resize /dev/sdb2 down to 1 GiB using GParted.  This
        command was run:
            btrfs filesystem resize 1048576K /tmp/gparted-ddyGRh
        but it failed with:
            ERROR: unable to resize 'tmp/gparted-lEyGaY' - No such device
        A more informative error message was written to syslog:
            # tail -1 /var/log/messages
            Mar 12 14:15:01 localhost kernel: btrfs: resizer unable to find device 1

This is with Linux kernel 3.13.5 on Fedora 20, circa March 2014.

Fix by specifying the devid when resizing (part of) a btrfs file system.
Example command specifying devid 2:

    btrfs filesystem resize 2:1048576K /tmp/1

This will always work because it is the kernel which interprets the
devid colon size parameter and has always done so since btrfs was first
added to the kernel in version 2.6.32 [1].

Reference:
[1] linux v2.6.32 fs/btrfs/ioctl.c btrfs_ioctl_resize()
    https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/fs/btrfs/ioctl.c?id=v2.6.32#n578

Bug #723842 - GParted resizes the wrong filesystem (does not pass the
              devid to btrfs filesystem resize)
2014-07-28 10:03:16 -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 Update copyright year 2011-01-16 10:45:25 -07:00
help Updated Brazilian Portuguese translation 2014-07-14 15:57:51 +00:00
include Add devid to the cache of btrfs device information (#723842) 2014-07-28 10:03:16 -06:00
po Updated German translation 2014-07-15 05:41:50 +00:00
src Pass devid when resizing btrfs file systems (#723842) 2014-07-28 10:03:16 -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 Update AUTHORS 2013-03-19 22:13:34 +00: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
ChangeLog Add note that ChangeLogs are no longer used 2009-04-19 15:19:15 -06:00
HACKING Don't show intrinsic unallocated space (#499202) 2012-06-18 12:41:59 -06:00
Makefile.am Add an AppData file (#709164) 2013-11-24 11:42:02 +00:00
NEWS ========== gparted-0.19.1 ========== 2014-07-15 09:39:15 -06:00
README doap: update URLs 2014-04-04 20:27:48 +02:00
autogen.sh Stop using locate in autogen.sh (#702040) 2013-06-14 10:17:02 -06:00
configure.ac Make ./configure fail when C++ compiler is missing (#732803) 2014-07-20 09:18:39 -06:00
gparted.appdata.xml.in Actually translate the AppData file 2013-11-25 01:09:09 +01:00
gparted.desktop.in.in Correct desktop files for name and generic name entries (#600048) 2009-11-02 13:57:25 -07:00
gparted.doap doap: update URLs 2014-04-04 20:27:48 +02:00
gparted.in Prevent GParted starting stopped Linux Software RAID arrays (#709640) 2013-10-19 10:21:09 -06:00
testbuild.sh Add testbuild.sh script (#699881) 2013-05-27 11:08:39 -06:00

README

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

   Building Gparted from source requires that several dependencies are
   installed.  These include:
      g++
      e2fsprogs
      parted
      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++

   Briefly, the shell commands `./configure; make; make install' should
   configure, build, and install this package.

   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)  A version of libparted that includes the online resize patch.
          At time of writing (November 2013), this patch was only
          included in Debian and derived distros with parted package
          version 2.3-14 or higher.
      b)  Linux kernel version 3.6 or higher.
   Enable 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.


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