diff -up parted-1.9.0/libparted/disk.c.entiredisk parted-1.9.0/libparted/disk.c --- parted-1.9.0/libparted/disk.c.entiredisk 2009-12-15 19:22:01.000000000 +0100 +++ parted-1.9.0/libparted/disk.c 2009-12-15 20:19:30.000000000 +0100 @@ -785,10 +785,15 @@ ped_disk_max_partition_start_sector (con int ped_disk_set_flag(PedDisk *disk, PedDiskFlag flag, int state) { + int ret; + PED_ASSERT (disk != NULL, return 0); PedDiskOps *ops = disk->type->ops; + if (!_disk_push_update_mode(disk)) + return 0; + if (!ped_disk_is_flag_available(disk, flag)) { ped_exception_throw ( PED_EXCEPTION_ERROR, @@ -796,10 +801,16 @@ ped_disk_set_flag(PedDisk *disk, PedDisk "The flag '%s' is not available for %s disk labels.", ped_disk_flag_get_name(flag), disk->type->name); + _disk_pop_update_mode(disk); return 0; } - return ops->disk_set_flag(disk, flag, state); + ret = ops->disk_set_flag(disk, flag, state); + + if (!_disk_pop_update_mode (disk)) + return 0; + + return ret; } /** diff -up parted-1.9.0/libparted/labels/dos.c.entiredisk parted-1.9.0/libparted/labels/dos.c --- parted-1.9.0/libparted/labels/dos.c.entiredisk 2009-12-15 19:22:01.000000000 +0100 +++ parted-1.9.0/libparted/labels/dos.c 2009-12-15 20:19:38.000000000 +0100 @@ -2242,7 +2242,10 @@ add_startend_metadata (PedDisk* disk) else init_end = PED_MIN (dev->bios_geom.sectors - 1, init_end - 1); - if (!get_end_last_nonfree_part(disk, &final_start)) + DosDiskData *disk_specific = disk->disk_specific; + if (!disk_specific->cylinder_alignment) + final_start = dev->length - 1; + else if (!get_end_last_nonfree_part(disk, &final_start)) final_start = ped_round_down_to (dev->length, cyl_size); else final_start = PED_MAX (final_start + 1,