--- parted/parted.c | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) Index: parted/parted.c =================================================================== --- parted/parted.c.orig 2010-05-28 17:09:04.000000000 +0200 +++ parted/parted.c 2010-07-08 13:26:06.000000000 +0200 @@ -1917,7 +1917,7 @@ do_resize (PedDevice** dev) issue_fs_op_warning ("resize"); PedDisk *disk; PedPartition *part = NULL; - PedFileSystem *fs; + PedFileSystem *fs = NULL; PedConstraint *constraint; PedSector start, end; PedGeometry *range_start = NULL, *range_end = NULL; @@ -1959,22 +1959,39 @@ do_resize (PedDevice** dev) goto error_destroy_constraint; ped_partition_set_system (part, NULL); } else { + int always_resize = getenv( "YAST_IS_RUNNING" ) != NULL; + const char* fsname = ""; + if( always_resize ) + { + PedFileSystemType* fst = ped_file_system_probe( &part->geom ); + if( fst ) + fsname = fst->name; + } fs = ped_file_system_open (&part->geom); - if (!fs) + if (!fs && (!always_resize || strncmp(fsname,"fat",3)==0) ) goto error_destroy_disk; + if (fs) constraint = constraint_intersect_and_destroy ( ped_file_system_get_resize_constraint (fs), constraint_from_start_end ( *dev, range_start, range_end)); + else + { + new_geom.start = part->geom.start; + constraint = ped_constraint_exact(&new_geom); + } if (!ped_disk_set_partition_geom (disk, part, constraint, new_geom.start, new_geom.end)) goto error_close_fs; - if (!ped_file_system_resize (fs, &part->geom, g_timer)) + if(fs && (!always_resize || strncmp(fsname,"fat",3)==0)) + { + if (!ped_file_system_resize (fs, &part->geom, g_timer) && !always_resize ) goto error_close_fs; /* may have changed... eg fat16 -> fat32 */ ped_partition_set_system (part, fs->type); ped_file_system_close (fs); } + } ped_disk_commit (disk); ped_constraint_destroy (constraint); @@ -1990,6 +2007,7 @@ do_resize (PedDevice** dev) return 1; error_close_fs: + if (fs) ped_file_system_close (fs); error_destroy_constraint: ped_constraint_destroy (constraint);