Note that this operation is risky and not atomic. \fBDon't forget to backup your data!\fR
+See also \fB\-\-move\-use\-fsync\fR.
+
In the example below, the first command creates a 100MiB free area before
the first partition and moves the data it contains (e.g. a filesystem),
the next command creates a new partition from the free space (at offset 2048),
.sp
.RE
+.TP
+.BR \-\-move\-use\-fsync
+Use fsync system call after each write when move dara to a new location by
+\fB\-\-move\-data\fR.
.TP
.BR \-o , " \-\-output " \fIlist
Specify which output columns to print. Use
append : 1, /* don't create new PT, append partitions only */
json : 1, /* JSON dump */
movedata: 1, /* move data after resize */
+ movefsync: 1, /* use fsync() afetr each write() */
notell : 1, /* don't tell kernel aout new PT */
noact : 1; /* do not write to device */
};
rc = write(fd, buf, step_bytes);
if (rc < 0 || rc != (ssize_t) step_bytes)
goto fail;
- fsync(fd);
+ if (sf->movefsync)
+ fsync(fd);
}
/* write log */
fputs(_(" -b, --backup backup partition table sectors (see -O)\n"), out);
fputs(_(" --bytes print SIZE in bytes rather than in human readable format\n"), out);
fputs(_(" --move-data[=<typescript>] move partition data after relocation (requires -N)\n"), out);
+ fputs(_(" --move-use-fsync use fsync after each write when move data\n"), out);
fputs(_(" -f, --force disable all consistency checking\n"), out);
fprintf(out,
_(" --color[=<when>] colorize output (%s, %s or %s)\n"), "auto", "always", "never");
OPT_BYTES,
OPT_COLOR,
OPT_MOVEDATA,
+ OPT_MOVEFSYNC,
OPT_DELETE,
OPT_NOTELL
};
{ "no-reread", no_argument, NULL, OPT_NOREREAD },
{ "no-tell-kernel", no_argument, NULL, OPT_NOTELL },
{ "move-data", optional_argument, NULL, OPT_MOVEDATA },
+ { "move-use-fsync", no_argument, NULL, OPT_MOVEFSYNC },
{ "output", required_argument, NULL, 'o' },
{ "partno", required_argument, NULL, 'N' },
{ "reorder", no_argument, NULL, 'r' },
sf->movedata = 1;
sf->move_typescript = optarg;
break;
+ case OPT_MOVEFSYNC:
+ sf->movefsync = 1;
+ break;
case OPT_DELETE:
sf->act = ACT_DELETE;
break;