Commit Graph

2523 Commits

Author SHA1 Message Date
Mike Fleetwood 46acc4c0f6 Small update to source build instructions
Make the standard three steps to build GParted more prominent by
repeating them at the top of the Building from Source section in the
README file.
2014-09-14 10:43:38 -06:00
Balázs Úr 2b4caf756b Updated Hungarian translation 2014-09-11 18:29:48 +00:00
Dušan Kazik 480a03715a Updated Slovak translation 2014-09-10 16:00:00 +00:00
Marek Černocký beadfd6f46 Updated Czech translation 2014-09-09 15:48:21 +02:00
Andika Triwidada 89403ddfe6 Updated Indonesian translation 2014-09-05 08:07:52 +00:00
Daniel Mustieles b3d0081b0f Updated Spanish translation 2014-09-01 19:14:21 +02:00
Mike Fleetwood e8533c39c2 Prevent automake warning about deprecated INCLUDES (#735742)
Automake 1.13 and later generates the following warning when building
GParted from git:

    $ ./autogen.sh
    ...
    checking for automake >= 1.9...
      testing automake-1.13... found 1.13.4
    ...
    Running automake-1.13...
    src/Makefile.am:1: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
    ...

INCLUDES name has been depreciated since automake 1.7.  GParted's
autogen.sh and configure.ac require at least automake 1.9.  Therefore
replace automake variable INCLUDES with AM_CPPFLAGS.

Bug #735742 - automake warns INCLUDES is deprecated
2014-08-31 11:19:57 -06:00
Mike Fleetwood 20158f0440 Tidyup Autoconf check for --disable-doc (#734076)
Use AC_ARG_ENABLE() and AS_HELP_STRING() macros to improve handling of
the --disable-doc option.

Change the names, and sence, of the Autoconf and Automake definitions
used to control building of the help documentation.  Reasons are:
(1) Switch from negative to positive statements which are more natural
    to comprehend.
(2) Insert HELP in the names from *_DOC to *_HELP_DOC as they control
    building of the documentation in the help subdirectory, not the
    manual page in the doc directory.

Autoconf: HAVE_DISABLE_DOC -> ENABLE_HELP_DOC
Automake: DISABLE_DOC      -> BUILD_HELP_DOC

Bug #734076 - Autodetect parted online partition resizing capability
2014-08-31 11:04:36 -06:00
Mike Fleetwood 5c73f3de57 Tidy up Autoconf check for --enable-libparted-dmraid (#734076)
Use AC_ARG_ENABLE() Autoconf macro to set enable_libparted_dmraid
variable to either yes or no in all cases, whether set on the command
line or not.  Use AS_HELP_STRING() macro to format the option help text.

Bug #734076 - Autodetect parted online partition resizing capability
2014-08-31 11:04:36 -06:00
Mike Fleetwood af05344095 Automatically enable online resize with libparted >= 3.2 (#734076)
Configure script checks for libparted version >= 3.2 to automatically
determine the availability of online resize capability in libparted.
This can be overridden from the ./configure command line.  Override
enable when an older version of libparted has been patched to include
online resize support with:

    ./configure --enable-online-resize

Override disable with libparted 3.2 or later to disable the feature when
it is not wanted with:

    ./configure --disable-online-resize

Note that GParted also requires, and checks for at runtime, Linux
kernel >= 3.6 for online resize support.  See commit for more details:

    de2844d02d
    Add online resize support (#694622)

Bug #734076 - Autodetect parted online partition resizing capability
2014-08-31 11:04:35 -06:00
Hannie Dumoleyn 4400b62e8f Updated Dutch translation Master 2014-08-31 18:19:10 +02:00
Josef Andersson d894bb5010 Updated Swedish translation 2014-08-23 18:43:16 +00:00
Mike Fleetwood 3030118caf Pass link libraries via LIBS variable into Makefiles (#734718)
Currently -lparted is passed to the linker by being hard coded in the
gpartedbin_LDFLAGS variable in src/Makefile.am and -lparted-fs-resize
by conditionally being appended to the gpartedbin_LDFLAGS.

Add an Autoconf AC_CHECK_LIB check for the parted library using it's
default action-if-found to extend LIBS.  Update the existing
AC_CHECK_LIB check for the parted-fs-resize library so that the
overridden action-if-found also extends LIBS with -lparted-fs-resize.
These libraries are then assigned via the LIBS variable in the
generated Makefiles.

This matches how the other libraries, dl and uuid, were found in the
configure script and passed to the Makefiles.

Bug #734718 - Update Autoconf version specific libparted checks and
              defines to feature specific ones
2014-08-18 15:48:34 -06:00
Mike Fleetwood bb17f44e99 Only check libparted version once and cache the result (#734718)
Configure.ac still builds and runs very similar test executables twice
to determine in the version of libparted is >= minimum require 1.7.1 and
2.2 for improved partition re-read code.

Build and run a single test to determine the version of libparted and
cache the result.  Use this cached version number when testing the
version of libparted.  Inspired by the version checking for intltool
from /usr/share/aclocal/intltool.m4.

Bug #734718 - Update Autoconf version specific libparted checks and
              defines to feature specific ones
2014-08-18 15:48:34 -06:00
Mike Fleetwood 080b3b080d Only check for ped_file_system_resize() once if possible (#734718)
If ped_file_system_resize() function is found in the parted library
don't bother to go on to check for it in the parted-fs-resize library.

Bug #734718 - Update Autoconf version specific libparted checks and
              defines to feature specific ones
2014-08-18 15:48:34 -06:00
Mike Fleetwood ed4ea6cf03 Rename HAVE_LIBPARTED_2_2_0_PLUS define into feature names (#734718)
Remove HAVE_LIBPARTED_2_2_0_PLUS definition

Rename version specific #define HAVE_LIBPARTED_2_2_0_PLUS into two
separate feature specific names set as required:

    Name                                  Set when?

    ENABLE_PT_REREAD_WORKAROUND           (libparted < 2.2)
    USE_LIBPARTED_LARGE_SECTOR_SUPPORT    (libparted >= 2.2)

Using feature specific #defines is the standard Autoconf way and makes
the resultant conditional code easier to understand.  Still have to
check the version of libparted though.

Bug #734718 - Update Autoconf version specific libparted checks and
              defines to feature specific ones
2014-08-18 15:48:34 -06:00
Mike Fleetwood eb7b706f23 Use specific Autoconf check for FS resize capability in libparted (#734718)
Replace Autoconf check for libparted >= 3.0

Currently uses a custom check which compiles an executable to check for
libparted version >= 3.0 to determine if the ped_file_system_resize()
function exists in the parted library.

Change to use a direct Autoconf check to determine the availability of
the ped_file_system_resize() function in the parted library.

Bug #734718 - Update Autoconf version specific libparted checks and
              defines to feature specific ones
2014-08-18 15:48:34 -06:00
Mike Fleetwood 288c4dbf2e Remove little used HAVE_LIBPARTED_3_0_0_PLUS definition (#734718)
Remove HAVE_LIBPARTED_3_0_0_PLUS definition

The #define only controls whether fat16 and fat32 file systems are moved
by libparted (for versions <= 2.4) or the GParted internal algorithm
(for libparted versions >= 3.0).  See this commit for more details:
    0fda1d011d
    Enable new fs resize library available with parted-3.1 (#668281)

As nearly all other file system are moved using the GParted internal
algorithm, just always use it to move fat16 and fat32 file systems too.

Bug #734718 - Update Autoconf version specific libparted checks and
              defines to feature specific ones
2014-08-18 15:48:34 -06:00
Mike Fleetwood c1db9811e1 Use Autoconf check specifically for libparted-fs-resize (#734718)
Remove HAVE_LIBPARTED_3_1_0_PLUS definition and replace Autoconf
    check for libparted >= 3.1

Currently uses custom check which compiles an executable to check for
libparted version >= 3.1 to determine the availability of the library
parted-fs-resize and the need to include the header <parted/filesys.h>.

Change to use a direct Autoconf check to determine the availability of
the ped_file_system_resize() function in the parted-fs-resize library.
Remove inclusion of the header <parted/filesys.h> as it has always been
included via <parted/parted.h>, at least as far back as parted 1.8.0,
and even in parted 3.0 when ped_file_system_resize() and libparted file
system resize capability didn't exist.

Bug #734718 - Update Autoconf version specific libparted checks and
              defines to feature specific ones
2014-08-18 15:48:34 -06:00
Mike Fleetwood 654cdc7335 Update AM_PROG_LIBTOOL to AC_PROG_LIBTOOL in configure.ac (#734718)
AM_PROG_LIBTOOL is an old name and alias for AC_PROG_LIBTOOL.  Update.

NOTE:
In turn AC_PROG_LIBTOOL is an old name and alias for LT_INIT, but
CentOS 5.x with libtool 1.5.22 doesn't have LT_INIT defined in
/usr/share/aclocal/libtool.m4 serial 48, only AC_PROG_LIBTOOL and
AM_PROG_LIBTOOL.  Therefore only update to AC_PROG_LIBTOOL and not
LT_INIT while CentOS 5.x is supported.

Bug #734718 - Update Autoconf version specific libparted checks and
              defines to feature specific ones
2014-08-18 15:48:34 -06:00
Mike Fleetwood 2cd82dfc38 Removed unused variable need_work_around from configure.ac (#734718)
Bug #734718 - Update Autoconf version specific libparted checks and
              defines to feature specific ones
2014-08-18 15:48:34 -06:00
Marek Černocký 4cba385a0e Updated Czech translation 2014-08-16 12:55:47 +02:00
Curtis Gedak 805f42c7c4 Add GParted Live USB flash drive tip to help manual (#734376)
Add tip that the GParted Live image can be written to a USB flash
drive to be used in computers that can boot from USB.

Bug 734376 - Add GRUB 2 Restore Steps to GParted Manual
2014-08-14 12:31:21 +01:00
Curtis Gedak bc7573e45a Improve wording of fixing OS boot problem section in help manual (#734376)
Place more emphasis on the instructions to restore GRUB, and less on
other boot loaders.

Bug 734376 - Add GRUB 2 Restore Steps to GParted Manual
2014-08-14 12:31:21 +01:00
Curtis Gedak fcccf377f2 Remove duplication in fixing GRUB boot section of help manual (#734376)
Part of the list of actions that could cause a computer to fail to
boot were duplicated.  Remove this duplication from the fixing GRUB
boot problems section of the help manual.

Bug #734376 - Add GRUB 2 Restore Steps to GParted Manual
2014-08-14 12:31:21 +01:00
Curtis Gedak 4501c0394f Add GRUB Legacy live media boot step to help manual (#734376)
Bug #734376 - Add GRUB 2 Restore Steps to GParted Manual
2014-08-14 12:31:21 +01:00
Curtis Gedak fa7c38f166 Add GRUB 2 restoration steps to help manual (#734376)
Also add short description of GRUB 2 and GRUB Legacy, and list of
GNU/Linux distributions and which version started using GRUB 2.

Bug #734376 - Add GRUB 2 Restore Steps to GParted Manual
2014-08-14 12:31:21 +01:00
Daniel Mustieles 43fd79661a Updated Spanish translation 2014-08-07 13:58:27 +02:00
Enrico Nicoletto ef2a577cc4 Updated Brazilian Portuguese translation 2014-07-30 19:15:59 +00:00
Piotr Drąg f6a91e120b Updated Polish translation 2014-07-30 20:11:34 +02:00
Mike Fleetwood a4f761e290 Update parsing of btrfs filesystem show for multi-device membership (#733601)
This patch changes the reading of the btrfs multi-device membership to
resolve issue 1/2 by ignoring the exit status from the 'btrfs filesystem
show' command and relying on parsing the required information to
determine success or failure.

Bug #733601 - Btrfs: Warnings and missing label with btrfs-progs 3.12
              and 3.14
2014-07-28 10:06:00 -06:00
Mike Fleetwood 422829ebff Update parsing of btrfs filesystem show for file system usage (#733601)
Patch 3/4 - btrfs::read_label()

This patch changes the btrfs file system usage reading code to resolve
issue 1/2 by ignoring the exit status from the 'btrfs filesystem show'
command and relying on parsing the required information to determine
success or failure.

Bug #733601 - Btrfs: Warnings and missing label with btrfs-progs 3.12
              and 3.14
2014-07-28 10:06:00 -06:00
Mike Fleetwood eca732fb0c Update parsing of btrfs filesystem show for the label (#733601)
Issue 2/2 - GParted doesn't show label for mounted btrfs file systems

'btrfs filesystem show /dev/PTN' command is used to query details of a
btrfs file system including reading the file system label.  When the
file system is mounted the label is no longer enclosed in single quotes,
but only when using btrfs-progs v3.12.  This causes GParted to think the
label is blank when the file system is mounted and therefore no longer
display it.

File system label not enclosed in single quotes when mounted:

    # fgrep sdb1 /proc/mounts
    /dev/sdb1 /mnt/1 btrfs rw,relatime,space_cache 0 0
    # btrfs filesystem show /dev/sdb1
    Label: test1-btrfs  uuid: 1f78fa38-2f85-41d3-9be6-ae0356ae9469
            Total devices 1 FS bytes used 192.00KiB
            devid    1 size 2.00GiB used 240.75MiB path /dev/sdb1

    Btrfs v3.12

File system label enclosed in single quotes when unmounted:

    # umount /dev/sdb1
    # btrfs filesystem show /dev/sdb1
    Label: 'test1-btrfs'  uuid: 1f78fa38-2f85-41d3-9be6-ae0356ae9469
            Total devices 1 FS bytes used 192.00KiB
            devid    1 size 2.00GiB used 240.75MiB path /dev/sdb1

    Btrfs v3.12

Removing the single quotes enclosing the label makes the output
identical to that from the older 'btrfs-show' command.

Fix by using a common parser to extract the label from both the
'btrfs filesystem show' and 'btrfs-show' commands which can read the
label with and without enclosing single quotes.

Patch 2/4 - btrfs::read_label()

This patch changes the btrfs file system label parsing code to resolve
issue 1/2 by ignoring the exit status from the 'btrfs filesystem show'
command and relying on parsing the required information to determine
success or failure.  Issue 2/2 is also resolved as described above.

Bug #733601 - Btrfs: Warnings and missing label with btrfs-progs 3.12
              and 3.14
2014-07-28 10:06:00 -06:00
Mike Fleetwood 82c6265fa5 Update parsing of btrfs filesystem show for the UUID (#733601)
Issue 1/2 - GParted shows warnings for mounted btrfs file systems

'btrfs filesystem show /dev/PTN' command is used to query details of a
btrfs file system.  When the file system is mounted the command reports
failed exit status 1, but only when using btrfs-progs v3.14 and v3.14.1.
This causes GParted to: (1) report warnings from the failed commands for
a mounted btrfs file system, (2) fail to determine file system usage
figures and (3) fail to display the mount point and busy indicator for
non-mounting devices in multi-device btrfs file systems.  The label is
also read using the secondary blkid method via the FS_Info cache.

Failed exit status 1 when the btrfs file system is mounted:

    # fgrep sdb1 /proc/mounts
    /dev/sdb1 /mnt/1 btrfs rw,seclabel,relatime,space_cache 0 0
    # btrfs filesystem show /dev/sdb1
    Label: 'test1-btrfs'  uuid: 033e6b07-ee6a-4620-a585-8580a2b83275
            Total devices 1 FS bytes used 192.00KiB
            devid    1 size 2.00GiB used 240.75MiB path /dev/sdb1

    Btrfs v3.14.1
    # echo $?
    1

Successful exit status 0 when the btrfs file system is unmounted:

    # umount /dev/sdb1
    # btrfs filesystem show /dev/sdb1
    Label: 'test1-btrfs'  uuid: 033e6b07-ee6a-4620-a585-8580a2b83275
            Total devices 1 FS bytes used 192.00KiB
            devid    1 size 2.00GiB used 240.75MiB path /dev/sdb1

    Btrfs v3.14.1
    # echo $?
    0

Fix by ignoring the exit status of the 'btrfs filesystem show' command
and rely on parsing the required information to determine success or
failure.  The output from the older 'btrfs-show' command is almost
identical so the same code will parse it in all cases.

Patch 1/4 - btrfs::read_uuid()

This patch changes the secondary method used to read the btrfs UUID to
resolve issue 1/2 as described above.

Bug #733601 - Btrfs: Warnings and missing label with btrfs-progs 3.12
              and 3.14
2014-07-28 10:06:00 -06:00
Mike Fleetwood 3bea067596 Flush devices when scanning to prevent reading stale signatures (#723842)
While one partition is busy, reformat another partition from the command
line.  Afterwards parted/libparted still detects the original file
system and GParted shows errors from the file system specific tools
reporting the new file system doesn't exist.  Only limitation is that
the new new file system must be recognised by libparted (or by GParted's
fallback file system signature detection).

Case #1, File system reformatting:

    # parted /dev/sdb print
    Model: ATA SAMSUNG SSD UM41 (scsi)
    Disk /dev/sdb: 8012MB
    Sector size (logical/physical): 512B/512B
    Partition Table: msdos

    Number  Start   End     Size    Type     File system  Flags
     1      1049kB  2149MB  2147MB  primary  ext2
     2      2149MB  4296MB  2147MB  primary  ext2
    # mount | fgrep sdb
    /dev/sdb1 on /mnt/1 type ext2 (rw)

    # mkfs.xfs -f /dev/sdb2
    # blkid /dev/sdb2
    /dev/sdb2: UUID="c31823a2-b81b-46fa-8246-0a59695e4834" TYPE="xfs"
    # parted /dev/sdb print
    Model: ATA SAMSUNG SSD UM41 (scsi)
    Disk /dev/sdb: 8012MB
    Sector size (logical/physical): 512B/512B
    Partition Table: msdos

    Number  Start   End     Size    Type     File system  Flags
     1      1049kB  2149MB  2147MB  primary  ext2
     2      2149MB  4296MB  2147MB  primary  ext2
    # e2label /dev/sdb2
    e2label: Bad magic number in super-block while trying to open /dev/sdb2
    Couldn't find valid filesystem superblock.
    # dumpe2fs /dev/sdb2
    dumpe2fs 1.41.12 (17-May-2010)
    dumpe2fs: Bad magic number in super-block while trying to open /dev/sdb2
    Couldn't find valid filesystem superblock.

Case #2, Removing device from multi-device btrfs:

    # btrfs filesystem show /dev/sdb1
    Label: none  uuid: a05db434-efd5-4e8c-902f-05f89a88b610
            Total devices 2 FS bytes used 156.00KB
            devid    2 size 2.00GB used 512.00MB path /dev/sdb2
            devid    1 size 2.00GB used 240.75MB path /dev/sdb1

    # mount /dev/sdb1 /mnt/1
    # btrfs device delete /dev/sdb2
    # btrfs filesystem show /dev/sdb1
    Label: none  uuid: a05db434-efd5-4e8c-902f-05f89a88b610
            Total devices 1 FS bytes used 92.00KB
            devid    1 size 2.00GB used 714.25MB path /dev/sdb1
    # btrfs filesystem show /dev/sdb2

and GParted reports this error for partition /dev/sdb2:
    Unable to read the contents of this file system!
    Because of this some operations may be unavailable.
    The cause might be a missing software package.
    The following list of software packages is required for btrfs
    file system support:  btrfs-tools.

This is another case of libparted reading from the whole disk device
(/dev/sdb) yet the file system tools use the partition specific block
device (/dev/sdb2), and the Linux buffer cache not providing cache
coherency.  Previous scenario was fixed with:

    797f0b8eeb
    Flush device after wiping a file system (#688882)

This affects libparted 2.0 to 3.1 inclusive and is fixed by:

    http://git.savannah.gnu.org/cgit/parted.git/commit/?id=fb99ba5ebd0dc34204fc9f1014131d5d494805bc
    Revert "linux-commit: do not unnecessarily open partition device nodes"

Fix by calling ped_device_sync() to guarantee cache coherency for each
device during scanning.

Bug #723842 - GParted resizes the wrong filesystem (does not pass the
              devid to btrfs filesystem resize)
2014-07-28 10:03:16 -06:00
Mike Fleetwood 20f52e2866 Display btrfs members in the Partition Information dialog (#723842)
Bug #723842 - GParted resizes the wrong filesystem (does not pass the
              devid to btrfs filesystem resize)
2014-07-28 10:03:16 -06:00
Mike Fleetwood 4b63e46a4e Fallback to reading mount command output instead of /etc/mtab (#723842)
With linux 3.5 and later, the device used to mount a btrfs file system
is updated in /proc/mounts when the previous mounting device is removed
from the file system.  Most recent distributions make /etc/mtab a
symbolic link to /proc/mounts.  However some still have /etc/mtab as a
plain file only updated by mount and umount, thus showing the old device
name which is no longer part of the file system.

On Ubuntu 13.10, which has /etc/mtab as a plain file managed by mount
and umount:

    # mkfs.btrfs /dev/sdb1
    # mount /dev/sdb1 /mnt/1
    # btrfs device add /dev/sdb2 /mnt/1
    # btrfs device delete /dev/sdb1 /mnt/1
    # sync
    # btrfs filesystem show /dev/sdb1
    # btrfs filesystem show /dev/sdb2
    Label: none  uuid: e47775a6-e5ad-4fb4-9ea4-1570aa5b4009
            Total devices 2 FS bytes used 28.00KB
            devid    2 size 2.00GB used 272.00MB path /dev/sdb2

    # fgrep btrfs /proc/mounts
    /dev/sdb2 /mnt/1 btrfs rw,relatime,space_cache 0 0
    # ls -l /etc/mtab
    -rw-r--r-- 1 root root 842 Apr 15 19:41 /etc/mtab
    # fgrep btrfs /etc/mtab
    /dev/sdb1 /mnt/1 btrfs rw 0 0

This causes GParted to report /dev/sdb1 as busy and mounted at /mnt/1
when it is no longer mounted.  This effects recent releases of Ubuntu,
13.04, 13.10 and 14.04.

Either /etc/mtab is a symlink and is identical to /proc/mounts or
/etc/mtab is a plain file with wrong information.  Fix by not reading
mounted file systems from /etc/mtab.

However old distributions only contain 'rootfs' and '/dev/root' device
names for the / (root) file system with '/dev/root' being a block device
rather than a symlink to the true device.  For example from CentOS 5.x:

    # fgrep ' / ' /proc/mounts
    rootfs / rootfs rw 0 0
    /dev/root / ext3 rw,data=ordered 0 0
    # ls -l /dev/root
    brw------- 1 root root 8, 3 Jun  4  2013 /dev/root

This prevents identification, and therefore busy detection, of the
device containing the / (root) file system.  Used to read /etc/mtab to
get the root file system device name.

    # fgrep ' / ' /etc/mtab
    /dev/sda3 / ext3 rw 0 0
    # ls -l /dev/sda3
    brw-r----- 1 root disk 8, 3 Jun  4  2013 /dev/sda3

As per commit:

    409096f739
    improved scanning for root mountpoint (/) ...

but, as discussed above, this contains an out of date device name after
the mounting device has been dynamically removed from a multi-device
btrfs, thus identifying the wrong device as busy.  Instead fall back to
reading mounted file systems from the output of the mount command, but
only when required.

    # mount | fgrep ' / '
    /dev/sda3 on / type ext3 (rw)

Bug #723842 - GParted resizes the wrong filesystem (does not pass the
              devid to btrfs filesystem resize)
2014-07-28 10:03:16 -06:00
Mike Fleetwood d47783eff8 Add fallback busy detection for btrfs file systems (#723842)
In a number of cases there may be no btrfs device cache entry.  Some of
the reasons why this can occur:
1)  Mounting device removed from btrfs on linux <= 3.4 so old mount
    point in /proc/mounts;
2)  btrfs and btrfs-show commands don't exist;
3)  btrfs or btrfs-show command returned non-zero exit status;
4)  get_cache_entry() failed to parse output from btrfs filesystem show
    or btrfs-show.

Without a valid btrfs device cache entry, busy detection for all member
devices fails.  Search the GParted internal mounted partitions map as
the fallback busy detection method.  This can only determine if the
mounting device is mounted or not, not any of the other members of a
multi-device btrfs file system.

Bug #723842 - GParted resizes the wrong filesystem (does not pass the
              devid to btrfs filesystem resize)
2014-07-28 10:03:16 -06:00
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
Mike Fleetwood 287526681d Add devid to the cache of btrfs device information (#723842)
Bug #723842 - GParted resizes the wrong filesystem (does not pass the
              devid to btrfs filesystem resize)
2014-07-28 10:03:16 -06:00
Mike Fleetwood 1712809e01 Display usage for multi-device btrfs file systems (#723842)
Currently GParted fails to report the usage of a multi-device btrfs file
system if it is mounted or if the used space is larger than the size of
an individual member device.  When GParted does display usage figures it
also incorrectly reports the file system wide used figure against every
member device.

Mounted case:
    statvfs() provides an FS size which is larger than any individual
    device so is rejected.  See:
        GParted_Core::mounted_set_used_sectors()
            Utils::get_mounted_filesystem_usage()
            partition .set_sector_usage()

Unmounted case, FS used > device size:
    FS used figure is larger than any individual device so free space is
    calculated as a negative number and rejected.  See:
        btrfs::set_used_sectors()

Btrfs has a volume manager layer within the file system which allows it
to provide multiple levels of data redundancy, RAID levels, and use
multiple devices both of which can be changed while the file system is
mounted.  To achieve this btrfs has to allocate space at two different
level: (1) chunks of 256 MiB or more at the volume manager level; and
(2) extents at the file data level.
References:
*   Btrfs: Working with multiple devices
    https://lwn.net/Articles/577961/
*   Btrfs wiki: Glossary
    https://btrfs.wiki.kernel.org/index.php/Glossary

This makes the question of how much disk space is being used in an
individual device a complicated question to answer.  Further, the
current btrfs tools don't provide the required information.

Btrfs filesystem show only provides space usage information at the chunk
level per device.  At the file extent level only a single figure for the
whole file system is provided.  It also reports size of the data and
metadata being stored, not the larger figure of the amount of space
taken after redundancy is applied.  So it is impossible to answer the
question of how much disk space is being used in an individual device.
Example output:

    Label: none  uuid: 36eb51a2-2927-4c92-820f-b2f0b5cdae50
            Total devices 2 FS bytes used 156.00KB
            devid    2 size 2.00GB used 512.00MB path /dev/sdb2
            devid    1 size 2.00GB used 240.75MB path /dev/sdb1

Fix by guesstimating the per device used figure as the fraction of the
file system wide extent usage based on chunk usage per device.
Calculation:
    ptn fs used = total fs used * devid used / sum devid used

Positives:
1) Per device used figure will correctly be between zero and allocated
   chunk size.

Known inaccuracies:
[for single and multi-device btrfs file systems]
1) Btrfs filesystem show reports file system wide file extent usage
   without considering redundancy applied to that data.  (By default
   btrfs stores two copies of metadata and one copy of data).
2) At minimum size when all data has been consolidated there will be a
   few partly filled chunks of 256 MiB or more for data and metadata of
   each storage profile (RAID level).
[for multi-device btrfs file systems only]
3) Data may be far from evenly distributed between the chunks on
   multiple devices.
4) Extents can be and are relocated to other devices within the file
   system when shrinking a device.

Bug #723842 - GParted resizes the wrong filesystem (does not pass the
              devid to btrfs filesystem resize)
2014-07-28 10:03:16 -06:00
Mike Fleetwood a086e115e5 Display mount points for multi-device btrfs file systems (#723842)
Linux can only show a single device name in /proc/mounts and /etc/mtab
for each mounted btrfs, even if it is a multi-device file system.  So
GParted only shows a mount point for one of the devices in the btrfs, no
matter how many devices are part of the file system.

    # mkfs.btrfs /dev/sdb1 /dev/sdb2
    # btrfs filesystem show /dev/sdb1
    Label: none  uuid: 36eb51a2-2927-4c92-820f-b2f0b5cdae50
            Total devices 2 FS bytes used 156.00KB
            devid    2 size 2.00GB used 512.00MB path /dev/sdb2
            devid    1 size 2.00GB used 240.75MB path /dev/sdb1
    # mount /dev/sdb1 /mnt/1
    # grep btrfs /proc/mounts
    /dev/sdb1 /mnt/1 btrfs rw,seclabel,relatime,ssd,space_cache 0 0

GParted only shows the mount point for /dev/sdb1 as /mnt/1, but nothing
for /dev/sdb2.

Make GParted report the same mount point for all devices included in a
multi-device btrfs file system.

Add btrfs specific get_mount_device() method to report the mounting
device, if any, for the btrfs file system in the occupying the device in
question.  Uses the existing cache of btrfs file system device
membership.  Also extract common code from GParted_Core::
set_mountpoints() into set_mountpoints_helper().

Bug #723842 - GParted resizes the wrong filesystem (does not pass the
              devid to btrfs filesystem resize)
2014-07-28 10:03:16 -06:00
Mike Fleetwood 76e64f2905 Detect busy status of multi-device btrfs file systems (#723842)
Busy detection of file systems works by checking if the device is
mounted (appears in the mount_info map).  For a multi-device btrfs file
system this will only report one of the devices as busy, not all of
them.

    # btrfs filesystem show /dev/sdb1
    Label: none  uuid: 36eb51a2-2927-4c92-820f-b2f0b5cdae50
            Total devices 2 FS bytes used 156.00KB
            devid    2 size 2.00GB used 512.00MB path /dev/sdb2
            devid    1 size 2.00GB used 240.75MB path /dev/sdb1
    # mount /dev/sdb1 /mnt/1
    # grep btrfs /proc/mounts
    /dev/sdb1 /mnt/1 btrfs rw,seclabel,relatime,ssd,space_cache 0 0

GParted will only report /dev/sdb1 as busy, but not /dev/sdb2.

Add btrfs specific is_busy() method which reports the device as busy if
any of the devices in the btrfs file system are mounted.  This uses a
cache which maps device membership in all btrfs file systems.  The cache
is cleared on GParted refresh and incrementally populated as each btrfs
partition is checked for busy status.

WARNING:
Removal of the mounting device from a btrfs file system makes it
impossible to determine whether the file system is mounted or not for
linux <= 3.4.  This is because /proc/mounts continues to show the old
device which is no longer a member of the file system.

    # btrfs device delete /dev/sdb1 /mnt/1
    # sync
    # grep btrfs /proc/mounts
    /dev/sdb1 /mnt/1 btrfs rw,seclabel,relatime,ssd,space_cache 0 0
    # btrfs filesystem show /dev/sdb1
    # btrfs filesystem show /dev/sdb2
    Label: none  uuid: 36eb51a2-2927-4c92-820f-b2f0b5cdae50
            Total devices 1 FS bytes used 28.00KB
            devid    2 size 2.00GB used 1.02GB path /dev/sdb2

Fixed in linux 3.5 by commit:
    Btrfs: implement ->show_devname
    https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=9c5085c147989d48dfe74194b48affc23f376650

Bug #723842 - GParted resizes the wrong filesystem (does not pass the
              devid to btrfs filesystem resize)
2014-07-28 10:03:16 -06:00
Mike Fleetwood a0c0533e3e Add is_dev_mounted() to expose core partition is mounted test (#723842)
Add static member function GParted_Core::is_dev_mounted() so that other
modules can determine if a particular partition contains a mounted file
system or not.

Make it a static member function so that it can be called without
needing the gparted_core object.  Extend to make the group of
manipulated variables (mount_info, fstab_info) and manipulating
functions (init_maps(), read_mountpoints_from_file(),
read_mountpoints_from_file_swaps(), get_all_mountpoints()) static too.

Bug #723842 - GParted resizes the wrong filesystem (does not pass the
              devid to btrfs filesystem resize)
2014-07-28 10:03:16 -06:00
Mike Fleetwood 49a2e19462 Restore busy detection of unknown mounted file systems (#723842)
Previous commit:
    Make partition busy detection method selectable per file system
    (#723842)
causes GParted to no longer detect an unknown mounted file system as
busy.

This is needed because there are many less popular file systems which
Linux can mount but GParted doesn't recognise, such as: Acorn ADFS,
AFFS, BeFS, BFS, etc.  Encountering an unrecognised mounted device can
also occur with btrfs on Linux 3.4 and earlier when the mounting device
is deleted from a multi-device btrfs file system.  Happens because
/proc/mounts continues to show the original mounting device even after
that device was deleted from the file system.

    # mkfs.btrfs /dev/sdb1
    # mount /dev/sdb1 /mnt/1
    # btrfs device add /dev/sdb2 /mnt/1
    # btrfs device delete /dev/sdb1 /mnt/1
    # btrfs filesystem sync /mnt/1
    # grep btrfs /proc/mounts
    /dev/sdb1 /mnt/1 btrfs rw,seclabel,relatime,ssd,space_cache 0 0
    # blkid /dev/sdb1
    # btrfs filesystem show /dev/sdb1
    # blkid /dev/sdb2
    /dev/sdb2: UUID="9c75647c-217a-4718-bcc7-f3ccd8cc7dc6" UUID_SUB="b5d43630-80d4-42ac-b406-185e97cd5bbe" TYPE="btrfs"
    # btrfs filesystem show /dev/sdb2
    Label: none  uuid: 9c75647c-217a-4718-bcc7-f3ccd8cc7dc6
            Total devices 1 FS bytes used 28.00KB
            devid    2 size 2.00GB used 1.02GB path /dev/sdb2

Reinstate the search for mounted partitions for busy detection even for
unrecognised file system types.

Bug #723842 - GParted resizes the wrong filesystem (does not pass the
              devid to btrfs filesystem resize)
2014-07-28 10:03:16 -06:00
Mike Fleetwood b1dc9e69e3 Make partition busy detection method selectable per file system (#723842)
GParted's primary inbuilt busy detection method is "is the partition
mounted?".  A custom method is used for LVM2 PV because its not a
mounted file system.

Make busy detection selectable per file system type.

    .fs.busy = FS::NONE  (default)
        No busy detection.

    .fs.busy = FS::GPARTED
        Use internal GParted method which checks if the partition is
        mounted.

    .fs.busy = FS:EXTERNAL
        Call the file system type's member function is_busy().

LVM2 PV busy detection changes from a special case to just electing to
call the lvm2_pv::is_busy() method.  Linux Software RAID remains a
special case because it's only recognised, but not otherwise supported.

Bug #723842 - GParted resizes the wrong filesystem (does not pass the
              devid to btrfs filesystem resize)
2014-07-28 10:03:16 -06:00
Mike Fleetwood b1c64fdf0d Make ./configure fail when C++ compiler is missing (#732803)
Currently ./configure passes successfully even if a C++ compiler is not
installed.  The first time building the code fails is when make tries
to compile the first C++ source file and the compiler executable is not
found.

Also because there is no C++ compiler the autoconf generated test for
Gtk::Window::set_default_icon_name() will always fail, leaving
HAVE_SET_DEFAULT_ICON_NAME unset.  Therefore as well as installing a
C++ compiler, ./configure must be run again to correctly test for
set_default_icon_name().

This is as a result of a little known consequence of having AC_PROG_CC
proceed AC_PROG_CXX in the autoconf file configure.ac.
    Subject: AC_PROG_CXX behaviour when no C++ compiler is found
    http://lists.gnu.org/archive/html/bug-autoconf/2010-05/msg00001.html

Reverse the order, placing AC_PROG_CXX before AC_PROG_CC, so that the
generated ./configure script fails with an error if there is no C++
compiler available.

Bug #732803 - ./configure is successful even when C++ compile is missing
2014-07-20 09:18:39 -06:00
Curtis Gedak 1e007757a9 Append -git to version for continuing development 2014-07-15 10:46:24 -06:00
Curtis Gedak 6edab65026 ========== gparted-0.19.1 ========== 2014-07-15 09:39:15 -06:00
Wolfgang Stöggl fd03e158e0 Updated German translation 2014-07-15 05:41:50 +00:00