From d31de200b82ef66d7e87b32dd5345c053997cc35 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Wed, 13 Jul 2011 09:27:57 +0100 Subject: [PATCH] virt-resize: Add --ntfsresize-force option. Use the non-deprecated g#ntfsresize_opts API call, and also add the --ntfsresize-force option for forcing resize. --- resize/resize.ml | 9 ++++++--- resize/virt-resize.pod | 8 ++++++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/resize/resize.ml b/resize/resize.ml index 82fd765..8e7057c 100644 --- a/resize/resize.ml +++ b/resize/resize.ml @@ -30,7 +30,7 @@ let prog = Filename.basename Sys.executable_name let infile, outfile, copy_boot_loader, debug, deletes, dryrun, expand, expand_content, extra_partition, format, ignores, - lv_expands, output_format, + lv_expands, ntfsresize_force, output_format, quiet, resizes, resizes_force, shrink = let display_version () = let g = new G.guestfs () in @@ -57,6 +57,7 @@ let infile, outfile, copy_boot_loader, debug, deletes, dryrun, let format = ref "" in let ignores = ref [] in let lv_expands = ref [] in + let ntfsresize_force = ref false in let output_format = ref "" in let quiet = ref false in let resizes = ref [] in @@ -85,6 +86,7 @@ let infile, outfile, copy_boot_loader, debug, deletes, dryrun, "-n", Arg.Set dryrun, " Don't perform changes"; "--dryrun", Arg.Set dryrun, " -\"-"; "--dry-run", Arg.Set dryrun, " -\"-"; + "--ntfsresize-force", Arg.Set ntfsresize_force, " Force ntfsresize"; "--output-format", Arg.Set_string format, "format Format of output disk"; "-q", Arg.Set quiet, " Don't print the summary"; "--quiet", Arg.Set quiet, " -\"-"; @@ -123,6 +125,7 @@ read the man page virt-resize(1). let format = match !format with "" -> None | str -> Some str in let ignores = List.rev !ignores in let lv_expands = List.rev !lv_expands in + let ntfsresize_force = !ntfsresize_force in let output_format = match !output_format with "" -> None | str -> Some str in let quiet = !quiet in let resizes = List.rev !resizes in @@ -138,7 +141,7 @@ read the man page virt-resize(1). infile, outfile, copy_boot_loader, debug, deletes, dryrun, expand, expand_content, extra_partition, format, ignores, - lv_expands, output_format, + lv_expands, ntfsresize_force, output_format, quiet, resizes, resizes_force, shrink (* Default to true, since NTFS support is usually available. *) @@ -916,7 +919,7 @@ let () = | Resize2fs -> g#e2fsck_f target; g#resize2fs target - | NTFSResize -> g#ntfsresize target + | NTFSResize -> g#ntfsresize_opts ~force:ntfsresize_force target in (* Expand partition content as required. *) diff --git a/resize/virt-resize.pod b/resize/virt-resize.pod index c84e40f..69c93e3 100644 --- a/resize/virt-resize.pod +++ b/resize/virt-resize.pod @@ -405,6 +405,14 @@ of partitions, if it knows how (see I<--expand> option above). If you give the I<--no-expand-content> option then virt-resize will not attempt this. +=item B<--ntfsresize-force> + +Pass the I<--force> option to L, allowing resizing +even if the NTFS disk is marked as needing a consistency check. +You have to use this option if you want to resize a Windows +guest multiple times without booting into Windows between each +resize. + =item B<-d> =item B<--debug> -- 1.8.3.1