Commit Graph

497 Commits

Author SHA1 Message Date
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
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
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 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 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 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 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 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 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
Mike Fleetwood a6ff181faf Make btrfs_size_*() static member functions
The member functions btrfs_size_to_num(), btrfs_size_max_delta() and
btrfs_size_to_gdouble() don't access any member variables.  Therefore
they don't need the const qualifier allowing them to be called when the
btrfs object is const for read-only access to member variables, but
instead need to be static member functions with no access to member
variables.
2012-07-08 12:12:16 -06:00
Mike Fleetwood 6c96ab34b3 Simplify calc_usage_triple() interface and rename
Now that every call to calc_usage_triple() just passes usage figures
returned by get_sectors_*(), remove those parameters, call
get_sectors_*() internally and rename to get_usage_triple().
2012-06-26 14:13:31 -06:00
Mike Fleetwood ac3ce5ec2b Simplify main window partition usage graphic code
Stop using fraction_unallocated and fraction_used member variables of
the DrawingAreaVisualDisk class as intermediate storage of partition
usage fractions.  Instead get the figures straight from the partition
class and use the new calc_usage_triple() to directly set pixels widths
for the partition usage graphic.
2012-06-26 14:13:31 -06:00
Mike Fleetwood 67f334a8ac Fix minor unallocated space display issue in the Info dialog (#499202)
For specific partition usage values the right hand border of the
partition graphic in the Information dialog would be displayed as grey
rather than the color assigned to the partition.

Steps to reproduce fault:
    Create 1024 MiB partition
    # lvm pvcreate /dev/sda12
    # lvm vgcreate GParted-VG1 /dev/sda12
    View partition information

Fragment from Dialog_Partition_Info::init_drawingarea():
    139  else if ( partition .sector_usage_known() )
    140  {
    141          used        = Utils::round( ( 400 - BORDER *2 ) / ( dlength / partition .get_sectors_used()   ) ) ;
    142          unused      = Utils::round( ( 400 - BORDER *2 ) / ( dlength / partition .get_sectors_unused() ) ) ;
    143          unallocated = 400 - BORDER *2 - used - unused ;
    144  }

For this issue the above values are both exactly x.5 and both round
upwards, resulting in unallocated being -1.
    used        = round((400 - 8*2)/(2097152.0/8192))    = round(1.5)
    unused      = round((400 - 8*2)/(2097152.0/2088960)) = round(382.5)
    unallocated = 400 - 8*2 - 2 - 383 = -1

The simple fix would be to use floor() instead of round() in the
calculation of either used or unused.  The same fix would also need to
be applied in Display_Info() for the calculation of the percentage
figures.  Unfortunately this simple fix can lead to odd figures when the
used or unused is close to zero and floor() or ceil() is effectively
applied rather than round().  For example:
    Size:           227.23 GiB
    Used:           28.00 KiB   ( 1% )
    Unused:         180.00 GiB  ( 79% )
    Unallocated:    47.23 GiB   ( 20% )
Used figure of 28 KiB in 227 GiB partition should be rounded to 0% but
wasn't.

Write Partition::calc_usage_triple() which calculates the "best" figures
by rounding the smaller two figures and subtracts them from the desired
total for the largest figure.  Apply to the calculation of the partition
usage percentage figures in the Information dialog and the partition
usage graphic in the same dialog and the main window.

Bug #499202 - gparted does not see the difference if partition size
              differs from filesystem size
2012-06-26 14:13:31 -06:00
Mike Fleetwood 7ebedc4bb3 Don't show intrinsic unallocated space (#499202)
Most file systems report intrinsic unallocated space using the statvfs()
system call when mounted, but not using their own tools.  They are:
ext2/3/4, fat16/32, hfs, nilfs2, reiserfs and xfs.  Showing either a
little or no unallocated space, depending on whether a file system is
mounted or not, could be confusing to the user.

When all file systems are created filling their partitions the unused
figure reported by statvfs() and their own tools are the same or very
close.  Also the used plus unallocated figure from statvfs() agrees with
the used figure from their own tools.

For all file systems don't display intrinsic unallocated space (that
below the threshold of 2 to 5%), instead include it as used space.  As
soon as the amount of unallocated space becomes significant display it
everywhere and also trigger the warning.

For display purposes always use the new Partition methods:
get_sectors_used(), get_sectors_unused(), and get_sectors_unallocated().
When calculating new usage figures during Paste and Resize/Move
operations directly access sectors_used, sectors_unused and
sectors_unallocated members.

Bug #499202 - gparted does not see the difference if partition size
              differs from filesystem size
2012-06-18 12:41:59 -06:00
Mike Fleetwood 3737224028 Include intrinsic unallocated space for resizing purposes (#499202)
A number of file systems report intrinsic unallocated space even when
they are created filling the partition.  As reported using their own
specific tools, they are: jfs, lvm2 pv and ntfs.  Therefore when
resizing a partition estimate its minimum size to be used sectors plus
any unallocated sectors up to the significant amount.

Bug #499202 - gparted does not see the difference if partition size
              differs from filesystem size
2012-06-18 10:24:29 -06:00
Mike Fleetwood 7fc16a1b69 Handle btrfs tools rounding of figures (#499202)
The btrfs programs only provide approximations of file system sizes
because they display figures using binary prefix multipliers to two
decimal places of precision.  E.g. 2.00GB.  For partition sizes where
the contained file system size rounds upwards, GParted will fail to read
the file system usage and report a warning because the file system will
appear to be larger than the partition.

For example, create a 2047 MiB partition containing a btrfs file system
and display its size.

    # btrfs filesystem show
    Label: none  uuid: 92535375-5e76-4a70-896a-8d796a577993
            Total devices 1 FS bytes used 28.00KB
            devid    1 size 2.00GB used 240.62MB path /dev/sda12

The file system size appears to be 2048 MiB, but that is larger than the
partition, hence the issue GParted has.  (Actually uses the btrfs devid
size which is the size of the btrfs file system within the partition in
question).

This issue is new with the fix for Bug #499202 because it queries the
file system sizes for the first time.  The same issue could
theoretically occur previously, but with the used figure (FS bytes
used).  This would have been virtually impossible to trigger because
btrfs file system would have to have been greater than 99% full, but
btrfs has been notorious for early reporting of file system full.

The fix is that if a btrfs file system size appears larger than the
partition size, but the minimum possible size which could have been
rounded to the reported figure is within the partition size use the
smaller partition size instead.  Apply the method to the used figure
too, in case the file system is 100% full.  Also if the btrfs file
system size appears smaller than the partition size, but the maximum
possible size which could have been rounded to the reported figure is
within the partition size use the larger partition size instead to avoid
reporting, presumably false, unallocated space.  Not applied to file
system used figure.

Bug 499202 - gparted does not see the difference if partition size
             differs from filesystem size
2012-06-18 10:24:29 -06:00
Mike Fleetwood 7ddbc9bd92 Set unallocated space for paste or resize/move operations (#499202)
When pasting a copied partition into free space or move/resizing a
partition set its space utilisation so that any unallocated space within
the partition is displayed correctly before the operation is applied.

NOTE:
If the file system does not support file system resizing the Paste and
Move/Resize dialogs don't allow resizing the partition so the preview
will always be correct, unlike the case in the previous patch:
    Set unallocated space when performing simple operations (#499202)

Also remove the deprecated and no longer used Partition::Set_Unused()
and Partition::set_used() methods.

Bug #499202 - gparted does not see the difference if partition size
              differs from filesystem size
2012-06-18 10:24:29 -06:00
Mike Fleetwood 2b9c6425b5 Display unallocated space in the main window (#499202)
Display the unallocated space within a partition in the main window's
graphical disk representation.

Bug #499202 - gparted does not see the difference if partition size
              differs from filesystem size
2012-06-18 10:24:28 -06:00
Mike Fleetwood e6290dbbcf Query unallocated space for LVM2 PVs (#499202)
Add reporting of the LVM2 Physical Volume size allowing the unallocated
space in the partition to be calculated.

Bug #499202 - gparted does not see the difference if partition size
              differs from filesystem size
2012-06-18 10:24:28 -06:00
Mike Fleetwood 719e73e335 Query unallocated space for unmounted file systems (#499202)
Update file system specific implementations to set the size and free
space, thus allowing the unallocated space in the partition to be
calculated, for the following unmounted file systems:
    btrfs, ext2, ext3, ext4, fat16, fat32, jfs, nilfs2, ntfs, reiserfs,
    reiser4, xfs

Bug #499202 - gparted does not see the difference if partition size
              differs from filesystem size
2012-06-18 10:24:28 -06:00
Mike Fleetwood 8ffd68b012 Display unallocated space in the information dialog (#499202)
Display the unallocated space in the graphical partition representation
and numeric figures in the Partition Information dialog.

Bug #499202 - gparted does not see the difference if partition size
              differs from filesystem size
2012-06-18 10:24:28 -06:00
Mike Fleetwood 8093ba2ebd Record unallocated space within a partition (#499202)
Currently GParted assumes that a file system fills its containing
partition.  This is not always true and can occur when resizing is
performed outside of GParted or a resize operation fails.  GParted
doesn't display any information about unallocated space to the user
and in most cases it is simply included in used space.

Add partition unallocated space accounting.  Make GParted record the
unallocated space for mounted file system and display a warning in the
Partition Information dialog when too much unallocated space is found.

Partition::set_sector_usage( fs_size, fs_unused ), is the new preferred
method of recording file system usage because it allows the unallocated
space in a partition to be calculated.  Partition::Set_Unused() and
Partition::set_used() are now deprecated.

NOTES:

1)  Set the minimum unallocated space to be 5% before considering it
    significant to avoid false reporting.  Worst case found was a
    mounted xfs file system in a 100MiB partition, which reports as
    ~4.7% unallocated according to file system size from statvfs().
    However, it reports as having no unallocated space using xfs
    specific tools.

2)  Unallocated space is only a graphical representation for the user.
    GParted must still use relevant tools to resize file systems before
    shrinking the data and can't assume all unallocated space exists
    after the file system at the end of the partition.

Bug #499202 - gparted does not see the difference if partition size
              differs from filesystem size
2012-06-18 10:24:28 -06:00
Curtis Gedak 0fda1d011d Enable new fs resize library available with parted-3.1 (#668281)
The parted-3.1 release brings back FAT16/FAT32 and HFS/HFS+ file
system resize capabilities in a new libparted fs resize library.

The following operations are again available when GParted is linked
with parted-3.1:

   FAT16 - grow and shrink
   FAT32 - grow and shrink
   HFS   - shrink
   HFS+  - shrink

Note that there is a difference in how move actions are handled for
FAT16/FAT32 file systems based on parted version.

When GParted is linked with parted >= 3.0:

   FAT16 - move performed internally by GParted
   FAT32 - move performed internally by GParted

When GParted is linked with parted < 3.0:

   FAT16 - move performed by libparted
   FAT32 - move performed by libparted

Thanks goes to Jim Meyering for restoring these file system resizing
capabilities in Parted 3.1 with a new libparted fs resize library.

Closes Bug #668281 - minimal file-system resize API? (FAT and HFS*
                     only)
2012-03-03 11:55:20 -07:00
Mike Fleetwood ea1c0c023e Warn when an LVM2 PV is a member of a damaged VG (#160878)
Generate a warning for each LVM2 Physical Volume which is a member of a
Volume Group which has other members missing.

Bug #160787 - lvm support
2012-02-12 11:02:55 -07:00
Mike Fleetwood 6d665d669d Display VG export status with an LVM2 PVs busy status (#160787)
Also update to use LVM terminology, such that a Physical Volume is
referred to as a member of a Volume Group.  Status of an LVM2 PV is now
displayed using one of the following messages:
    Not active (Not a member of any volume group)
    VGNAME not active
    VGNAME not active and exported
    VGNAME active

Bug #160787 - lvm support
2012-02-12 10:43:01 -07:00
Mike Fleetwood 3fbdb8055f Prevent crash in the LVM2 PV information cache (#160787)
GParted would crash if there were any embeded spaces in the output from
the command used to query LVM2 PVs.  There aren't normally any embeded
spaces, but they can occur in certain degrated situations.  For example
if one of the PVs in a VG spanning two PVs is lost the PV is displayed
as "unknown device" rather than its actual device name:

    # lvm pvs --nosuffix --units b --separator , -o pv_name,pv_free,vg_name,lv_name,lv_attr
      Couldn't find device with uuid DMEi8r-9Vvy-w0Ok-CSSn-oLmY-YrY3-1PBznz.
      PV,PFree,VG,LV,Attr
      /dev/sda11,2143289344,GParted-VG1,,
      unknown device,1619001344,GParted-VG1,lvol0,-wi---
      unknown device,1619001344,GParted-VG1,,

This was loaded into the cache as:

    ["/dev/sda11,2143289344,GParted-VG1,,",
     "unknown",
     "device,1619001344,GParted-VG1,lvol0,-wi---",
     "unknown",
     "device,1619001344,GParted-VG1,,"]

The crash would happen when trying to access the VG name or LV flags on
a line without enough comma separated fields.

Improve parsing of the output from "lvm pvs" so that lines are not split
on embeded spaces.  Don't crash on lines without without enough comma
separated fields.

Bug #160787 - lvm support
2012-02-12 10:42:40 -07:00
Mike Fleetwood c24170927d Display any errors from querying LVM2 PVs to the user (#160787)
Previously any errors which occurred when running LVM commands used to
load the LVM2_PV_Info cache were simply ignored and the cache wasn't
loaded.  This lead to missing information about LVM2 PVs, but the user
had no indication as to why.

Now when any errors occur the command ran and all output is captured.
This is displayed to the user, along with a suitable warning message, in
the Partition Information dialog.

Bug #160787 - lvm support
2012-02-12 10:24:02 -07:00
Mike Fleetwood 4b30a2ddbf Fix detection of LVM2 PV busy status when exported VGs exist (#160787)
If a Volume Group is exported the "lvm lvs" command returns non-zero
exit status causing its output to not be loaded into the LVM2_PV_Info
cache and detection of busy Physical Volumes completely fail.

    # lvm lvs -o lv_name,vg_name,lv_attr
      Volume group GParted_VG4 is exported
      LV    VG          Attr
      lvol0 GParted-VG2 -wi---
      lvol0 GParted_VG3 -wi-a-
      lvol1 GParted_VG3 -wi-a-
    # echo $?
    5

Switch to using "lvm pvs" to query all cached information using one
command, which doesn't return non-zero when exported VGs exist.

    # lvm pvs --nosuffix --units b -o pv_name,pv_free,vg_name,lv_name,lv_attr
      PV         PFree      VG          LV    Attr
      /dev/sda10 2147483648
      /dev/sda11 2143289344 GParted-VG1
      /dev/sda12 1619001344 GParted-VG2 lvol0 -wi---
      /dev/sda12 1619001344 GParted-VG2
      /dev/sda13  830472192 GParted_VG3 lvol0 -wi-a-
      /dev/sda13  830472192 GParted_VG3 lvol1 -wi-a-
      /dev/sda13  830472192 GParted_VG3
      /dev/sda14 1619001344 GParted_VG4 lvol0 -wi---
      /dev/sda14 1619001344 GParted_VG4
    # echo $?
    0

Bug #160787 - lvm support
2012-02-12 10:24:02 -07:00
Mike Fleetwood 5967966ff7 Create helper functions to check for minimum kernel version
Create function Utils::kernel_version_at_least() to check that the
current Linux kernel is a particular version or higher.

Update nilfs2 to use this function to determine whether the kernel is
new enough to support file system resizing.
2012-02-10 11:20:47 -07:00
Rogier Goossens 4108daf15f Implement changing UUID for NTFS (#667278)
Part 4 of 4 to provide new UUID support for NTFS.

Closes Bug #667278 - Add support for setting UUID
2012-02-10 10:33:13 -07:00
Rogier Goossens 170a79b3a0 Use custom text functions for mount/unmount and swapon/swapoff texts
Part 3 of 4 to provide new UUID support for NTFS.

See Bug #667278 - Add support for setting UUID
2012-02-10 10:33:12 -07:00
Rogier Goossens 8735227dd7 Add support for custom text strings depending on the filesystem
Part 2 of 4 to provide new UUID support for NTFS.

See Bug #667278 - Add support for setting UUID
2012-02-10 10:33:12 -07:00
Rogier Goossens ce9feeda0e Make FileSystem objects in GParted_Core accessible and usable by others
Part 1 of 4 to provide new UUID support for NTFS.

See Bug #667278 - Add support for setting UUID
2012-02-10 10:33:12 -07:00
Curtis Gedak d2d830108b Place file system types in alphabetical order 2012-02-03 16:16:04 -07:00
Mike Fleetwood 820242635a Switch to using lvs to identify active LVM LVs (#160787)
Previously used "dmsetup info" to directly list device-mapper mapping
names in the kernel to identify active Logical Volumes.  However GParted
failed to recognise active LVs if the VGNAME contains any hyphens (-).
This is because LVM encodes hyphens as double hyphens in the mapping
name.

To avoid having to duplicate the LVM hyphen encoding in GParted, switch
to using "lvm lvs" to list LVs.

    # dmsetup info --columns --noheadings --separator , -o name
    GParted_VG1-lvol_00
    GParted--VG2-lvol--00

    # lvm lvs --noheadings --separator , -o lv_name,vg_name,lv_attr
      lvol_00,GParted_VG1,-wi-a-
      lvol-00,GParted-VG2,-wi-a-
      lvol-01,GParted-VG3,-wi---
                             .^.
(-) not active, (a) or any other character considered active.  Reference
lvs(8).

Bug #160787 - lvm support
2012-02-02 10:24:31 -07:00
Mike Fleetwood 8083f11d84 Display LVM2 VGNAME as the PV's mount point (#160787)
As the Mount Point column is being borrowed to display the PV's VGNAME,
also suppress generation of the "Mount on" submenu for LVM2 PVs.

Bug #160787 - lvm support
2012-02-02 10:24:31 -07:00
Mike Fleetwood ff8ad04120 Lazy initialize the cache from querying LVM2 PVs (#160787)
Previously when GParted was started LVM2_PV_Info cache was loaded twice,
executing LVM2 PV querying commands twice.  Firstly when
lvm2_pv::get_filesystem_support() was checking if LVM2 PV support was
available, and secondly when forced by a refresh in
GParted_Core::set_devices().

Implement lazy initialization.  Only load the cache when forced by the
above mentioned refresh or having to return a value when the cache is
not yet loaded.  Do not initialize the cache when just checking if LVM2
PV support is available.

Bug #160787 - lvm support
2012-02-02 10:24:31 -07:00
Mike Fleetwood 608d992e82 Cache results from querying all LVM2 PVs (#160787)
Cache results from querying all LVM2 PVs in one go to minimise the
number of times lvm commands are executed.  Take inspiration from
caching performed by FS_Info and Proc_Partitions_Info.

Bug #160787 - lvm support
2012-02-02 10:24:28 -07:00
Mike Fleetwood abd0dd0426 Report space usage of LVM2 PVs (#160787)
Add minimal support for just reporting the space usage of LVM2 PVs.
Accept libparted / blkid detection of LVM2 PVs first, falling back on
GParted's specific detection code otherwise.  Maintain LVM not supported
warning message.

Bug #160787 - lvm support
2012-02-02 10:17:29 -07:00
Mike Fleetwood 391e5e12f9 Rename FS_LVM2 -> FS_LVM2_PV (#160787)
This is the first step of adding support for just LVM2 Phyiscal Volumes,
a subset of full LVM2 support.

Make it clear that it is only LVM2 PVs being treated like a file system.

Bug #160787 - lvm support
2012-01-31 10:26:51 -07:00
Rogier Goossens 9e96159bb2 Add support for setting UUID (#667278)
Add the ability to set a new random UUID on file systems that provide
the appropriate tools to perform this action.

Update the help manual to include this new functionality.  Also add
reference links to "setting a partition label" and "changing a
partition UUID" in the "copying and pasting a partition" section.

This patch does not include setting the UUID on an NTFS file system.

Bug #667278 - Add support for setting UUID

Bug #608308 - fix documentation - Copying and Pasting a Partition
2012-01-23 12:32:27 -07:00
Mike Fleetwood 4ab3fe0ee7 Add helper functions for mounted file system resizing operations
There is a lot of commonality and code repetition for resizing of file
systems which can only be resized while mounted.  Resizing of btrfs, jfs
and xfs all follow the pattern: mkdir, mount, resize, umount and rmdir.
Copying an xfs file system also uses a similar pattern, but for the
source and destination xfs file systems simultaneously.

Add three helper functions to the FileSystem class which implement
common tasks, allowing mounted file system resizing to be implemented
more simply.

Also add a function to the Utils class which checks whether the kernel
supports a file system.  It handles the case of non-loaded modules,
which currently leads to reporting the growing of jfs and xfs as
unsupported.
2012-01-11 12:49:13 -07:00
Phillip Susi a1f843e74a Display pop up dialog on libparted exceptions
We used to just log libparted exceptions without handling them.  This patch
changes the exception handler to display a modal dialog box and return the
chosen action to libparted.
2012-01-08 13:03:20 -07:00
Mike Fleetwood df20b54d00 Add nilfs2 support (#642842)
Requires libparted 2.4 or higher, or blkid from utils-linux 2.20 or
higher for nilfs2 file system detection.

Requires nilfs-utils for nilfs2 file system support.

Closes Bug #642842 - nilfs is not detected
2011-12-16 11:40:46 -07:00
Curtis Gedak b6f1c56fb1 Enhance regexp_label method to handle unicode characters
Prompted by Bug #662537 - Ext4 unicode labels not shown correctly
2011-11-01 13:08:36 -06:00
Curtis Gedak 7cbc125a2e Add detection of exfat file systems (#639760)
Note that util-linux v2.18 or higher is required to detect exfat file
systems.

Part of Bug #639760 - exfat / fat64 support
2011-10-22 11:54:54 -06:00
Curtis Gedak 2bcd5d2954 Cleanup btrfs code
Move btrfs higher up the file system list.
Remove btrfs skip references as btrfs is now supported.
2011-10-22 10:44:29 -06:00
Jérôme Dumesnil 03cdaed946 Improve Merge_Operations method parameters and checks 2011-10-13 11:26:16 -06:00
Jérôme Dumesnil b10349ae37 Merge overlapping operations (#438573)
When a new operation is added to operations list, check if a merge
is possible depending on the operation type:

    OPERATION_RESIZE_MOVE:  2 consecutive "resize" operations on the
                            same  partition
OPERATION_LABEL_PARTITION:  2 "label change" operations (need not be
                            consecutive) on the same partition
          OPERATION_CHECK:  2 "check" operations (need not be
                            consecutive) on the same partition
         OPERATION_FORMAT:  2 consecutive "format" operations on the
                            same partition

Closes Bug #438573 - Cancel out overlapping actions

Also fix a bug when copying partition using the Partition::Set(...)
method.  This method did not initialize "sectors_used" and
"sectors_unused" members.
2011-10-05 15:08:44 -06:00
Curtis Gedak 55b71a77bc Fix unused parameter compiler warning
Removed unused parameter.  Prior to this change the compiler would
complain with the following message:

error: unused parameter ‘cylinder_size’
2011-07-18 13:31:54 -06:00
Markus Elfring 91b971691d Bug #634090: Change some attributes to local variables
Some classes contained private attributes which were used only by a single
member function. Such items were moved to the corresponding function implementations
to stress their limited usage scope.

A few unused variables were also deleted.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
2011-07-18 13:28:49 -06:00
Curtis Gedak 8a58b5b53e Enable compile and link with libparted 3.0 (#651559)
The release of (lib)parted 3.0 includes a change to the Application
Programing Interface - API.  Most importantly, libparted 3.0 removes
many file system specific function calls, and hence the capabilities
provided by these functions.  In order for GParted to compile and link
with libparted 3.0, this libparted functionality is lost.

Specifically, the functionality that is lost when GParted is compiled
and linked with libparted 3.0 is as follows:

  - Loss of ability to grow and shrink FAT16 and FAT32 file systems
  - Loss of ability to shrink HFS and HFS+ file systems
  - Loss of ability to determine used and unused sectors in HFS and
      HFS+ file systems
  - Loss of ability to erase file system signatures on partition
      create and format

It is hoped that other free software projects will include some or all
of the above lost functionality, which can then be added back to
GParted.

This commit includes a change in how FAT16 and FAT32 file systems are
moved.  Specifically the move is now performed internally by GParted
when linked with libparted 3.0.  The move functionality is provided by
libparted for prior libparted versions (e.g. less than 3.0).

This is the final enhancement in a series of commits that enable
GParted to compile with libparted version 3.0.

Closes Bug #651559 - Doesn't compile against parted 3.0
2011-06-09 09:59:41 -06:00
Curtis Gedak 87acba030c Remove all usage of kpartx to avoid partition entry duplicates
Usage of the kpartx package to create partition names has been
completely removed.  Hence kpartx is no longer even an optionally used
package by gparted.

This change is related to the following bug report:

Ubuntu launchpad bug 719129 - [Natty] Gparted duplicates dmraid
                              partition devices
https://bugs.launchpad.net/ubuntu/+source/gparted/+bug/719129
2011-02-22 14:40:02 -07:00
Joan Lledó ef37bdb7de Added support to lost data recovery using gpart 2011-01-29 14:58:02 -07:00
Curtis Gedak 128b1439a1 Add methods to FS_Info class to get path by uuid and by label 2010-12-09 14:06:38 -07:00
Curtis Gedak fd77e73c46 Refactor device parsing logic into Proc_Partitions_Info class
The reason for refactoring is to simplify the large GParted_Core
class, to help minimize disk reads, and to group the logic for
processing the file /proc/partitions into a single logical class.
2010-12-07 16:01:54 -07:00
Curtis Gedak 319255d3bc Refactor alternate_paths logic into new Proc_Partitions_Info class
This reason for refactoring is to simplify the large GParted_Core
class, to help minimize disk reads, and to group the logic for
processing the file /proc/partitions into a single logical class.
2010-12-07 11:49:50 -07:00
Curtis Gedak ca30f986f7 Add virtual move method to FileSystem class
This is preparation work for the following bug report:
Bug #589555 - Moving a swap partition needlessly copies
              all "data" on it
2010-10-19 13:35:53 -06:00
Curtis Gedak b0e36132b0 Make btrfs support a normal part of gparted
Remove need to configure with the --enable-btrfs option in order
to include btrfs support in gparted.
2010-10-18 15:28:40 -06:00
Luca Bruno 66a3a71842 Initial Btrfs-handling modules
This adds initial handlers for Btrfs; only .create, .check and
.read_label are done for now, via external btrfs-tools.
Other methods are still only stubs.
2010-10-03 17:00:53 +02:00
Curtis Gedak cf68fc0704 Enable to work with new dmraid and parted without dmraid support
Newer versions (dmraid-1.0.0-rc16?) of dmraid default to always
creating partition names by inserting the letter 'p' between the
device name and the partition number.  Since this is not
consistent with older versions of dmraid, add extra logic to
ensure that newer versions of dmraid do not insert this extra
letter 'p'.

Rename method get_udev_name to get_udev_dm_name and enhance to
retrieve the property DM_NAME.

Handle situation where parted, and hence libparted, has been
configured with --disable-device-mapper.  In this situation on
some distros the device name could be /dev/dm-0.  This results in
invalid partition names such as /dev/dm-0p1.  Add logic to decode
the actual /dev/mapper name.
2010-08-25 10:33:02 -06:00
Curtis Gedak 73e7f85a2f Create new method make_path_dmraid_compatible
This method will be used to ensure that the partition path
matches the name that would be created by the dmraid command.
2010-08-17 10:36:00 -06:00
Curtis Gedak 9bd8b14871 Create new method get_partition_path
This method will be used as an entry point to the libparted
function ped_partition_get_path
2010-08-17 10:36:00 -06:00
Curtis Gedak f7cb37831a Add new method active_partitions_on_device_count 2010-08-10 13:01:40 -06:00
Curtis Gedak d5064dfe03 Move method to match header file
Also update copyright year
2010-08-10 13:01:40 -06:00
Curtis Gedak 44698448aa Add new method partition_in_operation_queue_count 2010-08-09 13:33:28 -06:00
Curtis Gedak 95c9577d8f Limit graphic movement according to required boot record space
Also respect minimum size for extended partition in graphical
representation.

This change is part of adding the option to align to MiB (#617409).
2010-05-25 16:26:08 -06:00
Curtis Gedak e62a23b5b5 Add partition alignment option to align to MiB (#617409)
Make align to MiB the default setting instead of align to cylinder.

Migrate logic for alignment to cylinder into its own method
snap_to_cylinder, and place common logic in snap_to_alignment.

Add alignment checks for situations where space is needed for Master
Boot Record or Extended Boot Record.

Adjust ranges on spin buttons according to required boot record space.

Copy fix for off by one sector (#596552) from
Dialog_Partition_New::Get_New_Partition to
Dialog_Base_Partition::Get_New_Partition

Enhance resize / move logic for checking locations of nearby logical
partitions to not depend on the partition ordering.

Note: This commit does not include limiting graphic movement according
to required boot record space.
2010-05-20 10:00:14 -06:00
Curtis Gedak 2cdfb4c55a Change partition alignment check box to a drop down menu
Also add signal handler to alignment menu to update file system
minimum size.
This enhancement is to prepare for adding a third alignment
option to align to MiB.
2010-05-09 14:45:26 -06:00
Curtis Gedak 7e2ca14756 Rename get_length method to get_sector_length
This rename is to try to reduce future confusion between
partition length in sectors versus partition length in bytes.
2010-04-28 09:11:44 -06:00
Curtis Gedak fe9ee68385 Create get_byte_length method 2010-04-27 11:28:36 -06:00
Curtis Gedak cb08e8c7dd Remove 512 byte based units and rename _FACTOR to BYTE
With the removal of the 512 byte constants, such as MEBIBYTE, it
was possible to rename the _FACTOR constants back to BYTE
constants.  The _FACTOR constants, such as MEBI_FACTOR, were a
temporary measure to help in the transition to support devices
with sector sizes > 512 bytes.
2010-04-26 13:40:38 -06:00
Curtis Gedak f46fbedd34 Remove default sector size
The DEFAULT_SECTOR_SIZE was a temporary measure to help in the
transition to support devices with sector sizes > 512 bytes.  It
is no longer needed.
2010-04-26 13:04:39 -06:00
Curtis Gedak 896dab7192 Enhance copy_filesystem method to work with sector sizes
This change is in preparation for supporting sectors sizes > 512 bytes.
2010-04-26 11:43:59 -06:00
Curtis Gedak 74ecd2ed3f Set sector size and add to operation and dialog methods
This change is in preparation for supporting sectors sizes > 512 bytes.
2010-04-19 19:22:31 -06:00
Curtis Gedak 4bcd0a3704 Add device sector size to partition object
The device sector size is needed in all calculations that convert
between sectors and bytes.  The device sector_size is included in
the partition object because this object is used to contain
operation information in addition to actual partitions and
unallocated space.  A second option was considered to pass the
device object to many methods, but this was considered a much
larger task that might not provide significant gains in
maintainability.
2010-04-19 19:06:08 -06:00
Curtis Gedak 8fb40d843d Enhance copy methods for sector sizes > 512 bytes 2010-04-07 11:39:42 -06:00
Curtis Gedak 44e5176ee5 Enhance format_size() for sector sizes > 512 bytes 2010-03-24 14:37:08 -06:00
Curtis Gedak 1aa81bba94 Enhance sector_to_unit() for sector sizes > 512 bytes 2010-03-24 14:37:08 -06:00
Curtis Gedak f9f603256e Convert file system maximum from sector to byte value 2010-03-24 14:37:08 -06:00
Curtis Gedak 40d7dbac4b Convert file system minimum from sector to byte value 2010-03-24 14:37:08 -06:00
Curtis Gedak 4d658a10a8 Add constants to aid in transition to support sector sizes > 512 bytes 2010-03-24 14:37:08 -06:00
Curtis Gedak 70584176de Disable extended option for non-MSDOS and non-DVH disk types (#583906)
According to parted documentation, only "msdos" and "dvh" disk
types (or partition table types) support extended partitions.
All other disk types support primary partitions only.
2010-02-24 11:39:42 -07:00
Curtis Gedak 19d8f0dfc8 Add sector size to device display pane
Also add sector_size to Device class.  This is the start of an
enhancement to add support for devices with sector sizes other
than 512 bytes (#607165).
2010-02-20 15:12:26 -07:00
Curtis Gedak 20f5c6f83b Clean up code for old bug #157871
Remove commented code and boolean use-C-lang parameter for
Utils::num_to_str() method because this bug was fixed in
gcc-4.0.3.  The GNU gcc compiler versions 4 and up are now
commonly in use.  Also due to previous partial commenting and
removal of the code, the code was non-functional

Thanks goes to Jan Claeys for pointing out this clean up
opportunity.
2010-01-02 15:04:30 -07:00
Curtis Gedak 8cfb27b718 Cleanup file copyright entries
Restore copyright entries by original author to those of his last
known repository commit titled "released gparted-0.3.4 on
LarryT's request." on Feb 25, 2007.

Add my own copyright entries for files in which I changed source
code.  Files in which I only made spelling changes do not have my
copyright entry added.
2009-11-05 11:08:49 -07:00
Curtis Gedak 1607d13a06 Added auto detection of Linux software RAID devices
Auto detection of Linux software RAID devices was lost in GParted
0.3.8.  This was because device scanning by the libparted device
call ped_device_probe_all() was replaced with custom code within
GParted to scan /proc/partitions for devices.

The reason the libparted call was replaced was due to a long
scanning problem with ped_device_probe_all(), a non-existent
physical floppy device, and a BIOS setting indicating a floppy
drive existed.  See bug #351753:
https://bugzilla.gnome.org/show_bug.cgi?id=351753
2009-11-03 13:30:44 -07:00
Curtis Gedak c2d19a8ab4 Replace gnome-open with gtk_show_uri (#600046)
This change was performed to align with a GNOME goal:
http://live.gnome.org/GnomeGoals/RemoveGnomeOpenGnomeHelp

For backwards compatibility, the gnome-open command is used
when gtkmm < 2.14.0.
2009-11-03 10:27:35 -07:00
Curtis Gedak 0723c82f30 Update copyright year for Win_GParted class 2009-10-24 15:17:13 -06:00
Curtis Gedak 73471032c9 Improve feedback when creating or pasting partition (#579266)
Improve the feedback to the user when creating or pasting a
partition on a device with no partition table found.

Prior to this enhancement if a user tried to create or paste a
partition onto a device with no partition table found, GParted
would present the user with a Create Partition Table dialog.

When creating a new partition this could cause confusion for
users who were trying to format the disk.  The user could
mistakenly believe the choice of an MS-DOS file system was being
presented.

Similarly on a paste operation it could be confusing to be
presented with a dialog to create a partition table without any
explanation of why a partition table was suddenly required in the
midst of the paste operation.

Neither the new partition creation, nor the partition paste
actions were performed after the Create Partition Table dialog
was displayed.
2009-10-24 14:16:40 -06:00
Curtis Gedak 0af42af3d0 Add padding to progress dialog window 2009-10-22 10:19:47 -06:00
Curtis Gedak 301bd77312 Refactor some logic into separate settle_device method 2009-05-02 10:59:49 -06:00
Curtis Gedak 2a89d936d6 Remove get_dmraid_prefix method used to specify a single device
It appears that different dmraid versions handle specifying a
single dmraid device differently.

dmraid-1.0.0.rc14 uses a partial name only,
  such as "isw" or "isw_cjbdddajhi".
dmriad-1.0.0.rc15 uses a full name only,
  such as "isw_cjbdddajhi_Vol0".

To maintain compatibility with the broadest range of dmraid versions,
the ability to specify a single dmraid device is being removed.
2009-04-29 16:34:30 -06:00
Curtis Gedak 9816f5c18a Refactor some logic into separate get_udev_name method 2009-04-28 13:42:47 -06:00
Curtis Gedak ce4de8b51e Improve dmraid device detection with checking udev if needed
Some distros appear to display /dev/dm-# device names with
libparted.  Since this fails a pattern match with the dmraid
device name, check with udev to see if a pattern match is
possible with the name returned from udevinfo or udevadm info.

For example:
     /dev/mapper/isw_cjbdddajhi_Vol0 is the device name
     /dev/dm-0 is a symbolic link pointing to the above device name
2009-04-26 16:45:53 -06:00
Curtis Gedak 5112e41815 Update copyright year for FS_Info class 2009-04-26 15:49:30 -06:00
Curtis Gedak 47f0d6bd5d Enhance UUID detection to fallback to vol_id if available
Normally, the blkid command will detect the UUID for a file system.
In cases where blkid fails to detect the UUID and the vol_id command
is available, then try using the vol_id command.
2009-04-24 17:46:05 -06:00
Curtis Gedak 8d024d86df Improve initialization logic for FS_Info class
Ensure that fs_info_cache is populated in any first instantiation in
a program, even for an instantiation such as:
    FS_Info A(false);
2009-04-24 17:18:36 -06:00
Curtis Gedak 946b462757 Enhanced dmraid partition deletion
svn path=/trunk/; revision=1098
2009-03-16 22:59:50 +00:00
Curtis Gedak eda5bf16aa Improved swap and dmraid mountpoint detection
svn path=/trunk/; revision=1097
2009-03-16 22:55:24 +00:00
Curtis Gedak 5865c92dc0 Added new class for dmraid support
svn path=/trunk/; revision=1092
2009-03-14 20:02:41 +00:00
Curtis Gedak dbf81bc417 Removed file_exists() method. Glib::file_test() already exists and is available for use.
svn path=/trunk/; revision=1091
2009-03-13 14:17:22 +00:00
Curtis Gedak 2390671112 Added tokenize() and file_exists() methods
svn path=/trunk/; revision=1090
2009-03-12 19:37:12 +00:00
Curtis Gedak dc1ab54d8f Added detection of btrfs file system
svn path=/trunk/; revision=1075
2009-02-23 20:22:30 +00:00
Curtis Gedak 3ef0293876 Added detection of LUKS encrypted partitions
svn path=/trunk/; revision=1071
2009-02-18 16:19:49 +00:00
Curtis Gedak ad078627d5 Added strict_start indicator
svn path=/trunk/; revision=1069
2009-02-16 19:37:27 +00:00
Curtis Gedak 533eb1bc03 Added support for ext4 file systems
svn path=/trunk/; revision=1005
2008-12-18 22:13:43 +00:00
Curtis Gedak c020834508 Created 2 files to support ext4 operations.
Support for ext4 is planned for version 2.6.28 of the Linux kernel.

svn path=/trunk/; revision=1004
2008-12-18 22:07:06 +00:00
Curtis Gedak 5493f7ecc6 Added get_fs_type() method to retrieve the file system type
svn path=/trunk/; revision=1003
2008-12-18 21:36:57 +00:00
Curtis Gedak 7a3fa5a7dd Reduced FS_Info cache disk reads
svn path=/trunk/; revision=1001
2008-12-08 18:23:30 +00:00
Curtis Gedak 4ef71e5004 Added lvm2 physical volume detection
svn path=/trunk/; revision=1000
2008-12-07 18:43:35 +00:00
Curtis Gedak 4370af8779 Added text selectable parameter to mk_label()
svn path=/trunk/; revision=996
2008-12-03 18:18:04 +00:00
Curtis Gedak ab50d0254f Moved common code into new get_device_entry() method
svn path=/trunk/; revision=988
2008-11-29 16:22:48 +00:00
Curtis Gedak c4bc4430c7 Fixed incorrect spelling of filesystem and mountpoint
svn path=/trunk/; revision=970
2008-11-18 23:58:17 +00:00
Curtis Gedak e4c2ca33aa Improved File System Support dialog readability.
- Changed title Features to File System Support.
 - Renamed button Refresh to Rescan Support.
 - Created expander for legend and added narrative.
 - Removed columns detect and read.

svn path=/trunk/; revision=966
2008-11-14 20:18:46 +00:00
Curtis Gedak 506c062274 Created method get_filesystem_software()
svn path=/trunk/; revision=965
2008-11-14 19:45:14 +00:00
Curtis Gedak 5b8c16ba60 Improved read label performance with blkid cached results
svn path=/trunk/; revision=963
2008-11-13 20:06:18 +00:00
Curtis Gedak ed9b5afe36 Added read UUID read display
svn path=/trunk/; revision=961
2008-11-11 17:21:22 +00:00
Curtis Gedak 135e60141f Created class to read file system UUIDs
svn path=/trunk/; revision=960
2008-11-11 17:19:46 +00:00
Curtis Gedak 352641208a Added fat_compliant_label() method to limit volume labels to 11 characters.
Enforced fat compliant label for FAT16 and FAT32 file systems.

svn path=/trunk/; revision=959
2008-11-11 00:14:57 +00:00
Curtis Gedak 55952fe621 Renamed set_label and get_label methods to write_label and read_label respectively.
svn path=/trunk/; revision=957
2008-11-08 23:55:17 +00:00
Curtis Gedak 2331bd0763 Added set and get thread status message methods.
Added thread status message updates in set_devices().

svn path=/trunk/; revision=943
2008-10-30 18:50:38 +00:00
Curtis Gedak 6a28b6810a Created function get_lang() to retrieve language locale
svn path=/trunk/; revision=935
2008-10-16 19:58:14 +00:00
Curtis Gedak dbccd477cf Fixed display problem with percent complete messages
svn path=/trunk/; revision=895
2008-09-04 16:36:14 +00:00
Curtis Gedak 46ca7c74dc Added code hooks to prepare for GParted Manual
svn path=/trunk/; revision=876
2008-08-05 15:34:10 +00:00
Curtis Gedak b10f2325d7 Migrated Round to cylinders checkbutton from dialog partition new to dialog base partition so that it can be used by all dialogs that inherit from dialog base partion (e.g., New, Copy, and Resize/Move)
svn path=/trunk/; revision=856
2008-06-15 17:18:26 +00:00
Curtis Gedak 8d808c0b62 gparted-0.3.6 - code recreation from Source Forge
svn path=/trunk/; revision=810
2008-04-07 19:41:18 +00:00
Curtis Gedak 6c149ea1d9 gparted-0.3.5 - code recreation from Source Forge
svn path=/trunk/; revision=809
2008-04-07 15:26:19 +00:00
Bart Hakvoort 8d2e7dd26d replaced 'long' with 'Sector' to prefent overflows with really large
* include/Device.h,
  include/Dialog_Base_Partition.h,
  src/Dialog_Base_Partition.cc: replaced 'long' with 'Sector' to
  prefent overflows with really large devices.
2006-12-08 13:14:05 +00:00
Bart Hakvoort 7a413f6401 added libparted version string to details export.
* include/Dialog_Progress.h,
  include/GParted_Core.h,
  src/Dialog_Progress.cc,
  src/GParted_Core.cc,
  src/Win_GParted.cc: added libparted version string to details
  export.
2006-12-01 13:01:46 +00:00
Bart Hakvoort ef09ce0b97 added 'check' operation. The functionality was already there, but it was
* include/Makefile.am,
  include/Operation.h,
  include/Win_GParted.h,
  src/GParted_Core.cc,
  src/Makefile.am,
  src/Win_GParted.cc,
  include/OperationCheck.h (new),
  src/OperationCheck.cc (new): added 'check' operation. The
  functionality was already there, but it was not possible yet to
  activate it from the gui.
2006-11-26 14:27:16 +00:00
Bart Hakvoort 452b90b095 added 'Read Label' info
* include/DialogFeatures.h,
  src/DialogFeatures.cc: added 'Read Label' info
2006-09-23 11:02:46 +00:00
Bart Hakvoort 0693e7996f added popupmenu to operationslist and did some (higrelated) cleanups
* added popupmenu to operationslist and did some (higrelated) cleanups
2006-09-17 13:23:47 +00:00
Bart Hakvoort 600e990a6e trivial cleanups
* include/TreeView_Detail.h,
  src/TreeView_Detail.cc: trivial cleanups
2006-09-16 15:00:25 +00:00
Bart Hakvoort fc8014115e some small changes to make the GUI more consistent (#353140)
* include/Win_GParted.h,
  src/Win_GParted.cc: some small changes to make the GUI more
  consistent (#353140)
2006-09-16 11:27:05 +00:00
Bart Hakvoort 5e2b8f9837 finally fixed problem with 'disappearing' devicenodes by using udevsettle
* include/GParted_Core.h,
  src/GParted_Core.cc: finally fixed problem with 'disappearing'
  devicenodes by using udevsettle (#352744)
2006-09-13 19:35:17 +00:00
Bart Hakvoort e3b4a7316b added support for reading volumelabels. Atm we only read ext2/3, but the
* added support for reading volumelabels. Atm we only read ext2/3, but
  the infrastructure for adding the other filesystems is in place.
  It's simply a matter of finding the right commands and parsing the
  output. (see #338528 for more info)
2006-09-12 20:34:33 +00:00
Bart Hakvoort 79672a5298 make sure progressfraction stays between 0.0 and 1.0 implemented rollback
* src/Dialog_Progress.cc: make sure progressfraction stays between 0.0
  and 1.0
* include/GParted_Core.h,
  src/GParted_Core.cc: implemented rollback in case of failed move of
  overlapping filesystems. Together with the readonly test moving
  should be quite save now :)
2006-09-10 12:17:33 +00:00
Bart Hakvoort 7044410a08 Show number of warnings after all operations are completed. Also urge
* include/Dialog_Progress.h,
  src/Dialog_Progress.cc: Show number of warnings after all operations
  are completed. Also urge people to save their details in case of
  error.
2006-09-09 10:58:48 +00:00
Bart Hakvoort 52eb5545ec trivial 'breakfast cleanups' :)
* include/Frame_Resizer_Base.h,
  src/Frame_Resizer_Base.cc,
  src/Frame_Resizer_Extended.cc,
  src/GParted_Core.cc: trivial 'breakfast cleanups' :)
2006-09-09 07:09:13 +00:00
Bart Hakvoort 59fe25882a declared char * buf global, so it can be initialized in copy_blocks().
* include/GParted_Core.h,
  src/GParted_Core.cc: declared char * buf global, so it can be
  initialized in copy_blocks(). This is a lot more efficient than
  initializing it on every copy_block()
2006-09-08 09:33:02 +00:00
Bart Hakvoort f7ec213481 added test_overlap() perform a readonly testrun before the actual move if
* include/Partition.h,
  src/Partition.cc: added test_overlap()
* include/GParted_Core.h,
  src/GParted_Core.cc: perform a readonly testrun before the actual
  move if destination overlaps source.
2006-09-07 20:31:05 +00:00
Bart Hakvoort bd4d110fdb parse /proc/partitions to find devices instead of using
* include/GParted_Core.h,
  src/GParted_Core.cc: parse /proc/partitions to find devices instead
  of using ped_device_probe_all()
2006-09-07 18:40:15 +00:00
Bart Hakvoort 7eb2a9cbb1 update ntfsbootsector after first sector has changed. This is necessary to
* include/GParted_Core.h,
  src/GParted_Core.cc: update ntfsbootsector after first sector has
  changed. This is necessary to let windows boot correctly afterwards.
* src/ntfs.cc: added FIXME
2006-09-04 19:18:44 +00:00
Bart Hakvoort 9cbfca1c6e check if dest >= src before starting a copy
* include/GParted_Core.h,
  src/GParted_Core.cc: check if dest >= src before starting a copy
2006-09-03 18:24:09 +00:00
Bart Hakvoort 95f563d13c more fixes related to moving..
* include/GParted_Core.h,
  src/GParted_Core.cc: more fixes related to moving..
2006-09-03 14:24:05 +00:00
Bart Hakvoort 34389f38e7 tried to fix a couple of errors with moving to the right with overlap
* include/GParted_Core.h,
  src/GParted_Core.cc: tried to fix a couple of errors with moving to
  the right with overlap (thanks Larry for hunting ;) )
  Although everything seems to work well i'm still not sure if
  everything is 100% ok.
  I guess everything could use some more testing, which is exactly
  what i plan to do this weekend :)
2006-08-31 20:19:38 +00:00
Bart Hakvoort 36dc2e4cf2 added legend (#353104) added FIXME
* include/DialogFeatures.h,
  src/DialogFeatures.cc: added legend (#353104)
* src/fat32.cc: added FIXME
2006-08-27 19:29:24 +00:00
Bart Hakvoort d23ca9d8ea ^) restructured resize_move() to be more robust. This will hopefully
* happy 24th birthday Johannes! :^)
* include/GParted_Core.h,
  src/GParted_Core.cc: restructured resize_move() to be more robust.
  This will hopefully tackle a couple of issues which came up during
  the public testing.
2006-08-27 08:41:25 +00:00
Bart Hakvoort 5060b1a07c improvements to probe and copy stuff.
* include/GParted_Core.h,
  src/GParted_Core.cc: improvements to probe and copy stuff.
2006-08-26 14:37:06 +00:00
Bart Hakvoort 8abc8bf2e5 added format_time() keep track of elapsed time between STATUS_EXECUTE and
* include/Utils.h,
  src/Utils.cc: added format_time()
* include/OperationDetail.h,
  src/OperationDetail.cc: keep track of elapsed time between
  STATUS_EXECUTE and STATUS_[ERROR|SUCCES]
* include/Dialog_Progress.h,
  src/Dialog_Progress.cc: show elapsed time in the details per (sub)
  process
* src/GParted_Core.cc: use Utils::format_time()
2006-08-22 19:29:59 +00:00
Bart Hakvoort ab8e1b586d replaced hardcoded menu and toolbar indices with variables. This is far
* include/Win_GParted.h,
  src/Win_GParted.cc: replaced hardcoded menu and toolbar indices with
  variables. This is far more flexible and reliable.
2006-08-20 16:51:18 +00:00
Bart Hakvoort 649f26be9f fixed some issues with combi move+shrink on fat* and hfs* filesystems.
* include/GParted_Core.h,
  src/GParted_Core.cc: fixed some issues with combi move+shrink on
  fat* and hfs* filesystems.
  Also call wait_for_node() from commit() if 'node' was provided.
2006-08-20 11:47:17 +00:00
Bart Hakvoort 889ab1232f changed progressfeedbackhandling a bit. Because this affected
* changed progressfeedbackhandling a bit. Because this affected
  OperationDetail i had to make changes in almost every file.
2006-08-20 09:33:54 +00:00
Bart Hakvoort 8393f5ef6a created set_progress_info() (i actually planned on adding some time
* include/GParted_Core.h,
  src/GParted_Core.cc: created set_progress_info() (i actually planned
  on adding some time remaining stuff, but xfiles is waiting ;) )
2006-08-15 18:33:56 +00:00
Bart Hakvoort 9576eb981e couple of cleanups in operationhandling and initalizing of p_filesystem.
* include/GParted_Core.h,
  src/GParted_Core.cc: couple of cleanups in operationhandling and
  initalizing of p_filesystem.
2006-08-13 13:31:57 +00:00
Bart Hakvoort 20be2db114 small fix to pass 'make distcheck'
* include/Makefile.am: small fix to pass 'make distcheck'
2006-08-09 19:33:51 +00:00
Bart Hakvoort ac53a7875f did some work on disabling of automounting of removable drives. The
* include/GParted_Core.h,
  src/GParted_Core.cc: did some work on disabling of automounting of
  removable drives. The current method is not entirely to my liking
  but it seems to work.
2006-08-09 19:20:20 +00:00
Bart Hakvoort b539a10ddc implemented some stuff to find a good blocksize to use for copy/move.
* implemented some stuff to find a good blocksize to use for
  copy/move. Actually i'm not really happy with it, because probing
  seems suboptimal, but it's better than nothing. As soon as i have
  some time i should do some research on the subject to find a better
  solution.
2006-08-08 19:04:29 +00:00
Bart Hakvoort b42982b884 construct operations in the activate*() functions instead of in
* include/Win_GParted.h,
  src/Win_GParted.cc: construct operations in the activate*()
  functions instead of in Add_Operation(). This approach allows for
  more customization of operations.
2006-08-01 20:19:17 +00:00
Bart Hakvoort 89a42f3f07 added get_sector() use new Partition::get_sector()
* include/Partition.h,
  src/Partition.cc: added get_sector()
* src/GParted_Core.cc: use new Partition::get_sector()
2006-08-01 12:47:03 +00:00
Bart Hakvoort 677a21f50a improved errorhandling a bit. At the initialscan we store errors/warnings
* improved errorhandling a bit. At the initialscan we store
  errors/warnings now in a list per partition and show the in the
  partitioninfo dialog.
  While executing an operation we collect all libparted exceptions in
  a list and attach this list to the operationdetails when everything
  is done.
2006-07-30 15:13:41 +00:00
Bart Hakvoort e033136a6f renamed some enums
* renamed some enums
2006-07-29 15:20:32 +00:00
Bart Hakvoort d52b0286c9 fixed Pango markup problems in operationdetails restructured
* fixed Pango markup problems in operationdetails
* restructured OperationDetail
* renamed some enums for improved readability of the source
2006-07-29 08:27:28 +00:00
Bart Hakvoort d663c3c277 removed cylindersize buffering during resize from the filesystems. It is
* include/FileSystem.h,
  include/GParted_Core.h,
  src/FileSystem.cc,
  src/GParted_Core.cc,
  src/ext2.cc,
  src/ext3.cc,
  src/ntfs.cc,
  src/reiserfs.cc: removed cylindersize buffering during resize from
  the filesystems. It is not needed anymore now we calculate the new
  position before calling this.
  Also added some extra progressfeedback in the core
2006-07-23 18:43:15 +00:00
Bart Hakvoort 8059d5f6d9 more work on moving/resizing sequence
* include/GParted_Core.h,
  src/GParted_Core.cc: more work on moving/resizing sequence
2006-07-23 16:51:38 +00:00
Bart Hakvoort f0d4890a92 added FIXME: decoupled libparted partition and filesystemresizing. This
* src/Win_GParted.cc: added FIXME:
* include/GParted_Core.h,
  src/GParted_Core.cc,
  src/fat32.cc: decoupled libparted partition and filesystemresizing.
  This resulted in a much more consistent core. This also affected
  several other aspects of resizing/moving in a positive way.
2006-07-23 09:58:45 +00:00
Bart Hakvoort dc883ee652 perform some checks before adding a new operation to the list. made
* include/GParted_Core.h,
  src/GParted_Core.cc,
  src/Win_GParted.cc: perform some checks before adding a new
  operation to the list.
* src/Partition.cc: made get_length() a bit safer
2006-07-20 19:14:44 +00:00
Bart Hakvoort f7722d2bbf show warning in progressfeedback if a certain action is n/a. Of course we
* include/Dialog_Progress.h,
  include/Operation.h,
  src/Dialog_Progress.cc,
  src/GParted_Core.cc: show warning in progressfeedback if a certain
  action is n/a. Of course we only allow these actions if the results
  are non-lethal.
2006-07-19 20:54:08 +00:00
Bart Hakvoort cf59b71bf4 worked a bit on progressfeedback.. added FIXME
* include/GParted_Core.h,
  src/GParted_Core.cc: worked a bit on progressfeedback..
* include/Partition.h: added FIXME
2006-07-18 21:10:10 +00:00
Bart Hakvoort 8c5326e8b6 implemented snap to cylinder algorithm. Although the algorithm is very
* src/Win_GParted.cc,
  include/GParted_Core.h,
  src/GParted_Core.cc: implemented snap to cylinder algorithm.
  Although the algorithm is very simple, it seems to work perfectly.
  However, some additional testing is required.
2006-07-17 20:54:41 +00:00
Bart Hakvoort 357e2d84bc lots of fixes and improvements (mostly move-related)
* lots of fixes and improvements (mostly move-related)
2006-07-11 18:13:27 +00:00
Bart Hakvoort b223e829ab renamed resize_partition to resize_move_partition to better reflect its
* include/GParted_Core.h,
  src/GParted_Core.cc: renamed resize_partition to
  resize_move_partition to better reflect its functionality.
2006-06-18 19:38:29 +00:00
Bart Hakvoort 8fecbac1d0 did more work on moving
* include/GParted_Core.h,
  src/GParted_Core.cc: did more work on moving
2006-06-18 19:27:52 +00:00
Bart Hakvoort afa792bf0c some more cleanups, should be finished now :)
* include/GParted_Core.h,
  src/GParted_Core.cc,
  src/Win_GParted.cc: some more cleanups, should be finished now :)
2006-06-18 08:50:17 +00:00
Bart Hakvoort 32dc8481c8 restructured the core a bit, over time it had become very messy.
* restructured the core a bit, over time it had become very messy.
2006-06-17 20:52:25 +00:00
Bart Hakvoort 2d7fb5700b more cleanups in the core and the fs'es (these changelogs are getting
* more cleanups in the core and the fs'es (these changelogs are
  getting boring ;^) )
2006-06-17 16:38:15 +00:00
Bart Hakvoort 08245cd08c cleanups in the core and the fs'es (resize)
* cleanups in the core and the fs'es (resize)
2006-06-17 14:44:17 +00:00
Bart Hakvoort 20d5650188 cleanups in the core and the fs'es (check/repair)
* cleanups in the core and the fs'es (check/repair)
2006-06-17 09:55:32 +00:00
Bart Hakvoort 682283ce89 cleanups in the core and the fs'es (create)
* cleanups in the core and the fs'es (create)
2006-06-17 08:56:24 +00:00
Bart Hakvoort b92ac20232 added movesupport, atm in experimental state and needs lots of cleaning.
* include/GParted_Core.h,
  src/GParted_Core.cc,
  src/ext2.cc: added movesupport, atm in experimental state and needs
  lots of cleaning. only enabled for ext2, but should work for all
  filesystems.
* src/DialogFeatures.cc: added alternating rowcolours (see #342682)
2006-05-31 20:03:49 +00:00
Bart Hakvoort 7ff0609962 made blocksize settable by the user.
* include/Dialog_Partition_Copy.h,
  include/GParted_Core.h,
  include/OperationCopy.h,
  include/Win_GParted.h,
  src/Dialog_Partition_Copy.cc,
  src/GParted_Core.cc,
  src/OperationCopy.cc,
  src/Win_GParted.cc: made blocksize settable by the user.
2006-05-27 19:51:55 +00:00
Bart Hakvoort 7bb7e8a84f Use ped_device_read and ped_device_write instead of 'dd' to copy
* Use ped_device_read and ped_device_write instead of 'dd' to copy
  filesystems.
  Modified progressdetails to provide more detailed feedback about a
  process.
  Basicly these were all changes to the infrastructure to make the
  incorporation of the 'move-code' a bit easier.

  ( sorry, not in the mood to list all affected files ;)
2006-05-23 21:17:34 +00:00
Bart Hakvoort 17e088553d disabled resizing of this dialog renamed 'Filesystems' to 'Features' in
* src/DialogManageFlags.cc: disabled resizing of this dialog
* include/DialogFeatures.h,
  include/Makefile.am,
  include/Win_GParted.h,
  src/DialogFeatures.cc,
  src/Makefile.am,
  src/Win_GParted.cc: renamed 'Filesystems' to 'Features' in the
  featuredialog to better reflect the actual functionality
* include/Dialog_Filesystems.h,
  src/Dialog_Filesystems.cc: removed
2006-04-05 09:33:04 +00:00
Bart Hakvoort 7f187d644c added column 'check' use halproperty 'storage.automount_enabled_hint'
* include/Dialog_Filesystems.h,
  src/Dialog_Filesystems.cc: added column 'check'
* include/GParted_Core.h,
  src/GParted_Core.cc: use halproperty
  'storage.automount_enabled_hint' instead of pmount to disable
  automounting.
2006-04-03 18:48:53 +00:00
Bart Hakvoort 3a918a337b improved disabling of automounting. It's still somewhat crude, but right
* include/GParted_Core.h,
  src/GParted_Core.cc: improved disabling of automounting. It's still
  somewhat crude, but right now it's ok for some semi-public testing.
  I'll do some cleanups tomorrow morning.
* src/Dialog_Progress.cc: added FIXME
2006-04-02 21:26:27 +00:00
Bart Hakvoort 26da768ee0 an initial solution for the automount problem. I still need to add
* include/GParted_Core.h,
  src/GParted_Core.cc: an initial solution for the automount problem.
  I still need to add something to prevent just created partitions from
  getting mounted. (see #324220 for more info)
2006-04-02 18:03:37 +00:00
Bart Hakvoort e933473cfa added ufs filesystemclass
* include/Dialog_Filesystems.h,
  include/GParted_Core.h,
  include/Makefile.am,
  include/ufs.h,
  src/GParted_Core.cc,
  src/Makefile.am,
  src/ufs.cc: added ufs filesystemclass
2006-04-02 14:35:21 +00:00
Bart Hakvoort 321f0a3dd1 override Gtk::Window::on_show instead of connecting to signal_show() added
* include/Win_GParted.h,
  src/Win_GParted.cc: override Gtk::Window::on_show instead of
  connecting to signal_show()
* include/Dialog_Filesystems.h,
  src/Dialog_Filesystems.cc: added columns 'detect' and 'read'
2006-04-02 14:04:44 +00:00
Bart Hakvoort dcf31ca083 added convenience function cleanups
* include/Utils.h,
  src/Utils.cc: added convenience function
* src/DialogManageFlags.cc,
  src/Win_GParted.cc: cleanups
2006-04-02 13:04:24 +00:00
Bart Hakvoort 540152345e improved behaviour of flagmanagementdialog.
* include/DialogManageFlags.h,
  src/DialogManageFlags.cc,
  src/Win_GParted.cc: improved behaviour of flagmanagementdialog.
2006-04-02 11:18:34 +00:00
Bart Hakvoort a044f0f88b let create_empty_partition() return a boolean instead of an integer.
* include/GParted_Core.h,
  src/GParted_Core.cc: let create_empty_partition() return a boolean
  instead of an integer.
2006-03-31 13:10:32 +00:00
Bart Hakvoort f5ea37e310 add 'flag management' (#330453)
* include/DialogManageFlags.h,
  include/GParted_Core.h,
  include/Makefile.am,
  include/Utils.h,
  include/Win_GParted.h,
  src/DialogManageFlags.cc,
  src/GParted_Core.cc,
  src/Makefile.am,
  src/Win_GParted.cc: add 'flag management' (#330453)
2006-03-31 10:49:27 +00:00
Bart Hakvoort 70bfe578d4 added set_used() and operator!= it's now possible to copy from partition
* include/Partition.h,
  src/Partition.cc: added set_used() and operator!=
* src/Dialog_Partition_Copy.cc,
  src/GParted_Core.cc,
  src/OperationCopy.cc,
  src/Win_GParted.cc: it's now possible to copy from partition to
  partition. (before this it was only possible to copy to unallocated
  space)
2006-03-29 19:21:42 +00:00
Bart Hakvoort 91c4ca2b45 fixed another minor memleak (yeah i'm playing with valgrind ;) )
* include/GParted_Core.h,
  src/GParted_Core.cc: fixed another minor memleak (yeah i'm playing
  with valgrind ;) )
2006-03-28 19:01:20 +00:00