Commit Graph

2076 Commits

Author SHA1 Message Date
Piotr Drąg 320ecff46c Updated Polish translation 2012-10-03 21:11:45 +02:00
Mike Fleetwood eaeaebb421 Remove old FIXME comment from reiserfs::read_label()
Traced debugreiserfs on a 10GiB reiserfs file system which was 100% full
full with nearly 900,000 files.  It read exactly three 4KiB blocks from
different offsets and the program never took more than 0.1 seconds.
2012-10-02 13:19:30 -06:00
Mike Fleetwood e7bfd52a4d Remove old #include <cerrno> from jfs and xfs modules
Use of errno disappeared from jfs and xfs when they switched to using
helper functions for file system resizing.
2012-10-02 13:19:30 -06:00
Mike Fleetwood 3828019030 Read file system size for mounted ext2/3/4 from superblock (#683255)
A user had a 190 MiB partition containing an old ext2 file system.  When
unmounted it was reported as filling the partition, but when mounted it
was reported as having 6% unallocated space.  The file system's inode
tables were approximately twice the size of those created by default
with the current mkfs.ext2 defaults.

To create an equivalent file system in a 190 MiB partition:
    mkfs.ext2 -N 97344 /dev/sda15

It turns out that for ext2, ext3 and ext4 file systems what was
described as intrinsic unallocated space during the development of
Bug #499202 is actually file system overhead.  When mounted the ext2/3/4
kernel code reports the size of the file system after subtracting the
overhead.  Overhead is made up of superblock backups, group descriptors,
allocation bitmaps and largest of all inode tables.  E2fsprogs tools
don't subtract this overhead when reporting the file system size.

References:

 *  The Second Extended File System, Internal Layout, by Dave Poirier
    http://www.nongnu.org/ext2-doc/ext2.html

 *  Linux ext2_statfs() function
    http://lxr.linux.no/#linux+v3.5.3/fs/ext2/super.c#L1311

Call the file system specific method for reading the usage of ext2, ext3
and ext4 file systems while mounted.  Make it read the file system size
from the on disk superblock to avoid subtraction of overhead and use the
statvfs() system call to return an up to date free space figure.

Bug #683255 - ext2: statvfs differs from dumpe2fs (x MB unallocated
              space within the partition)
2012-10-02 13:19:29 -06:00
Mike Fleetwood 01150758c3 Make mounted partition usage method selectable per file system (#683255)
Each file system class can now choose how the size and free space of the
file system is determined when it is mounted.

    .fs.online_read = FS::NONE  (default)
        Do nothing.  Don't get the file system size and free space.

    .fs.online_read = FS::GPARTED
        Use internal GParted method which calls statvfs() system call on
        the mounted file system.

    .fs.online_read = FS::EXTERNAL
        Call the file system's member function set_used_sectors().  This
        is the same function as called when the file system is not
        mounted.   It can determine if the file system is mounted or not
        by testing partition.busy and acting accordingly.

This means that determining the size and free space of active LVM2
Physical Volumes is no longer a special case.  Instead the lvm2_pv class
just elects to have its set_used_sectors() method called for both the
active and deactive cases.

Bug #683255 - ext2: statvfs differs from dumpe2fs (x MB unallocated
              space within the partition)
2012-10-02 13:19:29 -06:00
Akom Chotiphantawanon e6365a79eb Updated Thai translation 2012-10-02 21:22:08 +07:00
Mike Fleetwood e282b78b4a Switch to using debugfs.reiser4 to read the label
Vol_id command was deprecated in May 2009 and superseded by the blkid
command.  Replace the generic vol_id command with the file system
specific debugfs.reiser4 command to read the file system label.
Debugfs.reiser4 will exist as it's already required to read the file
system usage and UUID.
2012-09-28 16:45:43 -06:00
Mike Fleetwood 4f235ecb06 Update file system specific validation of RFC 4122 UUIDs
Use the new RFC 4122 none Nil UUID regular expression to validate the
UUID read in all the Linux native file system specific read_uuid()
methods.  No longer need to explicitly exclude "<none>" or all zeros Nil
UUID as the regular expression does this.
2012-09-28 16:45:43 -06:00
Mike Fleetwood aa16bf5451 Switch to using jfs_tune to read the UUID
Not necessary but use the simpler file system tune command rather than
the file system debug command where possible.  Also saves creating an
echo process.
2012-09-28 16:45:43 -06:00
Mike Fleetwood ee87cee96f Switch to using debugreiserfs to read the UUID (#684115)
For a mounted reiserfs file system with a Nil UUID (all zeros) GParted
will display a partition specific warning.  This comes from the reiserfs
specific read_uuid() method.  Error demonstration:

    # blkid /dev/sda15
    /dev/sda15: LABEL="test-reiserfs-2" TYPE="reiserfs"
    # mount | grep sda15
    /dev/sda15 on /mnt/2 type reiserfs (rw,relatime)
    # reiserfstune /dev/sda15
    reiserfstune: Reiserfstune is not allowed to be run on mounted filesystem.

Switch to using debugreiserfs to read the UUID as it can be used on a
mounted file system.

    # debugreiserfs /dev/sda15 2> /dev/null | grep UUI
    UUID: 00000000-0000-0000-0000-000000000000

Bug #684115 - Reiserfs UUID reading issues on Fedora and CentOS
2012-09-28 16:45:43 -06:00
Mike Fleetwood eca986c96d Ignore invalid reiserfs UUIDs (#684115)
On Fedora up to and including Fedora 16 and Red Hat and CentOS up to the
current 6.3 release the UUID of an unmounted reiserfs file system is
displayed as "<no" and a GTK markup warning is written to the terminal.

This was because the reiserfs-utils package isn't linked with libuuid
support so reiserfs file systems were created with a Nil UUID (all
zeros).  To read the UUID GParted first tries to retrieve the UUID from
the blkid command output via the FS_Info cache.  Secondly it tries the
reiserfs file system specific read_uuid() method which uses the first
space separated word following the text "UUID:", hence it gets "<no".

    # debugreiserfs /dev/sda15 2> /dev/null | grep UUID
    UUID: <no libuuid installed>

In September 2012 Red Hat bug 660285 "reiserfstune compiled without UUID
support" was fixed for Fedora 16 and later releases.  On Fedora with
this fix applied GParted will display the Nil UUID (all zeros) for a
previously created reiserfs file system rather than suppressing it.

Only accept valid, none Nil UUIDs in the reiserfs file system specific
read_uuid() method.

Bug #684115 - Reiserfs UUID reading issues on Fedora and CentOS
2012-09-28 16:45:42 -06:00
Ani Peter 08367aca0d Updated Malayalam file 2012-09-16 21:08:11 +05:30
Aurimas Černius 2694b32591 Updated Lithuanian translation 2012-09-15 20:55:27 +03:00
Matej Urbančič 1bca7bee77 Updated Slovenian translation 2012-09-12 20:44:39 +02:00
Djavan Fagundes d5bf50e16c Updated Brazilian Portuguese translation by Fábio Nogueira <deb-user-ba@ubuntu.com> and myself 2012-09-12 10:10:51 -03:00
Andika Triwidada 5768c6ecf3 Updated Indonesian translation 2012-09-09 22:36:49 +07:00
Seong-ho Cho b06cb7109a Updated Korean translation 2012-09-09 06:51:01 +09:00
Мирослав Николић 3d0cc914cf Updated Serbian translation 2012-09-08 11:14:42 +02:00
Fran Diéguez 90e3631aa5 Updated Galician translations 2012-09-04 23:21:38 +02:00
Piotr Drąg 36bc88f693 Updated Polish translation 2012-09-04 01:02:13 +02:00
Daniel Mustieles b4ad173f9a Updated Spanish translation 2012-09-03 15:59:10 +02:00
Marek Černocký 109c1fa3f1 Updated Czech translation 2012-09-02 12:38:54 +02:00
Fran Diéguez ed1aa22389 Updated Galician translations 2012-09-01 23:47:42 +02:00
Curtis Gedak 4d7ea2bc88 Update AUTHORS
Provide credit for patches by Mike Fleetwood to add LVM PV read-write
support, and to prevent an ESC key crash in number entry dialogs.
2012-09-01 11:22:55 -06:00
Mike Fleetwood 99abbb06ff Recognise lvm command immediately when rescanning for supported actions
Rescanning for supported actions in the File System Support dialog was
not detecting the removal and restoration of the lvm command.  GParted
was only updating supported actions after refreshing all devices.

Checking for the lvm command was tied to the refresh of the LVM2_PV_Info
cache, hence the behaviour.  Fix by always checking for the lvm command
when requested.

Also remove extra new line from end of an error message in
load_lvm2_pv_info_cache().
2012-08-30 13:47:46 -06:00
Mike Fleetwood 60d7728177 Add a partition warning for LVM2 PVs which can't be resized (#670171)
As LVM2 Physical Volumes can't be resized when they are members of
exported Volume Groups add a warning message to explain this fact.
Display the message as a partition specific warning and as additional
text when growing the file system to fill the partition is skipped for
the check operation and when pasting into an existing larger partition.

Bug #670171 - Add LVM PV read-write support
2012-08-30 13:47:46 -06:00
Mike Fleetwood ee49891611 Disallow resizing of LVM2 PVs which are members of exported VGs (#670171)
When an inactive LVM2 Volume Group is exported it makes it unknown to
the local system, ready for moving the member Physical Volumes to
another system, where the VG can be imported and used.  In this state a
PV can't be resized.

    # lvm pvresize /dev/sda10
      Volume group Test-VG1 is exported
      Unable to read volume group "Test-VG1".
      0 physical volume(s) resized / 1 physical volume(s) not resized
    # echo $?
    5

Fix this by preventing resizing of such a PV.  This has been coded in a
generic way using new function filesystem_resize_disallowed() to
determine whether a file system is allowed to be resized or not.  For
a file system which can be resized, but is currently not allowed to be
resized, the behaviour is as follows:

1)  Pasting into unallocated space is limited to creating a new
    partition which is the same size as the copied partition.

2)  Resizing the partition is disallowed, only moving the partition is
    allowed.

3)  Pasting into an existing partition will only copy the file system.
    If the destination partition is larger a warning will report that
    growing the file system is not currently allowed.

4)  Checking a partition will also report a warning that growing the
    file system is not currently allowed.

This is exactly the same behaviour as for a file system which does not
implement resizing, except for a different warning message.

Bug #670171 - Add LVM PV read-write support
2012-08-30 13:47:46 -06:00
Mike Fleetwood 96c9fc129c Implement common LVM2_PV_Info cache search and index functions
Create common cache search and index functions get_attr_by_name() and
get_attr_by_row() as the existing ones, get_pv_attr_by_*() and
get_vg_attr_by_*(), only differ from each other by the string vector
they use.
2012-08-30 13:47:46 -06:00
Mike Fleetwood fdb7e9fe89 Correctly show multiple "unknown device" LVM2 VG members (#670171)
If an LVM2 Volume Group has two or more missing Physical Volumes, the VG
is displayed as only having one "unknown device" because
get_vg_members() only adds unique names to the list of members.

    # lvm pvcreate /dev/sda11 /dev/sda12 /dev/sda13
    # lvm vgcreate Test-VG1 /dev/sda11 /dev/sda12 /dev/sda13
    # wipefs -a /dev/sda12
    # wipefs -a /dev/sda13
    View partition information in GParted

The simplest fix would be to include the PV's UUID in the cache of LVM2
information and add PV names based on unique UUIDs being a member of the
relevant VG.  Unfortunately "lvm pvs" seems to have a bug when
displaying Logical Volume attributes, and there are two or more missing
PVs, which causes one of the PVs to be displayed multiple times, rather
than displaying each PV once.

Without LV attributes, every PV is listed:

    # lvm pvs --nosuffix --separator , --units b -o pv_name,pv_uuid,vg_name,vg_attr 2> /dev/null
      PV,PV UUID,VG,Attr
      /dev/sda11,pJ3R51-AOPP-rKlr-CKCT-nfPS-G5FP-B5Vyjm,Test-VG1,wz-pn-
      unknown device,Y72oSm-uBcE-ktZL-OIFA-Q129-Uv1B-x5IsrA,Test-VG1,wz-pn-
      unknown device,1ESORF-7wlR-0tnO-fy2z-nOL1-MrnJ-2O5yjK,Test-VG1,wz-pn-

With LV attributes, one missing PV is repeated:

    # lvm pvs --nosuffix --separator , --units b -o pv_name,pv_uuid,vg_name,vg_attr,lv_name,lv_attr 2> /dev/null
      PV,PV UUID,VG,Attr,LV,Attr
      /dev/sda11,pJ3R51-AOPP-rKlr-CKCT-nfPS-G5FP-B5Vyjm,Test-VG1,wz-pn-,,
      unknown device,Y72oSm-uBcE-ktZL-OIFA-Q129-Uv1B-x5IsrA,Test-VG1,wz-pn-,,
      unknown device,Y72oSm-uBcE-ktZL-OIFA-Q129-Uv1B-x5IsrA,Test-VG1,wz-pn-,,

Also "lvm vgs" and "lvm lvs" don't display anything when including both
VG and LV attributes.

Instead query the LVM2 information in two separate commands, one
querying PV attributes and one querying VG and LV attributes, saving the
results in lvm_pv_cache and lvm_vg_cache respectively.

Bug #670171 - Add LVM PV read-write support
2012-08-30 13:47:46 -06:00
Mike Fleetwood fbc4e9e941 Remove full stops from the end of primary text in dialogs
The GNOME HIG, 3.4.1 "Alert Text" states:

    ...  The primary text is punctuated in 'newspaper headline' style,
    that is, it has no terminating period, but it may have a terminating
    question mark.

http://developer.gnome.org/hig-book/3.0/windows-alert.html.en#alert-text
2012-08-30 13:47:46 -06:00
Mike Fleetwood 85e9ce3428 Remove outdated FIXME comment from active_partitions_on_device_count()
Active LVM2 PVs have the partition class busy member set in
GParted_Core::set_device_partitions() just as mounted file systems do.
This is a basic requirement for GParted so that it only manipulates
partitions and contained file systems when they are not in use.
2012-08-30 13:47:46 -06:00
Mike Fleetwood 5cb6c687ba New LVM2_PV_Info::bit_set() testing VG and LV attribs "bits"
Abstract repeated code used to test the setting of individual LVM Volume
Group and Logical Volume "bits" attributes into bit_set() function.
2012-08-30 13:47:46 -06:00
Mike Fleetwood c90365a6db Update declarations of some LVM2_PV_Info member functions
Add const qualifier to get_pv_attr_by_path() and get_pv_attr_by_row() as
they only access member variables read-only.

Make lvm2_pv_attr_to_num() a static member function as it doesn't access
any member variables.
2012-08-30 13:47:45 -06:00
Mike Fleetwood 7c8156b7d2 Remove redundant lines from LVM2_PV_Info functions
Splitting of each cache string on comma "," is performed in
get_pv_attr_by_row() and not needed in the caller functions.
2012-08-30 13:47:45 -06:00
Mike Fleetwood fae040c63e Only lookup LVM2 VG name once in Display_Info()
For LVM2 Physical Volumes the Volume Group name was looked up multiple
times, sometimes from the secondary location of the mount point and at
other times from the primary location in the LVM2_PV_Info class.  Just
lookup the VG name once from the primary location.
2012-08-30 13:47:45 -06:00
Mike Fleetwood ca3d40d9c7 Rename *toggle_swap_mount* -> *toggle_busy*
Rename functions and a variable to use a generic term for the menu item
which changes the busy state of partitions now that it also activates
and deactivates LVM2 Physical Volumes as well as mounting and unmounting
file systems and enables and disables swap partitions.
2012-08-30 13:47:45 -06:00
Mike Fleetwood 590f1377f9 Add fallback implementation to new delete LVM2 PV warning dialog (#670171)
The new delete non-empty LVM2 Physical Volume warning dialog uses
Gtk::MessageDialog::get_message_area() in the display of Volume Group
members.  This function was new in gtkmm 2.22, released September 2010,
which is not available in a number of current distributions including:
Unbuntu 10.04 LTS, RHEL 6.3, SLES 11-SP2, Debian 6.0.

Implement fallback method to display the VG name and member PVs in the
warning dialog for when get_message_area() is not available.

Bug #670171 - Add LVM PV read-write support
2012-08-30 13:47:45 -06:00
Mike Fleetwood 69c8acce75 Add warning dialog when deleting non-empty LVM2 PVs (#670171)
When attempting to delete a non-empty LVM2 Physical Volume (one which is
still a member of a Volume Group) display a warning dialog which
includes the VG name and a list of the PV members to allow the user to
make an informed choice whether to go ahead and perform the deletion or
cancel to the operation.  This dialog is displayed when a partition
containing a PV is being deleted or being overwritten by being
reformatted or pasted into.

Bug #670171 - Add LVM PV read-write support
2012-08-30 13:47:45 -06:00
Mike Fleetwood 307f489177 Add LVM2 VG member details to the Information dialog (#670171)
For LVM2 Physical Volumes display the Volume Group name and all the
members in the Information dialog.

Bug #670171 - Add LVM PV read-write support
2012-08-30 13:47:45 -06:00
Mike Fleetwood 1a62354995 Implement LVM2 PV remove() method (#670171)
Implement remove() method so that the LVM2 metadata is updated to
reflect the removal of the LVM2 Physical Volume as well as removing the
signature from the PV before the partition is deleted or overwritten.
    lvm pvremove /dev/DEVICE

Also specifically force the removal of the PV when it is a member of a
Volume Group so that it will succeed.

RATIONAL:

If the PV was not removed before the partition was deleted or
overwritten, LVM2 would be left in a broken state with metadata
describing missing PVs for any partially deleted VGs.  This leaves the
user needing to perform recovery of a lost PV, which required in depth
understanding of LVM2 and is beyond the scope of what GParted can
currently provide.

The alternative is to use the pvremove command to instruct LVM2 to
remove the PV and update LVM2 metadata to reflect the removal of the PV.
For PVs which are a member of a VG this includes forcing the removal.
This has the impact of making recovery from accidental deletion of a
partition containing a PV irrecoverable.  GParted is not able to recover
this situation anyway because Device -> Attempt Data Rescue, using the
gpart command, is not able to detect the signature of an LVM2 PV.

Choose to remove the PV, forcibly if required, rather than potentially
leave LVM2 with missing PVs.

Bug #670171 - Add LVM PV read-write support
2012-08-30 13:47:45 -06:00
Mike Fleetwood 795a92f5b2 Add file system specific remove() methods (#670171)
This commit only adds a remove() method to every file system and an
optional call to it in the relevant operations.  All remove() methods
are no operations and not enabled.

The remove() method provides explicit controlled removal of a file
system before the partition is deleted or overwritten by being formatted
or pasted into.  When implemented, it appears as an extra step in the
relevant operation.  The file system specific remove() method is
explicitly allowed to fail and stop the operations currently being
applied.

This is different to the existing erase_filesystem_signatures() which
wipes any previous file system signatures immediately before a new file
system is written to ensure there is no possibility of the partition
containing two or more different file system signatures.  It never fails
or reports anything to the user.

NOTE:
Most file systems should NOT implement a remove() method as it will
prevent recovery from accidental partition deletion.

Bug #670171 - Add LVM PV read-write support
2012-08-30 13:47:45 -06:00
Mike Fleetwood 566ebc1b88 Add LVM2 PV resize, check and move operations (#670171)
Copy operation for LVM2 Physical Volumes is deliberately not implemented
because it doesn't fit with how LVM2 works and is not safe in the
general case without an understanding of its internals.  See comment in
lvm2_pv::copy() for more details.

Bug #670171 - Add LVM PV read-write support
2012-08-30 13:47:45 -06:00
Mike Fleetwood 619bda5d8b Enable LVM2 VG activation / deactivation (#670171)
In the Partition menu enable activation / deactivation of the LVM2
Volume Group of which the Physical Volume is a member.

Bug #670171 - Add LVM PV read-write support
2012-08-30 13:47:45 -06:00
Mike Fleetwood c3ab62591b Add creation of LVM2 PVs (#670171)
Add creation of Physical Volumes specifying LVM2 metatdata format:
    lvm pvcreate -M 2 /dev/DEVICE

Also set the partition type to identify its contents as LVM.  Note that
libparted treats every partition type as a file system except LVM which
it treats as a flag, hence GParted displaying "lvm" in the Manage Flags
dialog.  Never the less libparted set the partition types correctly.
For MBR partitioning the type is 8e "Linux LVM" and for GPT partitioning
the type is E6D6D379-F507-44C2-A23C-238F2A3DF928.  Setting the partition
type as LVM is not strictly required as LVM2 scans the contents of all
partitions looking for PVs, but it is best practice.

Bug #670171 - Add LVM PV read-write support
2012-08-30 13:47:45 -06:00
Mike Fleetwood 87625c2b0a Prevent crash from pressing Esc in dialogs with number entry (#682658)
Steps to reproduce:
1) Open any of these dialogs: Create New Partition, Resize/Move or
   Paste;
2) Update any of the following numeric entry fields to a different value
   using the keyboard: Free space preceding, New size or Free space
   following;
3) Press [Esc] key;
Gparted crashes.

What is happening is that the [Esc] key is leading to the dialog being
closed and calling the ~Dialog_Base_Partition() destructor.  However
after this the GTK widget is calling the on_spinbutton_value_change()
registered callbacks for the change to the other two values, on the now
just deleted object.

Fix by disconnecting the change notification callbacks in the
destructor.

Closes bug #682658 - GParted crash by pressing Esc in dialogs with
                     number entry
2012-08-30 13:14:04 -06:00
Fran Diéguez 34cf70f41d Updated Galician translations 2012-08-30 14:40:14 +02:00
Chao-Hsiung Liao 770fab8ca4 Updated Traditional Chinese translation(Hong Kong and Taiwan) 2012-08-11 21:31:27 +08:00
Curtis Gedak c0a9673146 Append -git to version for continuing development 2012-08-08 10:18:16 -06:00
Curtis Gedak e606eae836 ========== gparted-0.13.1 ========== 2012-08-08 09:26:05 -06:00
Tom Tryfonidis d5f380aff6 Updated Greek translation 2012-08-07 14:49:30 +03:00