free (err);
return 0;
}
+
+int
+do_e2fsck_f (const char *device)
+{
+ char *err;
+ int r;
+
+ IS_DEVICE (device, -1);
+
+ r = command (NULL, &err, "/sbin/e2fsck", "-p", "-f", device, NULL);
+ if (r == -1) {
+ reply_with_error ("e2fsck: %s", err);
+ free (err);
+ return -1;
+ }
+
+ free (err);
+ return 0;
+}
["write_file"; "/new"; "test content"; "0"];
["umount"; "/"];
["lvresize"; "/dev/VG/LV"; "20"];
+ ["e2fsck_f"; "/dev/VG/LV"];
["resize2fs"; "/dev/VG/LV"];
["mount"; "/dev/VG/LV"; "/"];
["cat"; "/new"]], "test content")],
"resize an ext2/ext3 filesystem",
"\
This resizes an ext2 or ext3 filesystem to match the size of
-the underlying device.");
+the underlying device.
+
+I<Note:> It is sometimes required that you run C<guestfs_e2fsck_f>
+on the C<device> before calling this command. For unknown reasons
+C<resize2fs> sometimes gives an error about this and sometimes not.
+In any case, it is always safe to call C<guestfs_e2fsck_f> before
+calling this function.");
("find", (RStringList "names", [String "directory"]), 107, [],
[InitBasicFS, Always, TestOutputList (
The returned list is sorted.");
+ ("e2fsck_f", (RErr, [String "device"]), 108, [],
+ [], (* lvresize tests this *)
+ "check an ext2/ext3 filesystem",
+ "\
+This runs C<e2fsck -p -f device>, ie. runs the ext2/ext3
+filesystem checker on C<device>, noninteractively (C<-p>),
+even if the filesystem appears to be clean (C<-f>).
+
+This command is only needed because of C<guestfs_resize2fs>
+(q.v.). Normally you should use C<guestfs_fsck>.");
+
]
let all_functions = non_daemon_functions @ daemon_functions