Commit Graph

905 Commits

Author SHA1 Message Date
Mike Fleetwood 2919057abd Improve reiser4 file system uuid reading method
Previously used "fsck.reiser4" to perform a file system check with a by
product of outputting the uuid.  However this performs a lot of disk I/O
and takes a while to complete.  Instead use the much faster and less
resource intensive "debugfs.reiser4" tool to retrieve the uuid.
2012-03-15 10:38:04 -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
Curtis Gedak 1c0ea2783d Restore write label capability for linux-swap
The setting of the write label capability for linux-swap was lost
when it was overwritten in the following commit:

Add support for setting UUID (#667278)
9e96159bb2
2012-02-18 13:54:58 -07:00
Rogier Goossens 1197a52174 New partition dialog: first filesystem in list is always included
Even if invalid, the first filesystem in list is always included.

This is an off-by-one error, which was triggered when the first member
of FILESYSTEMS was no longer a regular filesystem, as a result of
commit ce9feeda0e9a04da04cec0a1b01512ed68c2495c:
'Make FileSystem objects in GParted_Core accessible and usable by others'
2012-02-18 10:32:30 -07:00
Rogier Goossens 387feb143a Fix for implicit assumption that 'FS_UNKNOWN' is last in FILESYSTEMS list
This assumption was invalidated by commit
ce9feeda0e9a04da04cec0a1b01512ed68c2495c:
'Make FileSystem objects in GParted_Core accessible and usable by others'

This patch removes the dependency on this implicit assumption.
2012-02-18 10:32:13 -07:00
Curtis Gedak 93241cccbf Fix regression when shrinking, moving and copying swap (#670017)
Since linux-swap does not contain data and does not have a resize
command, linux-swap is recreated instead of moved, copied, or resized.

GParted 0.11.0 contained the following enhancement:
Bug #663980 - Avoid redundant file system maximize actions

An unfortunate side effect of this change was that the required
maximize action to recreate linux-swap would not occur when the new
size for the partition was less than or equal to the original size.

The changes associated with this commit address this regression.

Closes Bug #670017 - Corrupting swap partitions
2012-02-14 11:31:15 -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 11d044dba0 Don't ignore any errors resizing btrfs on Linux >= 3.2 (#669389)
Btrfs file system can be successfully resized to the same size without
failing on Linux 3.2 or higher.

Linux 3.2-rc4 includes commit:
    35bae54a255fbf3eab747b842d300d59f6e1abb4
    Btrfs: Don't error on resizing FS to same size

Closes bug #669389
2012-02-10 11:20:47 -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 88cfe40a8b Remove temporary file after reading UUID of fat16 and fat32 filesystems 2012-02-10 10:33:13 -07:00
Rogier Goossens a5eb91e549 Further improve help manual wording
See Bug #667278 - Add support for setting UUID
2012-02-10 10:33:13 -07:00
Curtis Gedak 2f191307cf Restructure and word-smith UUID translatable text
Restructure and word-smith translatable text associated with the
enhancement to add ability for setting UUID in an effort to better
align with the Gnome Documentation Style Guide.

See Bug #667278 - Add support for setting UUID
2012-02-10 10:33:13 -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
Rogier Goossens 50befd62a3 Check LVM cache only for LVM physical volumes
Determine the FS type before checking whether a FS is busy,
and check LVM only for LVM PVs.

Remove the LVM busy check for extended partitions, as they
don't contain LVM PVs - or any other FS for that matter.
(and even if they did, the rest of the code silently assumes
they don't...)
2012-02-08 15:46:36 -07:00
Curtis Gedak cb3aab77fc Add comment to Utils::tokenize method 2012-02-03 11:38:51 -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 72ac712024 Show LVM2 PVs as supported, read-only (#160787)
Add LVM2 PV into the File System Support dialog list and remove the
warning message reporting LVM as not being supported.

Bug #160787 - lvm support
2012-02-02 10:24:31 -07:00
Mike Fleetwood aa085a3caa Display busy status of LVM2 PVs (#160787)
A Volume Group is active when any of its Logical Volume mappings are
loaded (and enabled) in the Kernel's device-mapper driver.  Therefore
all the Physical Volumes in the VG (must be considered) active too.
This is exactly equivalent to a mounted file system, as the kernel is
actively using the partition.  Mark active LVM2 PVs as busy in GParted.

Don't use statvfs() for determining sector usage of busy LVM2 PVs as it
will fail with "statvfs(VGNAME): No such file or directory".  Instead
always use the LVM2 PV specific method.

Display the status of the LVM2 PV in the Information dialog using one of
the following relevant messages:
    Not active (Not part of any volume group)
    VGNAME not active
    VGNAME active
(The code uses the VGNAME stored in the partition's first mount point,
as displayed in the "Mount Point" column, rather than going back to the
primary source of the information in the LVM2_PV_Info class).

Temporarily prevent GParted from offering to unmount LVM2 PVs until
activating and deactivating Volume Groups is implemented later.

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 0acb623725 Allow unused space in a partition to equal its size
Newly created LVM2 PVs, before being added to a Volume Group, report
free space equal to the partition size.  Allow free space to equal
partition size.

    # parted /dev/sda10 unit B print
    Error: /dev/sda10: unrecognised disk label
    Model: Unknown (unknown)
    Disk /dev/sda10: 2147483648B
    Sector size (logical/physical): 512B/512B
    Partition Table: unknown
    # lvm pvcreate /dev/sda10
      Writing physical volume data to disk "/dev/sda10"
      Physical volume "/dev/sda10" successfully created
    # lvm pvs --units b -o pv_free /dev/sda10
      PFree
      2147483648B
2012-02-02 10:17:41 -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
Curtis Gedak 9c2b57cb50 Update copyright year 2012-01-25 16:55:51 -07:00
Curtis Gedak fcdd853cb9 Increase FAT32 minimum size to 33 MiB (#668491)
Closes Bug #668491 - Formatting small FAT32 partitions (32MB)
                     violates FAT32 specifications
2012-01-25 16:52:51 -07:00
Curtis Gedak c814b25a3a Avoid warning display when moving start of extended partition
Moving the start sector of an extended partition should not adversely
affect booting an operating system because an extended partition is
only a container for logical partitions.
2012-01-24 11:23:05 -07:00
Rogier Goossens 2522e480f7 Fix detection of multiple SW RAID (md) devices (#668486)
Closes Bug #668486 - GParted fails to detect multiple md (SWRaid)
                     devices
2012-01-23 13:12:48 -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
Curtis Gedak ee9f6f3432 Fix mismatched field precision type compiler warning
Inserted cast to int so that third parameter matches expected
parameter precision type.

Original warning:

FileSystem.cc: In member function ‘Glib::ustring
GParted::FileSystem::mk_temp_dir(const Glib::ustring&,
GParted::OperationDetail&)’:
FileSystem.cc:81:69: warning: field precision should have type ‘int’,
but argument 3 has type ‘long unsigned int’
2012-01-12 13:07:37 -07:00
Curtis Gedak 7c5b5edaef Reduce graphic processing requirement for pulse bar
Increase sleep time to decrease pulse bar update frequency.

Debian Bug 499193 - gparted: 100% cpu usage

Debian Bug 519764 - gparted: Lots of animation makes use over SSH
                    X-tunnel slow
2012-01-11 13:13:43 -07:00
Mike Fleetwood e414b71b73 Update xfs resize and copy to use new helper functions
Also update xfs file system support detection to allow growing even when
the xfs kernel module is not already loaded.
2012-01-11 12:49:13 -07:00
Mike Fleetwood a13e1a3863 Update btrfs resize to use new helper functions
Also update btrfs file system support detection to require kernel
support before allowing resizing.
2012-01-11 12:49:13 -07:00
Mike Fleetwood b0d818b8f9 Update jfs resize to use new helper functions
Also update jfs file system support detection to allow growing even when
the jfs kernel module is not already loaded.
2012-01-11 12:49:13 -07:00
Mike Fleetwood 15bca17a46 Add resize support to nilfs2 (#642842)
Resizing requires nilfs-utils 2.1 or higher and Linux 3.0 or higher.

Closes Bug #642842 - nilfs is not detected
2012-01-11 12:49:13 -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
Vincent Untz e52384b258 build: Correctly link to gthread
https://bugzilla.gnome.org/show_bug.cgi?id=667412
2012-01-06 12:42:31 -07:00
Curtis Gedak 18f863151c Fix long scan problem when BIOS floppy setting incorrect
The call to "blkid -c /dev/null" on Precise Pangolin Alpha 1 takes
exceedingly long.  This occurs when the BIOS is incorrectly set to
indicate a floppy drive is present when none is physically installed. 
Use cached blkid results instead.

Ubuntu launchpad 910379 - Gparted does not start and continues to
                          scan devices
https://bugs.launchpad.net/ubuntu/+source/gparted/+bug/910379
2012-01-06 10:31:14 -07:00
Mike Fleetwood 377d26f0cc Fix uninitialised read in OperationDetail::set_status()
Setting the status and controlling the timing of operation details
initialised with OperationDetail(desc, status, font) uses a conditional
branch depending on the uninitialised variable this->status.

valgrind:
==28957== Conditional jump or move depends on uninitialised value(s)
==28957==    at 0x80E4287:
GParted::OperationDetail::set_status(GParted::OperationDetailStatus)
(OperationDetail.cc:77)

OperationalDetail.cc:
   75  void OperationDetail::set_status( OperationDetailStatus status )
   76  {
>> 77          if ( this ->status != STATUS_ERROR )
   78          {
   79                  switch ( status )
   80                  {
2012-01-04 14:07:08 -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 e8bdb5d704 Avoid redundant file system maximize actions (#663980)
When GParted performed operations or combinations of operations,
such as:
  a)  copy to same or smaller size destination partition
  b)  move to same or smaller size due to alignment change
  c)  resize to smaller size
a redundant maximize file system operation would occur.

Normally these redundant maximize operations to grow the file
system to take up all the space in the partition were not harmful.

However in situations where libparted failed to inform the kernel
of partition changes, then the extra maximize operation would
grow the file system to be the original partition size.  In cases
where the original partition was larger than the new partition
size, this caused problems because the file system would be
larger than the partition on reboot.

This enhancement avoids redundant file system maximize actions on
copy, move, and resize, and should help reduce problems described
in the following links:

WARNING! Problem Resizing File Systems with GParted
http://gparted-forum.surf4.info/viewtopic.php?id=13777

Bug #601574 - ERROR: Current NTFS volume size is bigger than the
              device size!

Bug #604298 - Problems resizing file systems with
              gparted-live-0.5.0-3

Closes Bug #663980 - Avoid redundant file system maximize actions
                     on copy, move, and resize
2011-11-13 11:24:07 -07:00
Mike Fleetwood a580abbc30 Use newer btrfs multi-tool control command first
Btrfsctl and btrfs-show were depreciated in October 2011 and have been
superseeded by the newer btrfs multi-tool control command.  Use btrfs as
first choice, falling back to btrfsctl and btrfs-show when not found.
2011-11-13 09:29:45 -07:00
Mike Fleetwood 7ba1d417c5 Add labelling of btrfs file systems
Use "btrfs filesystem label" command to set the label of unmounted
btrfs file systems.
2011-11-13 09:29:45 -07:00
Stephen Kirkby e247357b51 Reverse umounting order in xfs::copy
See bug #663806 - Cannot copy XFS filesystem to new smaller
                  partition anymore
2011-11-13 09:24:01 -07:00
Curtis Gedak 38aab666b4 Enable copy to smaller XFS partition (#663806)
Closes Bug #663806 - Cannot copy XFS filesystem to new smaller
                     partition anymore
2011-11-11 11:52:49 -07:00
Curtis Gedak 32659e5e02 Add xfsdump package requirement to copy xfs file systems 2011-11-10 13:12:21 -07:00
Mike Fleetwood cbd3170e57 Fix btrfs volume label reading
There are still 2 issues with reading btrfs labels when falling back
on using btrfs-show command, rather than primary method of using the
blkid command:

1)  Label is set no "none" when btrfs-show is reporting there is no
    label, although it is impossible to distinguish from the case of the
    label actually being set to "none".

2)  The label has 2 trailing spaces appended as the regular expression
    matches "Label: (btrfslabel  )uuid:" rather than
    "Label: (btrfslabel)  uuid:" in the btrfs-show output.

Assume a label "none" means there is no label and fix the regular
expression.
2011-11-08 08:54:25 -07:00
Curtis Gedak 370c084947 Improve code comments for reading volume labels 2011-11-01 13:13:28 -06: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 2ae36153ee Display ntfs unicode volume labels properly
Prompted by Bug #662537 - Ext4 unicode labels not shown correctly
2011-11-01 13:05:42 -06:00
Curtis Gedak cf8293cf78 Display ext2/3/4 unicode volume labels properly (#662537)
Note that this enhancement changes GParted to first try the native
tools to determine the volume label for all file systems.  If the
volume label is not found then the fall back method is to use blkid.

There is a small degradation in device refresh times as a result of
this change.

Closes Bug #662537 - Ext4 unicode labels not shown correctly
2011-11-01 13:01:02 -06:00
Curtis Gedak 71c1606cac Repair broken volume label regular expression pattern
Also adjust indentation.
2011-11-01 12:45:14 -06:00
Curtis Gedak 47e0c00a7e Handle additional return codes from btrfsctl resizing
Sometimes btrfsctl returns 256 on successful resize, not just 0.
2011-10-25 11:52:10 -06:00
Curtis Gedak 284cfa7ed9 Add missing exfat file system to set_proper_filesystem method
This should have been part of commit
7cbc125a2e
2011-10-22 14:40:08 -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
Curtis Gedak ee9f9724e8 Add ability to resize btrfs file systems (#661715)
Closes Bug #661715 - use btrfs-tools ability to resize btrfs
                     partitions
2011-10-20 14:37:38 -06:00
Curtis Gedak 9b004634ab Fix innocuous bug
Fix bug introduced in GParted 0.9.0 in commit
4a8fef9822 to address ISO C++ ambiguity
compiler warning.

Due to the nature of the surrounding code, this bug was not evident
in the log file output.

Thanks to Magnus Fromreide for finding this bug.
2011-10-18 10:25:37 -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 bbd09a6321 Fix NTFS resize operation fails (#655215)
Due to a change in error handling behaviour in ntfsresize version
2.011.4.12AR.4 (libntfs-3g) GParted would fail to properly resize ntfs
file systems if the file system was marked for consistency check.

The current maintainer of ntfsprogs provided the following advice:

     "Well, though I am reverting back to the old behavior, you should
     add -ff instead of relying on an unspecified behavior when
     ntfsresize gets an error when trying to read the reply. I suppose
     you do not connect the stdin of ntfsresize, hence the error. With
     -ff no question is asked (I stress : even with the old
     ntfsresize)."

Hence I have added a second "--force" option to the ntfsresize command
for resizing NTFS file systems.

Closes Bug #655215 - NTFS partition resize fails
2011-09-13 11:20:50 -06:00
Tiffany Antopolski 3b87931e87 Dialog_Rescue_Data.cc: fixed type, director --> directory
This fixes bug# 657744
2011-08-31 10:14:01 -06:00
Curtis Gedak 4a8fef9822 Fix ISO C++ ambiguity compiler warning
Enhance code to pass compiler warning.  Prior to this change the
compiler would complain with the following message:

error: ISO C++ says that these are ambiguous, even though the worst
conversion for the first is better than the worst conversion for the
second: /usr/include/c++/4.5/bits/postypes.h:192:7: note: candidate 1:
std::fpos<_StateT> std::fpos<_StateT>::operator-(std::streamoff) const
[with _StateT = __mbstate_t, std::fpos<_StateT> =
std::fpos<__mbstate_t>, std::streamoff = long int] Utils.cc:443:27:
note: candidate 2: operator-(std::streamoff, long long int) <built-in>
2011-07-18 13:31:54 -06:00
Curtis Gedak f768cbd1b4 Fix ignoring return value compiler warnings
Add code to handle situation where realpath might return a NULL value.
Prior to this change the compiler would complain with the following
message:

error: ignoring return value of ‘char* realpath(const char*, char*)’,
declared with attribute warn_unused_result
2011-07-18 13:31:54 -06:00
Curtis Gedak 6c9d0cf6f1 Fix expression always true compiler warning
Removed expression that is always true.  Prior to this change the
compiler would complain with the following message:

error: comparison of unsigned expression >= 0 is always true
2011-07-18 13:31:54 -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
Curtis Gedak 026d0bd34b Fix ignoring return value compiler warning
Add code to handle situation where mkdtemp(char*) function returns
with a NULL value.  Prior to this code the compiler would complain
with the following message:

error: ignoring return value of ‘char* mkdtemp(char*)’, declared with
attribute warn_unused_result
2011-07-18 13:31:54 -06:00
Curtis Gedak 813010b148 Update AUTHORS file and minor variable rename
Add recognition for the work done by Markus Elfring.
Also minor variable rename and added comment for patch to bug #634090.
2011-07-18 13:28:49 -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 53b2b50f4a Fix size off by one sector with unrecognized disk label (#649444)
On disks with an unrecognized disk label, the end sector value
was saved as one sector larger than actual.  This caused the
Partition Information dialog to report the end sector value and
the total number of sectors on the disk as one larger than the
actual value.

Closes Bug #649444 - Partition information reports wrong sector
                     count
2011-05-31 09:45:18 -06:00
Curtis Gedak f188974a6c Improve English grammar: amount -> number (#650237)
Closes Bug #650237 - Grammar error: amount -> number
2011-05-24 11:53:08 -06:00
Gabor Kelemen cdbede1727 Typo: "on on" -> on 2011-05-24 11:03:31 -06:00
Seth Heeren 82fcb1ef0b Simplified cleanup_cursor() implementation
I hit this performance bug when I cloneda 40G NTFS partition. The actual
copy was done in under 11 minutes. After that I was shocked to find that
gparted would spend over 12 minutes in cleanup_cursor, pegging a CPU
core. (On a quad core desktop...)

Simply replacing the ustring with std::string would reduce the time to
about 1.5 minutes. Still bad. Also, I didn't want to lose UTF8
awareness.

So I rewrote the algorithm in 'streaming mode'. This has the (potential)
drawback that locale conversions are done, but performs well and
- IMHO - is a lot more readable.

On a minor note: this implementation correctly handles backspaces at the
start of a line.
2011-03-27 10:37:08 -06:00
Curtis Gedak ba28423e76 Remove one level of quoting when spawning commands
Change spawn_command_line_sync to spawn_sync to reduce the level of
quoting required when passing commands to the function.  Since
spawn_command_line_sync uses the parent's environment, the replacement
call also uses the parent's environment.

This change permits unmounting of file systems mounted with an
apostrophe in the mount point name.

Ubuntu launchpad bug 151796 - Can't unmount partition with apostrophe
                              in label
https://bugs.launchpad.net/ubuntu/+source/gparted/+bug/151796
2011-03-19 11:25:04 -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
Curtis Gedak 2f99511228 Add flag --enable-libparted-dmraid to use native libparted dmraid
The new configure option --enable-libparted-dmraid enables the native
use of /dev/mapper dmraid support in the libparted library.

If this option is not specified, or is disabled, then gparted code
will be used to support dmraid.  The gparted code uses the old dmraid
partition naming scheme of always appending the partition number to
the device name.  The letter 'p' is not inserted between the device
name and the partition number.  The gparted code is particularly
useful when used with older versions of libparted that do not support
/dev/mapper dmraid.

Ubuntu launchpad bug 719129 - [Natty] Gparted duplicates dmraid
                              partition devices
https://bugs.launchpad.net/ubuntu/+source/gparted/+bug/719129
2011-02-22 13:22:49 -07:00
Joan Lledó ef37bdb7de Added support to lost data recovery using gpart 2011-01-29 14:58:02 -07:00
Curtis Gedak ec876448b4 Prevent visual disk display area from disappearing
Added a display refresh to the event queue to address this
problem.

Previously, the display area of the visual disk seemed to
disappear when enough operations had been added to the queue so
that a scrollbar was required (about 4 operations).

If the three lines in HBoxOperations::load_operations method for
"//make scrollwindow focus on the last operation in the list"
were commented out then this also prevented the problem from
occurring.

Interestingly, if I changed the "set_cursor" method to
a "scroll_to_row" method, then this problem does not occur for an
additional 2 operations (about 6 operations total).

Ubuntu launchpad bug 583746 - Partition graph disappears after a
                              swap partition has been deleted
https://bugs.launchpad.net/ubuntu/+source/gparted/+bug/583746
2011-01-19 15:34:00 -07:00
Curtis Gedak 6395970e6b Increase robustness of help manual launch
Add direct invocation of yelp if normal open help manual methods
fail.
2011-01-17 09:28:09 -07:00
Curtis Gedak c299bbe9e2 Add possible cause for failure to read file system 2011-01-16 11:39:02 -07:00
Curtis Gedak 09848775f4 Add another reason to list when unable to detect file system 2011-01-16 11:15:35 -07:00
Curtis Gedak 340d506c04 Update copyright year 2011-01-16 10:45:25 -07:00
Curtis Gedak dd1db44639 Fix minor cylinder alignment rounding error (size < 1 cylinder)
Previously when creating a new partition on a device with 512
byte sectors with 7 MiB chosen and cylinder alignment, the
snap_to_cylinder logic would round up to 2 cylinders (~15.69
MiB), instead of the correct 1 cylinder (~7.84 MiB).
2011-01-15 14:46:18 -07:00
Curtis Gedak 6ae39268f2 Fix paste destination partition smaller than source (#639393)
Re-work logic for copying a cylinder aligned partition to a new
MiB aligned partition.  Previously this was partially fixed in
bug #626946 - Destination partition smaller than source partition

Closes Bug #639393 - Redux: Destination partition smaller than
                     source partition
2011-01-15 11:00:42 -07:00
Curtis Gedak b176a96e28 Enhance to work with mount points defined by uuid or label 2010-12-09 14:58:03 -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 3973b6961d Handle characters like spaces in mount points (#629592)
Use mntent C library to read mount point files such as
/etc/fstab, /etc/mtab, and /proc/mounts.

Closes bug #629592 - Unable to find Mount Point if it contains a
                     Space Character
2010-12-09 13:59:33 -07:00
Curtis Gedak 3be3a39a68 Move dmraid device logic outside of for loop
Since this logic did not depend on the for loop variable, it does
not make sense to have this within the for loop.
2010-12-08 16:03:21 -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 3c35a7ff42 Fix incorrect dmraid partition path name (#634553)
Enhance code so that all calls to the ped_partition_get_path
function in the libparted library go through one
GParted_Core::get_partition_path method.

This one method makes the appropriate adjustments to the dmraid
partition path name as required.

Closes bug #634553 - ntfsresize fails on RAID array
2010-11-11 10:37:04 -07:00
Curtis Gedak ceab9bde57 Ensure 1 MiB reserved when moving partition to start of disk
The 1 MiB is required for the partition table stored at the
beginning of the disk device.
2010-10-25 10:59:11 -06:00
Curtis Gedak 7c0e3fa778 Fix crash moving more than one logical partition right (#628863)
This problem would occur when using align to MiB for the
destination partitions.

Closes bug #628863 - gparted crashes applying move to right of
                     more than one logical partition
2010-10-24 12:37:57 -06:00
Curtis Gedak 1ad4864618 Change URL for "Saving Details" to a shorter path
This new URL is actually an html redirect to the actual page
location.  This permits us the flexibility to move the actual
page wherever is needed on the web site without the need to
change the URL location in the code.
2010-10-20 17:34:43 -06:00
Curtis Gedak 232800d6cd Skip move action because linux-swap contains no data (#589555)
Closes bug #589555 - Moving a swap partition needlessly copies
                     all "data" on it
2010-10-19 13:43:42 -06: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 42dafa2e6a Skip copy action because linux-swap does not contain data
This change is related to the following bug report:
Bug #589555 - Moving a swap partition needlessly copies
              all "data" on it
2010-10-19 10:02:18 -06:00
Curtis Gedak d330f9a518 Fix partitions moved or copied using MiB alignment are 1 MiB larger
Correct problem introduced in version 0.6.3 whereby move or copy
operations using MiB alignment resulted in the destination
partition being 1 MiB larger.

Closes bug #632478
2010-10-18 17:08:23 -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
Curtis Gedak 7dd6381c43 Add more translator comments requested in bug #631684 2010-10-15 14:50:58 -06:00
Curtis Gedak 1cdb40e70d Rearrange text for warning when moving a partition 2010-10-13 09:07:53 -06:00
Curtis Gedak d7e1f295a9 Update to support plural forms for string for translators
Closes bug #631684 - Needed Translator Comments
2010-10-13 09:07:53 -06:00
Curtis Gedak 08c78ba19d Add translator comments requested in bug #631684 2010-10-12 18:14:30 -06:00
Curtis Gedak c165544506 Update URLs to new official web site gparted.org 2010-10-12 11:35:26 -06:00
Markus Elfring 1e2562adda Bug #539092: Deletion of unnecessary null pointer checks
A few null pointer checks were deleted because they were not needed any more.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
2010-10-06 12:24:51 -06:00
Seth Heeren ddf225728f erase_filesystem_signatures writes uninitialized data
tagged FIXME
2010-10-05 12:54:55 -06:00
Seth Heeren 71a811cfae leaked FS structures for unsupported partition types
FILESYSTEMS vector copies anyway
2010-10-05 12:54:55 -06:00
Seth Heeren e61b5ff240 leaked regular expression (regfree not called) 2010-10-05 12:54:55 -06:00
Seth Heeren 29e4329182 Unitialized value in OperationDetail::OperationDetail 2010-10-05 12:54:55 -06:00
Seth Heeren 37dad68f45 ped_partition_get_path result not freed 2010-10-05 12:54:55 -06:00
Seth Heeren 18fed5030f leaked FS structures for new partition dialog
FILESYSTEMS vector copies anyway
2010-10-05 12:46:26 -06:00
Seth Heeren 83ff77285a leaked Gtk::HBox 2010-10-05 12:46:26 -06:00
Seth Heeren 58b0e23dd7 remove misuse of ustring in get_filesystem 2010-10-05 10:29:05 -06:00
Luca Bruno 9c41afae91 Use ext2 as default when creating new filesystems
Default to ext2 for filesystem creation, instead of the
alphabetically preceding btrfs. Do not use get_label(),
as it is not available in older gtkmm.
2010-10-05 08:51:53 -06:00
Luca Bruno 5c05233072 Provide set_used_sectors() for Btrfs
Add set_used_sectors() method to Btrfs handler, to show usage statistics
on unmounted volumes.
2010-10-03 17:00:53 +02:00
Luca Bruno 0125278eb7 List Btrfs capabilities in filesystems table
When enabled, show Btrfs capabilities in features table, without skipping
it like other multi-volume systems.
2010-10-03 17:00:53 +02:00
Luca Bruno 5765eb870c Use Btrfs handlers, if enabled at configure time
GParted already has basic support only to recognize Btrfs volumes; if
configured, use our newer methods to handle them.
Also, put in place interface controls for all supported generic actions.
2010-10-03 17:00:53 +02: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 adc55bec50 Fix partitions created using MiB alignment are 1 MiB larger (#631026)
Closes bug #631026 - Partitions created using MiB alignment are
                     1 MiB larger than specified
2010-09-30 11:31:25 -06:00
Curtis Gedak d040e4e584 Use direct assignment for string in class initialization
Change string initialization to use direct assignment instead of
a class method in the GParted_Core class initialization.

Thanks go to Jan Claeys for pointing out this potential problem
and providing the following link:
https://bugzilla.gnome.org/show_bug.cgi?id=627724#c7

This link contains a comment by Matthias Clasen that says:

    "In a class init function, don't do anything that causes
    other threads to initialize classed types."
2010-09-21 11:19:42 -06:00
Curtis Gedak a30f991ca5 Fix size reduced by 1 MiB when created after cylinder aligned partition
Prior to this enhancement creating a new partition aligned to MiB
after a partition aligned to cylinder would result in the creation of
a partition that was 1 MiB smaller in size than requested.  In the
case of a 1 MiB new partition, a warning message would be displayed
indicating that "A partition cannot have a length of 0 sectors".

This problem is avoided by applying similar logic as was used to
address the following bug:
Bug #626946 - Destination partition smaller than source partition
2010-09-09 13:18:02 -06:00
Curtis Gedak b77a5e229d Fix paste destination partition smaller than source (#626946)
Prior to this enhancement when copying and pasting a partition
after a cylinder aligned partition, the destination partition
would become smaller than the source partition if align to MiB
was selected.

Closes bug #626946 - Destination partition smaller than source
                     partition.
2010-09-09 13:18:01 -06:00
Curtis Gedak c17df56af0 Ensure default partition alignment is mebibyte 2010-09-09 13:18:01 -06:00
Curtis Gedak 9d4ae28759 Fix numerical mismatch when graphically moving logical partition (#628554) 2010-09-07 17:01:08 -06:00
Curtis Gedak aa14b25f1b Warn partition move queued that might break boot process (#627199) 2010-09-01 13:56:29 -06: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 545a8583aa Minor cosmetic formatting change 2010-08-25 09:36:13 -06:00
Curtis Gedak c55a8de305 Remove dependency on kpartx for fake RAID support
With this patch the commands required to support motherboard BIOS
RAID, also known as fake RAID, are dmraid and dmsetup.

If the kpartx command is available, it will be used to maintain
device entries that follow the naming convention used by kpartx.

Closes Ubuntu launchpad bug 554582 - GParted does not list dmraid
devices
https://bugs.launchpad.net/ubuntu/+source/gparted/+bug/554582
2010-08-17 10:36:00 -06:00
Curtis Gedak 81986c0990 Ensure partition path name is compatible with dmraid (#622217)
This patch along with a few preceding patches address the
following bug reports:

Closes bug #622217 - gparted live 0.6.0-1 incompatibility with
AMD RAID (SB750 southbridge)

Closes Ubuntu launchpad bug 600729 - Gparted not usable on
fakeraid arrays
https://bugs.launchpad.net/ubuntu/+source/gparted/+bug/600729
2010-08-17 10:36:00 -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 cf264a05bb Replace function ped_partition_get_path with method get_partition_path 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 53c49349f7 Simplify logic in set_device_partitions method
Also clean up some white space
2010-08-17 10:36:00 -06:00
Curtis Gedak 2d4c4017ca Prevent partition table creation if partitions are active
Prevent creating new partition tables on devices that have
mounted file systems, or enabled swap space.

Closes Ubuntu launchpad bug #503125 - gparted allows user to
overwrite active mounted partition
https://bugs.launchpad.net/ubuntu/+source/gparted/+bug/503125
2010-08-10 13:01:40 -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 a4e01bc1d6 Prevent swapon and mount if partition in operation queue (#611431) 2010-08-09 13:37:08 -06:00
Curtis Gedak 44698448aa Add new method partition_in_operation_queue_count 2010-08-09 13:33:28 -06:00
Mike Fleetwood 3194121496 Add labelling of linux-swap
When found, use external swaplabel command to label linux-swap
partitions.  (Available from util-linux-ng 2.18 released 30 Jun 2010).
2010-08-08 10:36:34 -06:00
Curtis Gedak a3d70a1fbf Ensure original partition boundaries kept on rollback of failed move 2010-07-22 17:18:48 -06:00
Curtis Gedak c3a06ffd6c Fix problem with logical partition move overwriting EBR (#623630)
Prevent overwriting meta data (Extended Boot Rectors) for logical
partitions by temporarily increasing the size of the logical
partition to encompass all of the space involved in the move
operation.  The libparted library will move the EBR as needed to
permit this to happen.  After the move the logical partition is
set to the proper size.

This fixes bug #623630 - Move logical partition to right yields
invalid partition table on /dev/sda - wrong signature 0
2010-07-22 17:18:48 -06:00
Curtis Gedak a92f2dad39 Re-enable MiB partition alignment option 2010-07-22 17:18:48 -06:00
Curtis Gedak 1e1ea1f09c Disable MiB alignment temporarily until bug #623630 can be fixed 2010-07-08 09:22:43 -06:00
Curtis Gedak e810b7f7f0 Fix crash moving partitions when size is a multiple of 16 MiB (#623697) 2010-07-06 13:12:19 -06:00
Curtis Gedak f173a51f0b Enable support for devices with sector sizes > 512 bytes (#607165)
GParted requires libparted version 2.2 or higher to support devices
with sector sizes > 512 bytes.

This commit marks the end of a series of enhancements required to
provide support for sector sizes > 512 bytes.
2010-05-27 11:08:40 -06:00
Curtis Gedak be53cf584b Fix off by 1 sector math when looking for unallocated space 2010-05-27 10:59:12 -06:00
Curtis Gedak 87e48efe88 Only show exactly 1 MiB unallocated space if not MBR or EBR
Do not show unallocated space of exactly 1 MiB in size if:

  a) The space is at the front of the drive.

     This space is reserved for the partition table and the
     Master Boot Record.

or

  b) The space immediately precedes a logical partition.

     This space is reserved for the Extended Boot Record.
2010-05-27 09:27:00 -06:00
Curtis Gedak b74dba4f67 Change behavior to better align with GNOME HIG on drop-down lists
Quote from GNOME Human Interface Guidelines 2.2.1 on Drop-down lists:

     "Selecting an item from a drop-down list should not affect the
     values of any other controls. It may sensitize, insensitize, hide
     or show other controls, however."
2010-05-26 17:33:38 -06:00
Curtis Gedak f861501390 Improve cylinder alignment for partitions less than a disk cylinder 2010-05-26 16:57:59 -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 24d96114ca Fix short by 1 MiB on spinbutton before with resize/move 2010-05-25 16:26:08 -06:00
Curtis Gedak 40bb656de5 Disable resizing when the total area is less than two mebibytes 2010-05-25 16:26:07 -06:00
Curtis Gedak ebdb9466e0 Ensure space available for GPT backup partition table on paste 2010-05-25 16:26:07 -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 3db6b074c9 Remove incorrect comment 2010-05-04 15:47:34 -06:00
Curtis Gedak b45b30c2ed Ensure sector size is set when getting a new partition
This change is in preparation for supporting sectors sizes > 512 bytes.
2010-05-04 15:19:49 -06:00
Curtis Gedak 8155d4786d Fix used and unused sector math when pasting a copied partition
This change is in preparation for supporting sectors sizes > 512 bytes.
2010-05-04 15:18:43 -06:00
Curtis Gedak bec2a6f176 Fix minimum size calculation when pasting a copied partition
This change is in preparation for supporting sectors sizes > 512 bytes.
2010-05-04 15:00:39 -06:00
Curtis Gedak 6369e58bff Enhance detection for ext3, fat16, fat32, linux-swap, and hfsplus
This change is in preparation for supporting sectors sizes > 512 bytes.
2010-04-28 14:11:24 -06:00
Curtis Gedak 66355153fb Enhance file system space unused math to use actual sector size 2010-04-28 13:25:57 -06:00
Curtis Gedak 9e5e9f5627 Enhance file system detection to use FS_Info method - blkid
This enhancement was added because the current libparted library,
version 2.2, does not appear to detect file systems for sector
sizes other than 512 bytes.
2010-04-28 12:58:28 -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 70448f4fb0 Replace sector math with get_byte_length method where appropriate
This change is in preparation for supporting sectors sizes > 512 bytes.
2010-04-27 12:54:14 -06:00
Curtis Gedak c3cae3b6eb Enhance set_valid_operations method to handle different sector sizes 2010-04-27 11:41:43 -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 81a903cda2 Replace constant MEBIBYTE with appropriate MEBI_FACTOR math
This change is in preparation for supporting sectors sizes > 512 bytes.
2010-04-26 13:21:18 -06:00
Curtis Gedak 5d2bf2ec5d Replace default sector size with appropriate sector size
This change is in preparation for supporting sectors sizes > 512 bytes.
2010-04-26 11:52:33 -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 c3352fb24a Clean up progress bar current status after copy/move action
Also ensure that final progress bar current status is set to
completed value when the copy blocks method completes.
2010-04-25 11:09:18 -06:00
Curtis Gedak 0d5c06f85d Add logic for copy and paste between devices with different sector sizes
This change is in preparation for supporting sectors sizes > 512 bytes.
2010-04-23 13:28:41 -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 1a498b62bf Enable copy to work on computers with only 128 MiB RAM (#613430) 2010-03-24 14:47:46 -06:00
Curtis Gedak 44e5176ee5 Enhance format_size() for sector sizes > 512 bytes 2010-03-24 14:37:08 -06:00
Curtis Gedak eb7e09aac8 Remove GParted:: prefix from in front of UNIT constants 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 f23746959f Fix mkswap error "UUID parsing failed" when resizing with no UUID
See following debian bug report:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=573836
2010-03-14 13:46:59 -06:00
Curtis Gedak e786bfa598 Enhance erase_filesytem_signatures() for sector sizes > 512 bytes 2010-03-14 13:46:59 -06:00
Curtis Gedak 892e56f9b6 Enhance file system detection for sector sizes > 512 bytes 2010-03-14 13:46:59 -06:00
Curtis Gedak 4c0b514e22 Set device length to value from libparted
Previously this value was calculated to end on a cylinder
boundary.  On today's larger hard drives, which simply emulate
Cylinders/Heads/Sectors, some disk space might remain after the
last cylinder.  This space would always be less than a full
cylinder in size.  Now this space will be visible to the user.
2010-03-14 13:46:59 -06:00
Petr Uzel c722047c36 Avoid compiler warning
Report of this problem can be found in the mailing list archive:
http://sourceforge.net/mailarchive/forum.php?thread_name=4B967C26.2090608%40gmail.com&forum_name=gparted-devel
2010-03-10 09:11:40 -07:00
Curtis Gedak 260e0ea190 Fix bug when copying huge NTFS partition never finishes (#575324)
Improved logic in cleanup_cursor method to minimize the number of
string erase operations performed.

Previously when the NTFS copy finished, GParted would take an
exceptionally long time to clean up the output.  This was due to
the huge number of small string erase operations performed on a
extremely large string.
2010-03-01 13:56:05 -07:00
Curtis Gedak 39208ba2af Add check if partition table re-read work around code is needed
A patch to alleviate the "failure to inform kernel of partition
changes problem" (bug #604298) has been included in parted-2.2.
Hence when parted-2.2 or higher is used, the work around code in
GParted is not required.
2010-03-01 11:05:03 -07:00
Curtis Gedak 4e2be4047c Remove comment about wrong identifier for HFS/HFS+ (#568867)
With parted-2.2 the partition identifier for HFS and HFS+ is set to 0xAF.
With previous versions of parted this was incorrectly set to 0x83.
2010-02-26 10:36:54 -07: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 ed6d8f0cee Make partition "New" label available for translation (#610540) 2010-02-22 10:33:18 -07:00